日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Oracle 12C 多种方式创建PDB

發(fā)布時(shí)間:2025/3/14 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle 12C 多种方式创建PDB 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1、從PDB$SEED創(chuàng)建新PDB

SQL> create pluggable database PDB3 admin user pdb3admin identified by oracle file_name_convert=('/u01/oradata/cdb1/pdbseed','/u01/oradata/cdb1/pdb3') ;

2、克隆本地PDB

SQL> show pdbsCON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ----------2 PDB$SEED READ ONLY NO3 PDB1 READ WRITE NO4 PDB2 MOUNTED6 PDB3 MOUNTED SQL> alter pluggable database pdb1 close; 插接式數(shù)據(jù)庫(kù)已變更。 SQL> alter pluggable database pdb1 open read only; 插接式數(shù)據(jù)庫(kù)已變更。 SQL> create pluggable database pdb4 from pdb1 file_name_convert=('/u01/oradata/cdb1/pdb1','/u01/oradata/cdb1/pdb4') ; 插接式數(shù)據(jù)庫(kù)已創(chuàng)建。 SQL>

  

3、克隆遠(yuǎn)程 PDB
該操作有一些限制。源和目標(biāo) CDB 平臺(tái)必須滿足以下要求:它們必須安裝有相同的 endian 格式和兼容的數(shù)據(jù)庫(kù)項(xiàng),并使用相同的字符集和國(guó)家字符集。

Check the CHARACTERSET of remote and local CDB

col parameter for a30 col value for a30 select * from nls_database_parameters where parameter='NLS_CHARACTERSET' or parameter='NLS_LANGUAGE' or parameter='NLS_NCHAR_CHARACTERSET';

Check the remote CDB is in local undo mode and archivelog mode.

COLUMN property_name FORMAT A30 COLUMN property_value FORMAT A30SELECT property_name, property_value FROM database_properties WHERE property_name = 'LOCAL_UNDO_ENABLED';PROPERTY_NAME PROPERTY_VALUE ------------------------------ ------------------------------ LOCAL_UNDO_ENABLED TRUESELECT log_mode FROM v$database;LOG_MODE ------------ ARCHIVELOGSQL>

whitch of two is not be provided ,need to turn the remote database into read-only mode.

on remote source CDB:

SQL> alter session set container=pdb2; Session altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 4 PDB2 READ WRITE NOSQL> create user pdbclone identified by welcome123; SQL> grant create session,create pluggable database to pdbclone; SQL> alter pluggable database pdb2 close; SQL> alter pluggable database pdb2 open read only; SQL> show pdbs;CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 4 PDB2 READ ONLY NO

on local destination CDB:

SQL> create database link clone_link connect to pdbclone identified by welcome123 using '192.168.56.33:1521/pdb2'; SQL> create pluggable database pdblk from PDB2@clone_link file_name_convert=('/u01/oradata/cdb1/pdb2','/u01/oradata/cdb1/pdblk') ; 插接式數(shù)據(jù)庫(kù)已創(chuàng)建。 SQL> ! ls /u01/oradata/cdb1/pdblk sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf SQL>

on remote source CDB ,Switch the source PDB back to read/write

SQL> alter pluggable database pdb2 close; Pluggable database altered. SQL> alter pluggable database pdb2 open; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 4 PDB2 READ WRITE NO

4、克隆遠(yuǎn)程 Non-CDB
該操作有一些限制。源和目標(biāo) CDB 平臺(tái)必須滿足以下要求:它們必須安裝有相同的 endian 格式和兼容的數(shù)據(jù)庫(kù)項(xiàng),并使用相同的字符集和國(guó)家字符集。
Check the CHARACTERSET of remote Non-CDB and local CDB

col parameter for a30 col value for a30 select * from nls_database_parameters where parameter='NLS_CHARACTERSET' or parameter='NLS_LANGUAGE' or parameter='NLS_NCHAR_CHARACTERSET';

Check the remote Non-CDB is in archivelog mode.If not need to turn the remote database into read-only mode.

SQL> SELECT log_mode FROM v$database; LOG_MODE ------------ ARCHIVELOG SQL> create user nocdbclone identified by welcome123; SQL> grant create session,create pluggable database to nocdbclone; SQL> startup mount; SQL> alter database open read only; Database altered.

Create a new PDB in the local database by cloning the remote non-CDB.?

SQL>create database link clone_link connect to nocdbclone identified by welcome123 using '192.168.56.33:1521/ora12c'; SQL> CREATE PLUGGABLE DATABASE nocdbtopdb FROM NON$CDB@clone_link file_name_convert=('/u01/oradata/ora12c','/u01/oradata/cdb1/nocdbtopdb') ; 插接式數(shù)據(jù)庫(kù)已創(chuàng)建。 SQL> !ls /u01/oradata/cdb1/nocdbtopdb sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ ONLY NO 4 PDB2 MOUNTED 5 PDB4 MOUNTED 6 PDB3 MOUNTED 7 PDBLK MOUNTED 8 NOCDBTOPDB MOUNTED SQL> ALTER SESSION SET CONTAINER=NOCDBTOPDB;會(huì)話已更改。 SQL>@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql SQL> ALTER PLUGGABLE DATABASE nocdbtopdb open;插接式數(shù)據(jù)庫(kù)已變更。SQL> show pdbsCON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 8 NOCDBTOPDB READ WRITE NO

5、Unplugging PDB & Plug Unplugging PDB

SQL> alter session set container=pdb1; SQL> select name from v$datafile; SQL> alter session set container=CDB$ROOT; SQL> show con_nameCON_NAME ------------------------------ CDB$ROOT SQL> alter pluggable database PDB1 close immediate; SQL> alter pluggable database PDB1 unplug into '/tmp/PDB1.xml'; SQL> drop pluggable database PDB1 keep datafiles;SQL> set serveroutput on DECLARE l_result BOOLEAN; BEGIN l_result := DBMS_PDB.check_plug_compatibility(pdb_descr_file => '/tmp/PDB1.xml',pdb_name => 'PDB10'); IF l_result THEN DBMS_OUTPUT.PUT_LINE('Yes'); ELSE DBMS_OUTPUT.PUT_LINE('No'); END IF; END; / #這里的 PDB 可以同名也可以不同名 SQL> create pluggable database PDB10 using '/tmp/PDB1.xml' nocopy ; SQL> alter pluggable database pdb10 open;

6、其他
  The local and remote databases must have the same endianness.
  The local and remote databases must either have the same options installed, or the remote database must have a subset of those present on the local database.
  If the character set of the local CDB is AL32UTF8, the remote database can be any character set. If the local CDB does not use AL32UTF8, the character sets of the remote and local databases much match.
  If the remote database uses Transparent Data Encryption (TDE) the local CDB must be configured appropriately before attempting the clone. If not you will be left with a new PDB that will only open in restricted mode.
  Bug 19174942 is marked as fixed in 12.2. I can't confirm this, so just in case I'll leave this here, but it should no longer be the case. The default tablespaces for each common user in the remote PDB *must* exist in local CDB. If this is not true, create the missing tablespaces in the root container of the local PDB. If you don't do this your new PDB will only be able to open in restricted mode (Bug 19174942).
  When cloning from a non-CDB, both the the local and remote databases must using version 12.1.0.2 or higher.

Related articles.
https://oracle-base.com/articles/12c/multitenant-hot-clone-remote-pdb-or-non-cdb-12cr2#cloning-remote-pdb

轉(zhuǎn)載于:https://www.cnblogs.com/JcLevy/p/11237404.html

總結(jié)

以上是生活随笔為你收集整理的Oracle 12C 多种方式创建PDB的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。