2014年8月12日 星期二

Oracle 12c - PDB 帳號



在官方的文件裡有說明,在12C CDB裡 Account 分成兩部份,一個是可以在CDB下的PDB任意通行的帳號:Common user ,另外一個只能登錄自己所屬的PDB: Local user


Common user 又分成兩種,一種是系統user (SYS,SYSTEM) 可以任意的再PDB登錄,一種是自建user 是以C##開頭,則必須要有相關的權限才能登錄PDB (create session )


以下的圖則可以更清楚的了解12C的帳號概念





以下是對 common user 做個小小的測試

1.先建立Common user
 SQL>  create user c##test_1 identified by test_1 default tablespace users;

User created.

SQL>

2.連上PDB,發現沒有權限

C:\Users\oracle>sqlplus c##test_1/test_1@localhost/test_db1

SQL*Plus: Release 12.1.0.1.0 Production on Tue Aug 12 14:53:40 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ERROR:
ORA-01045: user C##TEST_1 lacks CREATE SESSION privilege; logon denied


3.使用sys登入PDB並授權給C##test,授權完就可以登入囉

C:\Users\oracle>sqlplus sys/oracle@localhost/test_db1 as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Tue Aug 12 14:55:49 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions

SQL> grant create session to c##test_1;

Grant succeeded.

SQL> exit

C:\Users\oracle>sqlplus c##test_1/test_1@localhost/test_db1

SQL*Plus: Release 12.1.0.1.0 Production on Tue Aug 12 14:56:49 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions

SQL> show con_name

CON_NAME
------------------------------
TEST_DB1


可見,只要有足够的權限,common user 可以登錄任何 PDB。



沒有留言:

張貼留言