基于版本:19c (12.2.0.3) AskScuti
创建方法:克隆本地PDB(从本地其他PDB创建新的PDB)
对应路径:Creating a PDB --> Cloning --> Locally
具体请参考《在多租户(容器)数据库中如何创建PDB:方法2》
1. 内容总览
2. 设置 PDB_FILE_NAME_CONVERT
3. 使用 FILE_NAME_CONVERT 本地克隆
4. 使用 CREATE_FILE_DEST 本地克隆
1. 内容总览
接--克隆本地PDB一文中的其他参数设置。
2. 设置 PDB_FILE_NAME_CONVERT
SQL> !mkdir /u01/app/oracle/oradata/CDB1/pdb3 SQL> show parameter pdb_file SQL> alter system set pdb_file_name_convert='/u01/app/oracle/oradata/CDB1/pdb1','/u01/app/oracle/oradata/CDB1/pdb3'; System altered.
创建PDB3
SQL> alter pluggable database pdb1 close; Pluggable database altered. SQL> alter pluggable database pdb1 open read only; Pluggable database altered. SQL> create pluggable database pdb3 from pdb1; Pluggable database created. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- --------- ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ ONLY NO 4 PDB2 READ WRITE NO 5 PDB3 MOUNTED
开启PDB3
SQL> alter pluggable database pdb3 open; Pluggable database altered.
3. 使用 FILE_NAME_CONVERT 本地克隆
使用 FILE_NAME_CONVERT 子句创建
SQL> !mkdir /u01/app/oracle/oradata/CDB1/pdb4 SQL> create pluggable database pdb4 from pdb1 file_name_convert=('/u01/app/oracle/oradata/CDB1/pdb1','/u01/app/oracle/oradata/CDB1/pdb4'); Pluggable database created.
注意:被克隆的PDB1要处于只读状态。
SQL> alter pluggable database pdb4 open; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- --------- ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ ONLY NO 4 PDB2 READ WRITE NO 5 PDB3 READ WRITE NO 6 PDB4 READ WRITE NO
4. 使用 CREATE_FILE_DEST 本地克隆
使用 CREATE_FILE_DEST 子句创建
SQL> !mkdir /u01/app/oracle/oradata/CDB1/pdb5 SQL> create pluggable database pdb5 from pdb1 create_file_dest='/u01/app/oracle/oradata/CDB1/pdb5'; Pluggable database created.
注意:被克隆的PDB1要处于只读状态。
SQL> alter pluggable database pdb5 open; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- --------- ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ ONLY NO 4 PDB2 READ WRITE NO 5 PDB3 READ WRITE NO 6 PDB4 READ WRITE NO 7 PDB5 READ WRITE NO