1. 创建测试PDB
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 SEED_PDB MOUNTED
4 NONCDB_PDP MOUNTED
5 CLON_PDB MOUNTED
SQL> CREATE PLUGGABLE DATABASE test_pdb ADMIN USER pdb_mgr IDENTIFIED BY oracle file_name_convert=('/u01/app/oracle/oradata/zylong/pdbseed','/u01/app/oracle/oradata/zylong/test_pdb');
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 SEED_PDB MOUNTED
4 NONCDB_PDP MOUNTED
5 CLON_PDB MOUNTED
6 TEST_PDB MOUNTED
2. 在测试PDB上创建测试用户
SQL> alter session set container=test_pdb;
Session altered.
SQL> Create user testab identified by oracle;
User created.
SQL> grant connect,resource to testab;
Grant succeeded.
SQL> select username from all_users where username='TESTAB';
USERNAME
-------------------------------------------------------------------------------
TESTAB
3. 克隆一个已有的PDB
## 当前的PDB不能被克隆,需要进入CDB中克隆PDB。
SQL> conn / as sysdba
Connected.
SQL> CREATE PLUGGABLE DATABASE pdb4 FROM test_pdb
2 file_name_convert=('/u01/app/oracle/oradata/zylong/test_pdb','/u01/app/oracle/oradata/zylong/pdb4');
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 SEED_PDB MOUNTED
4 NONCDB_PDP MOUNTED
5 CLON_PDB MOUNTED
6 TEST_PDB READ WRITE NO
7 PDB4 MOUNTED
SQL> Alter pluggable database pdb4 open;
Pluggable database altered.
SQL> alter session set container=pdb4;
Session altered.
SQL> select username from all_users where username='TESTAB';
USERNAME
-------------------------------------------------------------------------------
TESTAB