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

http://www.cnblogs.com/siyunianhua/p/4004361.html

 

這篇文章主要介紹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;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章