oracle 12c 使用RMAN的傳輸表空間功能在PDB之間遷移資料
oracle 12c 使用RMAN的傳輸表空間功能在PDB之間遷移資料記錄
1.備份PDB資料庫ORA12CPD的USERS表空間,如下:
oracle@lzstix0itest12:~> sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Mon Jun 6 15:17:23 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics,
Oracle Database Vault and Real Application Testing options
SQL> alter session set container=ora12cpd;
Session altered.
SQL> alter tablespace users read only;
Tablespace altered.
oracle@lzstix0itest12:/tmp> rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Mon Jun 6 15:16:51 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA12C (DBID=290586312)
RMAN> backup for transport format '/tmp/tts_readonly.bck' tablespace ORA12CPD:USERS datapump format '/tmp/tts_dump.bck';
Starting backup at 06-JUN-16
using channel ORA_DISK_1
Running TRANSPORT_SET_CHECK on specified tablespaces
TRANSPORT_SET_CHECK completed successfully
Performing export of metadata for specified tablespaces...
EXPDP> Starting "SYS"."TRANSPORT_EXP_ORA12C_ahld":
EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
EXPDP> Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER
EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
EXPDP> Master table "SYS"."TRANSPORT_EXP_ORA12C_ahld" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TRANSPORT_EXP_ORA12C_ahld is:
EXPDP> /u01/app/oracle/product/12.1.0/dbhome_1/dbs/backup_tts_ORA12C_54560.dmp
EXPDP> ******************************************************************************
EXPDP> Datafiles required for transportable tablespace USERS:
EXPDP> /u01/app/oradata/ora12c/ora12cpd/users01.dbf
EXPDP> Job "SYS"."TRANSPORT_EXP_ORA12C_ahld" successfully completed at Mon Jun 6 15:18:24 2016 elapsed 0 00:00:20
Export completed
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00020 name=/u01/app/oradata/ora12c/ora12cpd/users01.dbf
channel ORA_DISK_1: starting piece 1 at 06-JUN-16
channel ORA_DISK_1: finished piece 1 at 06-JUN-16
piece handle=/tmp/tts_readonly.bck tag=TAG20160606T151757 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
input Data Pump dump file=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/backup_tts_ORA12C_54560.dmp
channel ORA_DISK_1: starting piece 1 at 06-JUN-16
channel ORA_DISK_1: finished piece 1 at 06-JUN-16
piece handle=/tmp/tts_dump.bck tag=TAG20160606T151757 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-JUN-16
RMAN> exit
備份完成之後,可以看到/tmp目錄下的兩個檔案,一個是後設資料,一個是透過資料泵匯出的資料檔案。
SQL> !ls -l /tmp/tts*
-rw-r----- 1 oracle oinstall 184320 Jun 6 15:18 /tmp/tts_dump.bck
-rw-r----- 1 oracle oinstall 39510016 Jun 6 15:18 /tmp/tts_readonly.bck
匯入至PDB資料庫ORA12CPC資料庫
oracle@lzstix0itest12:/tmp> rman target sys/oracle@lzstix0itest12:11521/ora12cpc
Recovery Manager: Release 12.1.0.2.0 - Production on Mon Jun 6 15:42:08 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA12C (DBID=290586312)
RMAN> RESTORE FOREIGN TABLESPACE USERS FORMAT '/u01/app/oradata/ora12c/ora12cpc/users01.dbf' FROM BACKUPSET '/tmp/tts_readonly.bck' DUMP FILE DATAPUMP DESTINATION '/u01/app/oradata/ora12c/ora12cpc' FROM BACKUPSET '/tmp/tts_dump.bck';
Starting restore at 06-JUN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=428 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring all files in foreign tablespace USERS
channel ORA_DISK_1: reading from backup piece /tmp/tts_readonly.bck
channel ORA_DISK_1: restoring foreign file 20 to /u01/app/oradata/ora12c/ora12cpc/users01.dbf
channel ORA_DISK_1: foreign piece handle=/tmp/tts_readonly.bck
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring Data Pump dump file to /u01/app/oradata/ora12c/ora12cpc/backup_tts_ORA12C_49028.dmp
channel ORA_DISK_1: reading from backup piece /tmp/tts_dump.bck
channel ORA_DISK_1: foreign piece handle=/tmp/tts_dump.bck
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Performing import of metadata...
IMPDP> Master table "SYS"."TSPITR_IMP_ORA12C_khoD" successfully loaded/unloaded
IMPDP> Starting "SYS"."TSPITR_IMP_ORA12C_khoD":
IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
IMPDP> Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER
IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
IMPDP> Job "SYS"."TSPITR_IMP_ORA12C_khoD" successfully completed at Mon Jun 6 15:42:18 2016 elapsed 0 00:00:01
Import completed
Finished restore at 06-JUN-16
在ORA12CPC資料庫中將表空間USERS去除只讀
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
TEMP ONLINE
SALES ONLINE
USERS READ ONLY
SQL> alter tablespace users read write;
Tablespace altered.
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
TEMP ONLINE
SALES ONLINE
USERS ONLINE
SQL> select count(1) from tt;
COUNT(1)
----------
273171
SQL> insert into tt select * from dba_objects;
91123 rows created.
SQL> commit;
Commit complete.
SQL>
SQL>
SQL> select count(1) from tt;
COUNT(1)
----------
364294
1.備份PDB資料庫ORA12CPD的USERS表空間,如下:
oracle@lzstix0itest12:~> sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Mon Jun 6 15:17:23 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics,
Oracle Database Vault and Real Application Testing options
SQL> alter session set container=ora12cpd;
Session altered.
SQL> alter tablespace users read only;
Tablespace altered.
oracle@lzstix0itest12:/tmp> rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Mon Jun 6 15:16:51 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA12C (DBID=290586312)
RMAN> backup for transport format '/tmp/tts_readonly.bck' tablespace ORA12CPD:USERS datapump format '/tmp/tts_dump.bck';
Starting backup at 06-JUN-16
using channel ORA_DISK_1
Running TRANSPORT_SET_CHECK on specified tablespaces
TRANSPORT_SET_CHECK completed successfully
Performing export of metadata for specified tablespaces...
EXPDP> Starting "SYS"."TRANSPORT_EXP_ORA12C_ahld":
EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
EXPDP> Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER
EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
EXPDP> Master table "SYS"."TRANSPORT_EXP_ORA12C_ahld" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TRANSPORT_EXP_ORA12C_ahld is:
EXPDP> /u01/app/oracle/product/12.1.0/dbhome_1/dbs/backup_tts_ORA12C_54560.dmp
EXPDP> ******************************************************************************
EXPDP> Datafiles required for transportable tablespace USERS:
EXPDP> /u01/app/oradata/ora12c/ora12cpd/users01.dbf
EXPDP> Job "SYS"."TRANSPORT_EXP_ORA12C_ahld" successfully completed at Mon Jun 6 15:18:24 2016 elapsed 0 00:00:20
Export completed
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00020 name=/u01/app/oradata/ora12c/ora12cpd/users01.dbf
channel ORA_DISK_1: starting piece 1 at 06-JUN-16
channel ORA_DISK_1: finished piece 1 at 06-JUN-16
piece handle=/tmp/tts_readonly.bck tag=TAG20160606T151757 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
input Data Pump dump file=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/backup_tts_ORA12C_54560.dmp
channel ORA_DISK_1: starting piece 1 at 06-JUN-16
channel ORA_DISK_1: finished piece 1 at 06-JUN-16
piece handle=/tmp/tts_dump.bck tag=TAG20160606T151757 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-JUN-16
RMAN> exit
備份完成之後,可以看到/tmp目錄下的兩個檔案,一個是後設資料,一個是透過資料泵匯出的資料檔案。
SQL> !ls -l /tmp/tts*
-rw-r----- 1 oracle oinstall 184320 Jun 6 15:18 /tmp/tts_dump.bck
-rw-r----- 1 oracle oinstall 39510016 Jun 6 15:18 /tmp/tts_readonly.bck
匯入至PDB資料庫ORA12CPC資料庫
oracle@lzstix0itest12:/tmp> rman target sys/oracle@lzstix0itest12:11521/ora12cpc
Recovery Manager: Release 12.1.0.2.0 - Production on Mon Jun 6 15:42:08 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA12C (DBID=290586312)
RMAN> RESTORE FOREIGN TABLESPACE USERS FORMAT '/u01/app/oradata/ora12c/ora12cpc/users01.dbf' FROM BACKUPSET '/tmp/tts_readonly.bck' DUMP FILE DATAPUMP DESTINATION '/u01/app/oradata/ora12c/ora12cpc' FROM BACKUPSET '/tmp/tts_dump.bck';
Starting restore at 06-JUN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=428 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring all files in foreign tablespace USERS
channel ORA_DISK_1: reading from backup piece /tmp/tts_readonly.bck
channel ORA_DISK_1: restoring foreign file 20 to /u01/app/oradata/ora12c/ora12cpc/users01.dbf
channel ORA_DISK_1: foreign piece handle=/tmp/tts_readonly.bck
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring Data Pump dump file to /u01/app/oradata/ora12c/ora12cpc/backup_tts_ORA12C_49028.dmp
channel ORA_DISK_1: reading from backup piece /tmp/tts_dump.bck
channel ORA_DISK_1: foreign piece handle=/tmp/tts_dump.bck
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Performing import of metadata...
IMPDP> Master table "SYS"."TSPITR_IMP_ORA12C_khoD" successfully loaded/unloaded
IMPDP> Starting "SYS"."TSPITR_IMP_ORA12C_khoD":
IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
IMPDP> Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER
IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
IMPDP> Job "SYS"."TSPITR_IMP_ORA12C_khoD" successfully completed at Mon Jun 6 15:42:18 2016 elapsed 0 00:00:01
Import completed
Finished restore at 06-JUN-16
在ORA12CPC資料庫中將表空間USERS去除只讀
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
TEMP ONLINE
SALES ONLINE
USERS READ ONLY
SQL> alter tablespace users read write;
Tablespace altered.
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
TEMP ONLINE
SALES ONLINE
USERS ONLINE
SQL> select count(1) from tt;
COUNT(1)
----------
273171
SQL> insert into tt select * from dba_objects;
91123 rows created.
SQL> commit;
Commit complete.
SQL>
SQL>
SQL> select count(1) from tt;
COUNT(1)
----------
364294
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26753337/viewspace-2114932/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【資料遷移】使用傳輸表空間遷移資料
- 【傳輸表空間】使用 EXPDP/IMPDP工具的傳輸表空間完成資料遷移
- 【傳輸表空間】使用 EXPDP/IMPDP工具的傳輸表空間完成資料遷移[轉]
- 海量資料遷移之傳輸表空間(一)
- Oracle 傳輸表空間-RmanOracle
- 基於可傳輸表空間的表空間遷移
- 跨平臺表空間遷移(傳輸表空間)
- RMAN遷移表空間
- 使用Oracle可傳輸表空間的特性複製資料(7)實戰RMAN備份傳輸表空間Oracle
- 使用可傳輸表空間向rac環境遷移資料
- 用傳輸表空間跨平臺遷移資料
- 使用RMAN簡單遷移表空間
- 12c 資料泵傳輸表空間
- 利用可傳輸表空間跨平臺遷移 -RMAN CONVERT
- oracle 異構平臺遷移之傳輸表空間一例Oracle
- Oracle 表空間資料檔案遷移Oracle
- 【資料遷移】XTTS跨平臺傳輸表空間v3(2.RMAN增量)TTS
- 使用RMAN實現可傳輸的表空間
- Oracle 表空間傳輸Oracle
- oracle表空間傳輸Oracle
- Oracle傳輸表空間Oracle
- 【資料遷移】XTTS跨平臺傳輸表空間v4TTS
- [zt]跨平臺表空間傳輸 (DB遷移)
- ORACLE表批量遷移表空間Oracle
- 【資料遷移】XTTS跨平臺傳輸表空間(1.傳統方式)TTS
- RMAN跨平臺傳輸資料庫和表空間資料庫
- 資料庫物件遷移表空間資料庫物件
- Oracle 不同平臺間表空間遷移Oracle
- (個人)Oracle 表空間資料檔案遷移(轉)Oracle
- 基於redhat 6.5 oracle 11.2.0.4測試tts傳輸表空間之資料庫遷移之一RedhatOracleTTS資料庫
- 傳輸表空間操作-OracleOracle
- Oracle傳輸表空間(TTS)OracleTTS
- Oracle10g新特性——利用RMAN遷移表空間Oracle
- mysql之 表空間傳輸MySql
- Oracle中表空間、表、索引的遷移Oracle索引
- 表空間遷移
- 遷移表空間
- Oracle資料庫遷移 - 異構傳輸表空間TTS HP-UX遷移至Redhat Linux 7.7Oracle資料庫TTSRedhatLinux