Oracle 12c創建用戶時出現“ORA-65096: invalid common user or role name”的錯誤


這篇文章主要介紹CDB和PDB的基本管理,資料來源oracle官方。 

基本概念:

Multitenant Environment:多租戶環境

CDB(Container Database):數據庫容器

PD(Pluggable Database):可插拔數據庫

CDB與PDB關系圖

     COMMON USERS(普通用戶):經常建立在CDB層,用戶名以C##或c##開頭;

     LOCAL USERS(本地用戶):僅建立在PDB層,建立的時候得指定CONTAINER。

在oracle 12c中,使用了一個container(容器)的概念,讓我們先看看官方的對它的介紹,為了保留最原始的意思,這里引用英文而不翻譯了。

The data dictionary in each container in a CDB is separate, and the current container is the container whose data dictionary is used for name resolution and for privilege authorization. The current container can be the root or a PDB. Each session has exactly one current container at any point in time, but it is possible for a session to switch from one container to another.

Each container has a unique ID and name in a CDB. You can use the CON_ID and CON_NAME parameters in the USERENV namespace to determine the current container ID and name with the SYS_CONTEXT function.

1、查看Oracle 12c的版本

 
         
SQL> select * from v$version;

SQL>select sys_context ('USERENV', 'CON_NAME') from dual; 
SYS_CONTEXT('USERENV','CON_NAME')
----------------------------------------------------------------------------------------------------
CDB$ROOT

2、我們可以通過ALTER SESSION SET CONTAINER 指定其他容器

SQL>select con_id,dbid,NAME,OPEN_MODE from v$pdbs;

3、將Pdb open:

SQL> alter pluggable database pdborcl open;

 

4、查看容器

SQL>select con_id,dbid,NAME,OPEN_MODE from v$pdbs;

5、切換容器到pdb

SQL> alter session set container=PDBORCL;

6、查看當前使用容器

SQL>select sys_context ('USERENV', 'CON_NAME') from dual; 

7、創建用戶 

SQL>create user informix identified by gmgl;

SQL>grant dba to informix;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM