Oracle 12C RMAN Cross-Platform Transport of PDBs
為了將整個PDB傳輸到不同的平臺,源平臺與目標平臺必須使用相同的位元組序。compatible引數在源CDB資料庫與目標CDB資料庫中必須設定為12.1或更高版本。
下面的例子將Linux平臺上的RAC CDB中的PDB資料庫(jypdb與testpdb)傳輸到windows平臺上的單例項CDB資料庫中。 執行跨平臺傳輸的操作如下:
1.檢查源資料庫與目標資料庫的compatible引數是否設定為12.0.0或更高版本
源資料庫
SQL> show parameter compatible NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ compatible string 12.2.0 noncdb_compatible boolean FALSE
目標資料庫
SQL> show parameter compatible NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ compatible string 12.2.0 noncdb_compatible boolean FALSE
2.檢查源平臺與目標平臺的位元組序
源平臺
SQL> select d.platform_name,endian_format from v$transportable_platform tp,v$database d where tp.platform_name=d.platform_name; PLATFORM_NAME ENDIAN_FORMAT ----------------------------------------------------------------------------------------------------- -------------- Linux x86 64-bit Little
目標平臺
SQL> select d.platform_name,endian_format from v$transportable_platform tp,v$database d where tp.platform_name=d.platform_name; PLATFORM_NAME ENDIAN_FORMAT -------------------------------------------------------------------------------- -------------- Microsoft Windows x86 64-bit Little
3.將要被傳輸的pdb(jypdb,testpdb)設定為只讀狀態
SQL> alter pluggable database all close immediate; Pluggable database altered. SQL> set long 200 SQL> set linesize 200 SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE -------------------------------------------------------------------------------------------------------------------------------- ---------- PDB$SEED READ ONLY JYPDB MOUNTED TESTPDB MOUNTED
4.備份要傳輸的PDB資料庫,可以使用以下一種方法來跨平臺傳輸PDB
4.1使用RMAN連線到CDB的root容器,並使用backup for transport ... pluggable database或者backup to platform ... pluggable database命令來為PDB建立跨平臺備份。
4.2使用RMAN連線到PDB,並使用backup for transport或backup to platform命令來為PDB建立跨平臺備份。
因為我這裡要傳輸兩個PDB所以選擇第一種方法
RMAN> backup for transport unplug into '/ora_backup/tpdbs/metadata_jypdb.xml' pluggable database jypdb format '/ora_backup/tpdbs/pdb_%U'; Starting backup at 11-FEB-18 using channel ORA_DISK_1 running UNPLUG on the specified pluggable database: JYPDB UNPLUG file path : /ora_backup/tpdbs/metadata_jypdb.xml channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00014 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649 input datafile file number=00011 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649 input datafile file number=00012 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649 input datafile file number=00013 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649 input datafile file number=00010 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649 input datafile file number=00015 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609 input datafile file number=00022 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353 input datafile file number=00023 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783 channel ORA_DISK_1: starting piece 1 at 11-FEB-18 channel ORA_DISK_1: finished piece 1 at 11-FEB-18 piece handle=/ora_backup/tpdbs/pdb_8csqvqc5_1_1 tag=TAG20180211T173748 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56 Finished backup at 11-FEB-18 starting full resync of recovery catalog full resync complete RMAN> backup for transport unplug into '/ora_backup/tpdbs/metadata_testpdb.xml' pluggable database testpdb format '/ora_backup/tpdbs/pdb_%U'; Starting backup at 11-FEB-18 starting full resync of recovery catalog full resync complete using channel ORA_DISK_1 running UNPLUG on the specified pluggable database: TESTPDB UNPLUG file path : /ora_backup/tpdbs/metadata_testpdb.xml channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00017 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409 input datafile file number=00018 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409 input datafile file number=00016 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409 input datafile file number=00019 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409 input datafile file number=00021 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409 input datafile file number=00020 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409 channel ORA_DISK_1: starting piece 1 at 11-FEB-18 channel ORA_DISK_1: finished piece 1 at 11-FEB-18 piece handle=/ora_backup/tpdbs/pdb_8dsqvqpj_1_1 tag=TAG20180211T174458 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35 Finished backup at 11-FEB-18 starting full resync of recovery catalog full resync complete [oracle@jytest1 tpdbs]$ ls -lrt total 1707488 -rw-r--r-- 1 oracle asmadmin 11413 Feb 11 11:38 metadata_jypdb.xml -rw-r----- 1 oracle asmadmin 1038368768 Feb 11 11:39 pdb_8csqvqc5_1_1 -rw-r--r-- 1 oracle asmadmin 9569 Feb 11 11:45 metadata_testpdb.xml -rw-r----- 1 oracle asmadmin 710066176 Feb 11 11:45 pdb_8dsqvqpj_1_1
5.將在源平臺上使用rman backup命令生成的備份集與備份的控制檔案傳輸到目標平臺的D:\app\oracle\oradata\pdbs目錄中
6.將PDB(jypdb,testpdb)還原到目標資料庫
RMAN> restore from platform 'Linux x86 64-bit' foreign pluggable database jypdb to new from backupset 'D:\app\oracle\oradata\pdbs\pdb_8csqvqc5_1_1'; 從位於 11-2月 -18 的 restore 開始 使用目標資料庫控制檔案替代恢復目錄 分配的通道: ORA_DISK_1 通道 ORA_DISK_1: SID=1522 裝置型別=DISK 通道 ORA_DISK_1: 正在開始還原資料檔案備份集 通道 ORA_DISK_1: 正在指定從備份集還原的資料檔案 通道 ORA_DISK_1: 正在還原備份片段中的所有外部檔案 通道 ORA_DISK_1: 正在讀取備份片段 D:\app\oracle\oradata\pdbs\pdb_8csqvqc5_1_1 通道 ORA_DISK_1: 將外部檔案 14 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F805GPMS_.DBF 通道 ORA_DISK_1: 將外部檔案 11 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F805GPMS_.DBF 通道 ORA_DISK_1: 將外部檔案 12 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F805GPMS_.DBF 通道 ORA_DISK_1: 將外部檔案 13 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F805GPMS_.DBF 通道 ORA_DISK_1: 將外部檔案 10 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F805GPN8_.DBF 通道 ORA_DISK_1: 將外部檔案 15 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F805GPN8_.DBF 通道 ORA_DISK_1: 將外部檔案 22 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TTS_F805GPN8_.DBF 通道 ORA_DISK_1: 將外部檔案 23 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_CS_F805GPN8_.DBF 通道 ORA_DISK_1: 外部片段控制程式碼 = D:\app\oracle\oradata\pdbs\pdb_8csqvqc5_1_1 通道 ORA_DISK_1: 已還原備份片段 1 通道 ORA_DISK_1: 還原完成, 用時: 00:00:36 在 11-2月 -18 完成了 restore RMAN> restore from platform 'Linux x86 64-bit' foreign pluggable database testpdb to new from backupset 'D:\app\oracle\oradata\pdbs\pdb_8dsqvqpj_1_1'; 從位於 11-2月 -18 的 restore 開始 使用目標資料庫控制檔案替代恢復目錄 分配的通道: ORA_DISK_1 通道 ORA_DISK_1: SID=1522 裝置型別=DISK 通道 ORA_DISK_1: 正在開始還原資料檔案備份集 通道 ORA_DISK_1: 正在指定從備份集還原的資料檔案 通道 ORA_DISK_1: 正在還原備份片段中的所有外部檔案 通道 ORA_DISK_1: 正在讀取備份片段 D:\app\oracle\oradata\pdbs\pdb_8dsqvqpj_1_1 通道 ORA_DISK_1: 將外部檔案 17 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F806C6WT_.DBF 通道 ORA_DISK_1: 將外部檔案 18 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F806C6WT_.DBF 通道 ORA_DISK_1: 將外部檔案 16 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F806C6WT_.DBF 通道 ORA_DISK_1: 將外部檔案 19 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F806C6XB_.DBF 通道 ORA_DISK_1: 將外部檔案 21 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F806C6XB_.DBF 通道 ORA_DISK_1: 將外部檔案 20 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F806C6XB_.DBF 通道 ORA_DISK_1: 外部片段控制程式碼 = D:\app\oracle\oradata\pdbs\pdb_8dsqvqpj_1_1 通道 ORA_DISK_1: 已還原備份片段 1 通道 ORA_DISK_1: 還原完成, 用時: 00:00:26 在 11-2月 -18 完成了 restore
7.在目標主機上修改metadata_jypdb.xml與metadata_testpdb.xml檔案將資料檔案路徑修改為還原後資料檔案所在路徑
8.將傳輸過來的PDB(jypdb,testpdb)插入CDB
SQL> create pluggable database jypdb using 'D:\app\oracle\oradata\pdbs\metadata_jypdb.xml' nocopy; 插接式資料庫已建立。 SQL> create pluggable database testpdb using 'D:\app\oracle\oradata\pdbs\metadata_testpdb.xml' nocopy ; 插接式資料庫已建立。 SQL> set long 200 SQL> set linesize 200 SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE -------------------------------------------------------------------------------------------------------------------------------- ---------- PDB$SEED READ ONLY JYPDB MOUNTED TESTPDB MOUNTED SQL> alter pluggable database all open; 插接式資料庫已變更。 SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE -------------------------------------------------------------------------------------------------------------------------------- ---------- PDB$SEED READ ONLY JYPDB READ WRITE TESTPDB READ WRITE
9.查詢tts.t1與cs.t2表中的資料來驗證跨平臺傳輸PDB是否操作成功
SQL> select count(*) from tts.t1; COUNT(*) ---------- 90 SQL> select count(*) from cs.t2; COUNT(*) ---------- 92
到此,跨平臺傳輸PDB就完成了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2151522/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 12c RMAN Cross-Platform Transport of a Closed PDBOracleROSPlatform
- Oracle 12c RMAN Performing Cross-Platform Transport of a PDB Using InconsistentOracleROSPlatform
- Oracle 12C RMAN transport tablespace from PDB of RAC CDB to remote PDBOracleREM
- Oracle 12c CDB&PDBs管理Oracle
- Oracle 12c 建立與刪除CDB、PDBsOracle
- oracle實驗記錄 (transport tablespace(Rman))Oracle
- Oracle 12c 檢視CDB&PDBs資訊(SQL*PLUS)OracleSQL
- Oracle 12c啟動時PDBs的自動開啟Oracle
- oracle實驗記錄 (oracle 10G rman transport database)OracleDatabase
- Oracle 12C Transport a Database to a Different Platform Using Backup SetsOracleDatabasePlatform
- Oracle 12c RMAN全攻略Oracle
- ORACLE 12C RMAN 功能增強Oracle
- oracle 12c rman備份pdbOracle
- Oracle 12c系列(八)|RMAN (FROM SERVICE)Oracle
- Oracle 12c RMAN Duplicating the Whole CDBOracle
- Oracle 12c RMAN 異機恢復Oracle
- oracle 12C rman下表的恢復Oracle
- Oracle 12c: Recover tables using RMANOracle
- 【RMAN】Oracle11g透過rman升級到12cOracle
- Oracle 12C新特性-RMAN恢復表Oracle
- Oracle 12C RMAN Duplicating Tablespaces Within a PDBOracle
- Oracle 12C RMAN Duplicating the PDB to remote CDBOracleREM
- Oracle 12c RMAN Duplicating a Subset of the Source Database TablespacesOracleDatabase
- oracle10g_rman_syntax testing_upgrade catalog_transport tablespaceOracle
- 使用rman在不同平臺之間傳送oracle asm表空間(transport tablespace)OracleASM
- 10.2R2 rman transport tablespace特性測試!
- Oracle 12c 使用RMAN搭建物理備庫(RAC to RAC)Oracle
- Oracle 12C RMAN Duplicating the Whole RAC CDB to local RAC CDBOracle
- Oracle DG管理Redo Transport服務Oracle
- Oracle Database 12C 新功能 rman RECOVER TABLE (文件 ID 2047644.1)OracleDatabase
- 測試rman transport tablespace命令時遇著的小問題~~
- Oracle 12C RMAN備份佔用大量臨時表空間Oracle
- oracle10g ASM transport_tablespaceOracleASM
- 【新炬網路名師大講堂】12c新特性:備份CDBs和PDBs
- Cross-Platform DB Migration (same endian) using RMAN Transportable DB-1401921.1ROSPlatform
- 通過RMAN-transport獲取傳輸表空間檔案
- oracle 12c新特性:Rman表恢復之直接匯入系統Oracle
- [20130803]ORACLE 12C RMAN 功能增強.txtOracle