Oracle 12C 新特性之 PDB熱克隆(本地克隆、遠端異機克隆)
說明:版本12.2.0.1
12c r1版本中 clone 一份PDB源庫需要開啟在read only只讀模式 , 在12c r2版本中引入了local undo mode, 源PDB在read/write 讀寫模式也可以 clone 。 local undo mode 也是oracle推崇的模式。
說明: shared undo 與 Local undo 模式切換 可以參考 http://blog.csdn.net/zhang123456456/article/details/71374528要求:
1、 Archive Log Enabled
2、 Local Undo Enabled
3、 destination CDB must have a public database link to the source CDB,have sufficient privileges to use the database link.
一、 克隆本地pdb
[oracle@12c ~]$ sqlplus / as sysdba
-- 檢查是否開啟 local undo
SQL>
col PROPERTY_NAME for a25;
col PROPERTY_VALUE for a25;
select PROPERTY_NAME,PROPERTY_VALUE from database_properties where property_name='LOCAL_UNDO_ENABLED';
PROPERTY_NAME PROPERTY_VALUE
------------------------- -------------------------
LOCAL_UNDO_ENABLED TRUE
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
SQL> show parameter pdb_file_name_convert
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
pdb_file_name_convert string
-- clone pdb 數量為一 , 注意這裡 pdb_file_name_convert 引數生效級別設定的是 session , 如有需要,自行設定為全域性
SQL> alter session set pdb_file_name_convert='pdb01','pdb02';
Session altered.
SQL> create pluggable database pdb02 from pdb01;
Pluggable database created.
SQL> alter pluggable database pdb02 open;
Pluggable database created.
SQL> alter pluggable database pdb02 close immediate;
Pluggable database altered.
-- clone pdb 數量為多
SQL> alter session set pdb_file_name_convert='pdb01','pdb02,pdb03';
Session altered.
SQL> create pluggable database pdb03 from pdb01;
Pluggable database created.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
4 PDB02 MOUNTED
5 PDB03 MOUNTED
SQL> alter pluggable database pdb02 open;
Pluggable database altered.
SQL> alter pluggable database pdb03 open;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
4 PDB02 READ WRITE NO
5 PDB03 READ WRITE NO
二、 克隆遠端pdb--源端
SQL> create user c##andy identified by andy container=all;
User created.
SQL> grant dba to c##andy container=all;
Grant succeeded.
-- 目標端cdb執行
SQL> create database link clonePdb connect to c##andy identified by andy using '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.219.24.17)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = pdb01)))';
Database link created.
-- 源端
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
-- 目標端cdb
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
4 PDB02 READ WRITE NO
5 PDB03 READ WRITE NO
SQL> alter session set pdb_file_name_convert='pdb01','pdb04';
Session altered.
-- 透過 dblink 克隆源端的 pdb
SQL> create pluggable database pdb04 from pdb01@clonePdb;
Pluggable database created.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
4 PDB02 READ WRITE NO
5 PDB03 READ WRITE NO
6 PDB04 MOUNTED
SQL> alter pluggable database pdb04 open;
alter pluggable database pdb04 open
*
ERROR at line 1:
ORA-14694: database must in UPGRADE mode to begin MAX_STRING_SIZE migration
SQL> ho oerr ora 14694
14694, 00000, "database must in UPGRADE mode to begin MAX_STRING_SIZE migration"
// *Cause: An attempt was made to update the MAX_STRING_SIZE parameter
// to EXTENDED when the database was not in UPGRADE mode.
//* Action: Restart the database in UPGRADE mode, modify the parameter,
// run the utl32k.sql script in $ORACLE_HOME/rdbms/admin, and
// restart the database in normal mode.
說明: 這個報錯的原因是目標端使用了12c的新特性extended data type ,源端沒有使用這個新特性,從源端克隆過來的pdb需要擴充套件 extended data type 新特性與目標端保持一致。有關新特性extended data type ,
參考http://blog.csdn.net/zhang123456456/article/details/71713201
-- 新克隆的pdb擴充 extended data type 新特性
SQL> alter session set container=pdb04;
Session altered.
SQL> startup upgrade;
Pluggable Database opened.
SQL> show parameter max_string_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
max_string_size stringEXTENDED
SQL> @$ORACLE_HOME/rdbms/admin/utl32k.sql
SQL> shutdown immediate;
Pluggable Database closed.
SQL> startup;
Pluggable Database opened.
SQL> alter session set container=cdb$root;
Session altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NO
4 PDB02 READ WRITE NO
5 PDB03 READ WRITE NO
6 PDB04 READ WRITE NO
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31383567/viewspace-2139221/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 建立PDB-遠端克隆Oracle
- Oracle 建立PDB-本地克隆Oracle
- oracle 12c使用dblink克隆pdbOracle
- 建立、克隆pdb---oracle 12c 學習(1)Oracle
- 如何在本地克隆遠端github倉庫Github
- Z003-O001-03 克隆遠端 PDB
- Oracle 12c多租戶特性詳解:PDB 的建立、克隆與維護Oracle
- Oracle 12.2 新特性:線上PDB資料庫克隆(Pluggable Hot Clone)Oracle資料庫
- PDB克隆遷移轉換
- Z006-O001-06 DBCA 靜默克隆遠端 PDB
- git克隆遠端倉庫的指定分支Git
- 克隆(clone) ORACLE HOMEOracle
- Clone (克隆) ORACLE HOMEOracle
- 【BUILD_ORACLE】使用Oracle資料泵線上不停機克隆/遷移PDBUIOracle
- js中深克隆與淺克隆JS
- 克隆 clone Oracle 軟體Oracle
- vue陣列的深克隆和淺克隆Vue陣列
- JAVA 基礎 – clone淺克隆與深克隆Java
- JAVA 基礎 - clone淺克隆與深克隆Java
- 深入理解Java的淺克隆與深克隆Java
- JS型別判斷、物件克隆、陣列克隆JS型別物件陣列
- js之物件深淺克隆JS物件
- 虛擬機器的克隆虛擬機
- vmware克隆機網路卡配置
- javascript深度克隆JavaScript
- 克隆專案
- js 深度克隆JS
- Rust克隆陷阱?Rust
- 使用TortoiseHg克隆遠端目錄報錯"abort: Access is denied"
- 原生js實現物件的深克隆以及淺克隆JS物件
- 12c 資料泵克隆使用者
- Z004-O001-04 克隆遠端 Non-CDB
- java深克隆(深拷貝)和淺克隆(淺拷貝)Java
- powerVM客戶端系統盤克隆客戶端
- VirtualBox克隆虛擬機器虛擬機
- windows賬號克隆Windows
- 淺談克隆 JavaScriptJavaScript
- js深度克隆物件JS物件