Oracle 12C RMAN transport tablespace from PDB of RAC CDB to remote PDB
这个例子是将Linux 平台上的RAC CDB数据库中PDB(jypdb)数据库中的tts,cs表空间(tts,cs用户的缺省永久表空间)传输到Linux 平台上的单实例CDB数据库中的PDB(jypdb)中
1.确认源数据库与目标数据库所在平台是不是传输表空间所支持的操作系统平台。
确认源数据库操作系统平台:
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----------------------------------------------------------------------------------------------------- --------------Linux x86 64-bit Little
这里操作系统平台都是64位Linux
2.确认要被传输的表空间是否是自包含表空间(tts,cs):
SQL> exec sys.dbms_tts.transport_set_check('TTS,CS',true);PL/SQL procedure successfully completed.SQL> select * from sys.transport_set_violations;no rows selected
如果没有行选择,表示该表空间只包含表数据,可以传输
SQL> select count(*) from tts.t1; COUNT(*)---------- 45SQL> select count(*) from cs.t2; COUNT(*)---------- 46
3.对源数据库执行备份,在执行备份时一定要加上include current controlfile否在执行
transport tablespace命令时会出现以下错误信息:Automatic instance removedRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of tranport tablespace command at 01/25/2018 15:24:22RMAN-03015: error occurred in stored script Memory ScriptRMAN-06026: some targets not found - aborting restoreRMAN-06024: no backup or copy of the control file found to restore[oracle@jytest1 ~]$ export NLS_DATE_FORMAT='yyyy-mm-dd hh34:mi:ss'[oracle@jytest1 ~]$ rman target sys/abcd@jy catalog rco/abcd@jypdb_173Recovery Manager: Release 12.2.0.1.0 - Production on Thu Jan 25 23:30:46 2018Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.connected to target database: JY (DBID=979425723)connected to recovery catalog database
使用RMAN连接到源RAC CDB数据库执行备份操作
RMAN> backup as compressed backupset database format '+test/rman_backup/jy_%u_%d_%t_%s_%p' include current controlfile plus archivelog format '+test/rman_backup/arch_%d_%T_%U' delete all input;Starting backup at 2018-01-25 23:30:58current log archivedallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=1522 instance=jy2 device type=DISKchannel ORA_DISK_1: starting compressed archived log backup setchannel ORA_DISK_1: specifying archived log(s) in backup setinput archived log thread=2 sequence=141 RECID=320 STAMP=966188816input archived log thread=1 sequence=161 RECID=321 STAMP=966188818input archived log thread=2 sequence=142 RECID=323 STAMP=966188832input archived log thread=1 sequence=162 RECID=322 STAMP=966188829input archived log thread=1 sequence=163 RECID=325 STAMP=966188842input archived log thread=2 sequence=143 RECID=324 STAMP=966188842input archived log thread=2 sequence=144 RECID=327 STAMP=966189268input archived log thread=1 sequence=164 RECID=326 STAMP=966189266input archived log thread=1 sequence=165 RECID=328 STAMP=966189274input archived log thread=2 sequence=145 RECID=329 STAMP=966189274input archived log thread=1 sequence=166 RECID=330 STAMP=966192976input archived log thread=2 sequence=146 RECID=331 STAMP=966192977input archived log thread=1 sequence=167 RECID=333 STAMP=966193374input archived log thread=2 sequence=147 RECID=332 STAMP=966193373input archived log thread=2 sequence=148 RECID=334 STAMP=966193380input archived log thread=1 sequence=168 RECID=335 STAMP=966193380input archived log thread=1 sequence=169 RECID=336 STAMP=966207796input archived log thread=2 sequence=149 RECID=338 STAMP=966208644input archived log thread=1 sequence=170 RECID=337 STAMP=966208634input archived log thread=1 sequence=171 RECID=339 STAMP=966208856input archived log thread=2 sequence=150 RECID=340 STAMP=966208857input archived log thread=1 sequence=172 RECID=341 STAMP=966209350input archived log thread=2 sequence=151 RECID=342 STAMP=966209350input archived log thread=1 sequence=173 RECID=344 STAMP=966209356input archived log thread=2 sequence=152 RECID=343 STAMP=966209356input archived log thread=2 sequence=153 RECID=346 STAMP=966246980input archived log thread=1 sequence=174 RECID=345 STAMP=966246243input archived log thread=1 sequence=175 RECID=347 STAMP=966271688input archived log thread=2 sequence=154 RECID=349 STAMP=966282445input archived log thread=1 sequence=176 RECID=348 STAMP=966282440input archived log thread=1 sequence=177 RECID=351 STAMP=966282933input archived log thread=2 sequence=155 RECID=350 STAMP=966282933input archived log thread=2 sequence=156 RECID=354 STAMP=966296899input archived log thread=1 sequence=178 RECID=352 STAMP=966296887input archived log thread=1 sequence=179 RECID=353 STAMP=966296890input archived log thread=2 sequence=157 RECID=355 STAMP=966331920input archived log thread=1 sequence=180 RECID=356 STAMP=966340837input archived log thread=2 sequence=158 RECID=359 STAMP=966382267input archived log thread=1 sequence=181 RECID=357 STAMP=966382003input archived log thread=1 sequence=182 RECID=358 STAMP=966382267channel ORA_DISK_1: starting piece 1 at 2018-01-25 23:31:12channel ORA_DISK_1: finished piece 1 at 2018-01-25 23:33:17piece handle=+TEST/rman_backup/arch_jy_20180125_7ispjklv_1_1 tag=TAG20180125T233110 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:02:05channel ORA_DISK_1: deleting archived log(s)archived log file name=+TEST/arch/2_141_961976319.dbf RECID=320 STAMP=966188816archived log file name=+TEST/arch/1_161_961976319.dbf RECID=321 STAMP=966188818archived log file name=+TEST/arch/2_142_961976319.dbf RECID=323 STAMP=966188832archived log file name=+TEST/arch/1_162_961976319.dbf RECID=322 STAMP=966188829archived log file name=+TEST/arch/1_163_961976319.dbf RECID=325 STAMP=966188842archived log file name=+TEST/arch/2_143_961976319.dbf RECID=324 STAMP=966188842archived log file name=+TEST/arch/2_144_961976319.dbf RECID=327 STAMP=966189268archived log file name=+TEST/arch/1_164_961976319.dbf RECID=326 STAMP=966189266archived log file name=+TEST/arch/1_165_961976319.dbf RECID=328 STAMP=966189274archived log file name=+TEST/arch/2_145_961976319.dbf RECID=329 STAMP=966189274archived log file name=+TEST/arch/1_166_961976319.dbf RECID=330 STAMP=966192976archived log file name=+TEST/arch/2_146_961976319.dbf RECID=331 STAMP=966192977archived log file name=+TEST/arch/1_167_961976319.dbf RECID=333 STAMP=966193374archived log file name=+TEST/arch/2_147_961976319.dbf RECID=332 STAMP=966193373archived log file name=+TEST/arch/2_148_961976319.dbf RECID=334 STAMP=966193380archived log file name=+TEST/arch/1_168_961976319.dbf RECID=335 STAMP=966193380archived log file name=+TEST/arch/1_169_961976319.dbf RECID=336 STAMP=966207796archived log file name=+TEST/arch/2_149_961976319.dbf RECID=338 STAMP=966208644archived log file name=+TEST/arch/1_170_961976319.dbf RECID=337 STAMP=966208634archived log file name=+TEST/arch/1_171_961976319.dbf RECID=339 STAMP=966208856archived log file name=+TEST/arch/2_150_961976319.dbf RECID=340 STAMP=966208857archived log file name=+TEST/arch/1_172_961976319.dbf RECID=341 STAMP=966209350archived log file name=+TEST/arch/2_151_961976319.dbf RECID=342 STAMP=966209350archived log file name=+TEST/arch/1_173_961976319.dbf RECID=344 STAMP=966209356archived log file name=+TEST/arch/2_152_961976319.dbf RECID=343 STAMP=966209356archived log file name=+TEST/arch/2_153_961976319.dbf RECID=346 STAMP=966246980archived log file name=+TEST/arch/1_174_961976319.dbf RECID=345 STAMP=966246243archived log file name=+TEST/arch/1_175_961976319.dbf RECID=347 STAMP=966271688archived log file name=+TEST/arch/2_154_961976319.dbf RECID=349 STAMP=966282445archived log file name=+TEST/arch/1_176_961976319.dbf RECID=348 STAMP=966282440archived log file name=+TEST/arch/1_177_961976319.dbf RECID=351 STAMP=966282933archived log file name=+TEST/arch/2_155_961976319.dbf RECID=350 STAMP=966282933archived log file name=+TEST/arch/2_156_961976319.dbf RECID=354 STAMP=966296899archived log file name=+TEST/arch/1_178_961976319.dbf RECID=352 STAMP=966296887archived log file name=+TEST/arch/1_179_961976319.dbf RECID=353 STAMP=966296890archived log file name=+TEST/arch/2_157_961976319.dbf RECID=355 STAMP=966331920archived log file name=+TEST/arch/1_180_961976319.dbf RECID=356 STAMP=966340837archived log file name=+TEST/arch/2_158_961976319.dbf RECID=359 STAMP=966382267archived log file name=+TEST/arch/1_181_961976319.dbf RECID=357 STAMP=966382003archived log file name=+TEST/arch/1_182_961976319.dbf RECID=358 STAMP=966382267Finished backup at 2018-01-25 23:33:25Starting backup at 2018-01-25 23:33:25using channel ORA_DISK_1channel ORA_DISK_1: starting compressed full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00003 name=+DATA/JY/DATAFILE/sysaux.298.962209605input datafile file number=00009 name=+DATA/JY/DATAFILE/undotbs2.312.962209605input datafile file number=00004 name=+DATA/JY/DATAFILE/undotbs1.277.962209605input datafile file number=00001 name=+DATA/JY/DATAFILE/system.317.962209603input datafile file number=00007 name=+DATA/JY/DATAFILE/users.301.962209605channel ORA_DISK_1: starting piece 1 at 2018-01-25 23:33:28channel ORA_DISK_1: finished piece 1 at 2018-01-25 23:35:43piece handle=+TEST/rman_backup/jy_7jspjkq7_jy_966382407_243_1 tag=TAG20180125T233325 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:02:15channel ORA_DISK_1: starting compressed full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00014 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649input datafile file number=00011 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649input datafile file number=00013 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649input datafile file number=00010 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649input datafile file number=00012 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649input datafile file number=00015 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609input datafile file number=00022 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353input datafile file number=00023 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783channel ORA_DISK_1: starting piece 1 at 2018-01-25 23:35:43channel ORA_DISK_1: finished piece 1 at 2018-01-25 23:36:48piece handle=+TEST/rman_backup/jy_7kspjkuf_jy_966382543_244_1 tag=TAG20180125T233325 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:01:05channel ORA_DISK_1: starting compressed full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00017 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409input datafile file number=00016 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409input datafile file number=00018 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409input datafile file number=00019 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409input datafile file number=00021 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409input datafile file number=00020 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409channel ORA_DISK_1: starting piece 1 at 2018-01-25 23:36:49channel ORA_DISK_1: finished piece 1 at 2018-01-25 23:37:44piece handle=+TEST/rman_backup/jy_7lspjl0h_jy_966382609_245_1 tag=TAG20180125T233325 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:55channel ORA_DISK_1: starting compressed full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00006 name=+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675input datafile file number=00005 name=+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675input datafile file number=00008 name=+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675channel ORA_DISK_1: starting piece 1 at 2018-01-25 23:37:44channel ORA_DISK_1: finished piece 1 at 2018-01-25 23:38:29piece handle=+TEST/rman_backup/jy_7mspjl28_jy_966382664_246_1 tag=TAG20180125T233325 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:45channel ORA_DISK_1: starting compressed full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setchannel ORA_DISK_1: starting piece 1 at 2018-01-25 23:38:33channel ORA_DISK_1: finished piece 1 at 2018-01-25 23:38:34piece handle=+TEST/rman_backup/jy_7nspjl3l_jy_966382709_247_1 tag=TAG20180125T233325 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 2018-01-25 23:38:34Starting backup at 2018-01-25 23:38:34current log archivedusing channel ORA_DISK_1channel ORA_DISK_1: starting compressed archived log backup setchannel ORA_DISK_1: specifying archived log(s) in backup setinput archived log thread=2 sequence=159 RECID=361 STAMP=966382716input archived log thread=1 sequence=183 RECID=360 STAMP=966382716channel ORA_DISK_1: starting piece 1 at 2018-01-25 23:38:39channel ORA_DISK_1: finished piece 1 at 2018-01-25 23:38:40piece handle=+TEST/rman_backup/arch_jy_20180125_7ospjl3u_1_1 tag=TAG20180125T233838 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01channel ORA_DISK_1: deleting archived log(s)archived log file name=+TEST/arch/2_159_961976319.dbf RECID=361 STAMP=966382716archived log file name=+TEST/arch/1_183_961976319.dbf RECID=360 STAMP=966382716Finished backup at 2018-01-25 23:38:41Starting Control File and SPFILE Autobackup at 2018-01-25 23:38:42piece handle=+TEST/rman_backup/c-979425723-20180125-01 comment=NONEFinished Control File and SPFILE Autobackup at 2018-01-25 23:38:50RMAN> list backup;List of Backup Sets===================BS Key Size Device Type Elapsed Time Completion Time------- ---------- ----------- ------------ -------------------7004 696.52M DISK 00:01:56 2018-01-25 23:33:07 BP Key: 7005 Status: AVAILABLE Compressed: YES Tag: TAG20180125T233110 Piece Name: +TEST/rman_backup/arch_jy_20180125_7ispjklv_1_1 List of Archived Logs in backup set 7004 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 1 161 15489267 2018-01-23 03:00:12 15615014 2018-01-23 12:00:12 1 162 15615014 2018-01-23 12:00:12 15660438 2018-01-23 17:46:58 1 163 15660438 2018-01-23 17:46:58 15660585 2018-01-23 17:47:21 1 164 15660585 2018-01-23 17:47:21 15661249 2018-01-23 17:54:26 1 165 15661249 2018-01-23 17:54:26 15661286 2018-01-23 17:54:34 1 166 15661286 2018-01-23 17:54:34 15668074 2018-01-23 18:56:16 1 167 15668074 2018-01-23 18:56:16 15669730 2018-01-23 19:02:53 1 168 15669730 2018-01-23 19:02:53 15669749 2018-01-23 19:02:59 1 169 15669749 2018-01-23 19:02:59 15725290 2018-01-23 23:03:04 1 170 15725290 2018-01-23 23:03:04 15748445 2018-01-23 23:17:11 1 171 15748445 2018-01-23 23:17:11 15749326 2018-01-23 23:20:56 1 172 15749326 2018-01-23 23:20:56 15754717 2018-01-23 23:29:08 1 173 15754717 2018-01-23 23:29:08 15754744 2018-01-23 23:29:16 1 174 15754744 2018-01-23 23:29:16 15913424 2018-01-24 09:43:49 1 175 15913424 2018-01-24 09:43:49 15970367 2018-01-24 16:47:52 1 176 15970367 2018-01-24 16:47:52 15998139 2018-01-24 19:47:17 1 177 15998139 2018-01-24 19:47:17 15999227 2018-01-24 19:55:33 1 178 15999227 2018-01-24 19:55:33 16159305 2018-01-24 23:48:02 1 179 16159305 2018-01-24 23:48:02 16159307 2018-01-24 23:48:02 1 180 16160440 2018-01-24 23:54:33 16282809 2018-01-25 12:00:25 1 181 16282809 2018-01-25 12:00:25 16387407 2018-01-25 23:26:30 1 182 16387407 2018-01-25 23:26:30 16389194 2018-01-25 23:31:04 2 141 15416434 2018-01-22 23:13:31 15539078 2018-01-23 07:00:05 2 142 15539078 2018-01-23 07:00:05 15660442 2018-01-23 17:47:00 2 143 15660442 2018-01-23 17:47:00 15660582 2018-01-23 17:47:21 2 144 15660582 2018-01-23 17:47:21 15661253 2018-01-23 17:54:28 2 145 15661253 2018-01-23 17:54:28 15661290 2018-01-23 17:54:34 2 146 15661290 2018-01-23 17:54:34 15668077 2018-01-23 18:56:16 2 147 15668077 2018-01-23 18:56:16 15669727 2018-01-23 19:02:53 2 148 15669727 2018-01-23 19:02:53 15669752 2018-01-23 19:02:59 2 149 15669752 2018-01-23 19:02:59 15748449 2018-01-23 23:17:13 2 150 15748449 2018-01-23 23:17:13 15749330 2018-01-23 23:20:56 2 151 15749330 2018-01-23 23:20:56 15754721 2018-01-23 23:29:09 2 152 15754721 2018-01-23 23:29:09 15754741 2018-01-23 23:29:15 2 153 15754741 2018-01-23 23:29:15 15915073 2018-01-24 09:56:08 2 154 15915073 2018-01-24 09:56:08 15998143 2018-01-24 19:47:20 2 155 15998143 2018-01-24 19:47:20 15999223 2018-01-24 19:55:33 2 156 15999223 2018-01-24 19:55:33 16159321 2018-01-24 23:48:04 2 157 16159321 2018-01-24 23:48:04 16262173 2018-01-25 09:31:46 2 158 16262173 2018-01-25 09:31:46 16389189 2018-01-25 23:31:00BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------7055 Full 596.08M DISK 00:02:06 2018-01-25 23:35:33 BP Key: 7100 Status: AVAILABLE Compressed: YES Tag: TAG20180125T233325 Piece Name: +TEST/rman_backup/jy_7jspjkq7_jy_966382407_243_1 List of Datafiles in backup set 7055 File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- ------------------- ----------- ------ ---- 1 Full 16390299 2018-01-25 23:33:28 NO +DATA/JY/DATAFILE/system.317.962209603 3 Full 16390299 2018-01-25 23:33:28 NO +DATA/JY/DATAFILE/sysaux.298.962209605 4 Full 16390299 2018-01-25 23:33:28 NO +DATA/JY/DATAFILE/undotbs1.277.962209605 7 Full 16390299 2018-01-25 23:33:28 NO +DATA/JY/DATAFILE/users.301.962209605 9 Full 16390299 2018-01-25 23:33:28 NO +DATA/JY/DATAFILE/undotbs2.312.962209605BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------7056 Full 207.16M DISK 00:00:55 2018-01-25 23:36:38 BP Key: 7101 Status: AVAILABLE Compressed: YES Tag: TAG20180125T233325 Piece Name: +TEST/rman_backup/jy_7kspjkuf_jy_966382543_244_1 List of Datafiles in backup set 7056 Container ID: 3, PDB Name: JYPDB File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- ------------------- ----------- ------ ---- 10 Full 16390754 2018-01-25 23:35:43 NO +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649 11 Full 16390754 2018-01-25 23:35:43 NO +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649 12 Full 16390754 2018-01-25 23:35:43 NO +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649 13 Full 16390754 2018-01-25 23:35:43 NO +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649 14 Full 16390754 2018-01-25 23:35:43 NO +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649 15 Full 16390754 2018-01-25 23:35:43 NO +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609 22 Full 16390754 2018-01-25 23:35:43 NO +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353 23 Full 16390754 2018-01-25 23:35:43 NO +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------7057 Full 252.70M DISK 00:00:53 2018-01-25 23:37:42 BP Key: 7102 Status: AVAILABLE Compressed: YES Tag: TAG20180125T233325 Piece Name: +TEST/rman_backup/jy_7lspjl0h_jy_966382609_245_1 List of Datafiles in backup set 7057 Container ID: 4, PDB Name: TESTPDB File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- ------------------- ----------- ------ ---- 16 Full 16159351 2018-01-24 23:48:08 NO +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409 17 Full 16159351 2018-01-24 23:48:08 NO +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409 18 Full 16159351 2018-01-24 23:48:08 NO +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409 19 Full 16159351 2018-01-24 23:48:08 NO +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409 20 Full 16159351 2018-01-24 23:48:08 NO +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409 21 Full 16159351 2018-01-24 23:48:08 NO +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------7058 Full 166.49M DISK 00:00:36 2018-01-25 23:38:20 BP Key: 7103 Status: AVAILABLE Compressed: YES Tag: TAG20180125T233325 Piece Name: +TEST/rman_backup/jy_7mspjl28_jy_966382664_246_1 List of Datafiles in backup set 7058 Container ID: 2, PDB Name: PDB$SEED File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- ------------------- ----------- ------ ---- 5 Full 1449535 2017-12-05 23:46:58 NO +DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675 6 Full 1449535 2017-12-05 23:46:58 NO +DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675 8 Full 1449535 2017-12-05 23:46:58 NO +DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------7059 Full 4.09M DISK 00:00:04 2018-01-25 23:38:33 BP Key: 7104 Status: AVAILABLE Compressed: YES Tag: TAG20180125T233325 Piece Name: +TEST/rman_backup/jy_7nspjl3l_jy_966382709_247_1 Control File Included: Ckp SCN: 16392014 Ckp time: 2018-01-25 23:38:29BS Key Size Device Type Elapsed Time Completion Time------- ---------- ----------- ------------ -------------------7134 5.64M DISK 00:00:01 2018-01-25 23:38:39 BP Key: 7136 Status: AVAILABLE Compressed: YES Tag: TAG20180125T233838 Piece Name: +TEST/rman_backup/arch_jy_20180125_7ospjl3u_1_1 List of Archived Logs in backup set 7134 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 1 183 16389194 2018-01-25 23:31:04 16392023 2018-01-25 23:38:35 2 159 16389189 2018-01-25 23:31:00 16392045 2018-01-25 23:38:36BS Key Type LV Size Device Type Elapsed Time Completion Time------- ---- -- ---------- ----------- ------------ -------------------7145 Full 19.06M DISK 00:00:04 2018-01-25 23:38:47 BP Key: 7148 Status: AVAILABLE Compressed: NO Tag: TAG20180125T233843 Piece Name: +TEST/rman_backup/c-979425723-20180125-01 SPFILE Included: Modification time: 2018-01-25 22:01:06 SPFILE db_unique_name: JY Control File Included: Ckp SCN: 16392079 Ckp time: 2018-01-25 23:38:43
4.创建一个数据库目录对象用来执行Data Pump导出(/ora_backup/tts/dump),一个辅助目录(/ora_backup/tts/auxi),一个传输表空间目录(/ora_backup/tts/tbs)
[oracle@jytest1 tts]$ mkdir dump[oracle@jytest1 tts]$ mkdir tbs[oracle@jytest1 tts]$ mkdir auxiSQL> conn sys/abcd@jy as sysdbaConnected.SQL> create or replace directory test_dump as '/ora_backup/tts/dump';Directory created.SQL>SQL> grant read,write on directory test_dump to public;Grant succeeded.
5.使用RMAN连接到源RAC CDB数据库执行传输表空间操作
[oracle@jytest1 ~]$ export NLS_DATE_FORMAT='yyyy-mm-dd hh34:mi:ss'[oracle@jytest1 ~]$ rman target sys/abcd@jy catalog rco/abcd@jypdb_173Recovery Manager: Release 12.2.0.1.0 - Production on Fri Jan 26 00:32:53 2018Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.connected to target database: JY (DBID=979425723)connected to recovery catalog databaseRMAN> transport tablespace JYPDB:"TTS",JYPDB:"CS" tablespace destination '/ora_backup/tts/tbs' auxiliary destination '/ora_backup/tts/auxi' datapump directory test_dump dump file 'tts.dmp' import script 'importtts.sql' export log 'ttsexport.log';Creating automatic instance, with SID='jBqz'initialization parameters used for automatic instance:db_name=JYdb_unique_name=jBqz_pitr_JYPDB_JYcompatible=12.2.0db_block_size=8192db_files=200diagnostic_dest=/u01/app/oracle_system_trig_enabled=FALSEsga_target=2048Mprocesses=200db_create_file_dest=/ora_backup/tts/auxilog_archive_dest_1='location=/ora_backup/tts/auxi'enable_pluggable_database=true_clone_one_pdb_recovery=true#No auxiliary parameter file usedstarting up automatic instance JYOracle instance startedTotal System Global Area 2147483648 bytesFixed Size 8794848 bytesVariable Size 553651488 bytesDatabase Buffers 1577058304 bytesRedo Buffers 7979008 bytesAutomatic instance createdRunning TRANSPORT_SET_CHECK on recovery set tablespacesTRANSPORT_SET_CHECK completed successfullycontents of Memory Script:{# set requested point in timeset until scn 16412368;# restore the controlfilerestore clone controlfile;# mount the controlfilesql clone 'alter database mount clone database';# archive current online logsql 'alter system archive log current';# resync catalogresync catalog;}executing Memory Scriptexecuting command: SET until clauseStarting restore at 2018-01-26 00:34:32allocated channel: ORA_AUX_DISK_1channel ORA_AUX_DISK_1: SID=211 device type=DISKchannel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: restoring control filechannel ORA_AUX_DISK_1: reading from backup piece +TEST/rman_backup/c-979425723-20180125-01channel ORA_AUX_DISK_1: piece handle=+TEST/rman_backup/c-979425723-20180125-01 tag=TAG20180125T233843channel ORA_AUX_DISK_1: restored backup piece 1channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:38output file name=/ora_backup/tts/auxi/JY/controlfile/o1_mf_f6n1rxq2_.ctlFinished restore at 2018-01-26 00:35:11sql statement: alter database mount clone databasesql statement: alter system archive log currentstarting full resync of recovery catalogfull resync completecontents of Memory Script:{# set requested point in timeset until scn 16412368;# set destinations for recovery set and auxiliary set datafilesset newname for clone datafile 10 to new;set newname for clone datafile 1 to new;set newname for clone datafile 12 to new;set newname for clone datafile 4 to new;set newname for clone datafile 13 to new;set newname for clone datafile 9 to new;set newname for clone datafile 3 to new;set newname for clone datafile 11 to new;set newname for clone tempfile 1 to new;set newname for clone tempfile 3 to new;set newname for datafile 22 to "/ora_backup/tts/tbs/o1_mf_tts_%u_.dbf";set newname for datafile 23 to "/ora_backup/tts/tbs/o1_mf_cs_%u_.dbf";# switch all tempfilesswitch clone tempfile all;# restore the tablespaces in the recovery set and the auxiliary setrestore clone datafile 10, 1, 12, 4, 13, 9, 3, 11, 22, 23;switch clone datafile all;}executing Memory Scriptexecuting command: SET until clauseexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMErenamed tempfile 1 to /ora_backup/tts/auxi/JY/datafile/o1_mf_temp_%u_.tmp in control filerenamed tempfile 3 to /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_temp_%u_.tmp in control fileStarting restore at 2018-01-26 00:35:28using channel ORA_AUX_DISK_1channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00001 to /ora_backup/tts/auxi/JY/datafile/o1_mf_system_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00004 to /ora_backup/tts/auxi/JY/datafile/o1_mf_undotbs1_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00009 to /ora_backup/tts/auxi/JY/datafile/o1_mf_undotbs2_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00003 to /ora_backup/tts/auxi/JY/datafile/o1_mf_sysaux_%u_.dbfchannel ORA_AUX_DISK_1: reading from backup piece +TEST/rman_backup/jy_7jspjkq7_jy_966382407_243_1channel ORA_AUX_DISK_1: piece handle=+TEST/rman_backup/jy_7jspjkq7_jy_966382407_243_1 tag=TAG20180125T233325channel ORA_AUX_DISK_1: restored backup piece 1channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:15channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00010 to /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_system_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00012 to /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undotbs1_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00013 to /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undo_2_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00011 to /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_sysaux_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00022 to /ora_backup/tts/tbs/o1_mf_tts_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00023 to /ora_backup/tts/tbs/o1_mf_cs_%u_.dbfchannel ORA_AUX_DISK_1: reading from backup piece +TEST/rman_backup/jy_7kspjkuf_jy_966382543_244_1channel ORA_AUX_DISK_1: piece handle=+TEST/rman_backup/jy_7kspjkuf_jy_966382543_244_1 tag=TAG20180125T233325channel ORA_AUX_DISK_1: restored backup piece 1channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15Finished restore at 2018-01-26 00:39:58datafile 10 switched to datafile copyinput datafile copy RECID=14 STAMP=966386398 file name=/ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_system_f6n20mok_.dbfdatafile 1 switched to datafile copyinput datafile copy RECID=15 STAMP=966386399 file name=/ora_backup/tts/auxi/JY/datafile/o1_mf_system_f6n1tjl2_.dbfdatafile 12 switched to datafile copyinput datafile copy RECID=16 STAMP=966386399 file name=/ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undotbs1_f6n20mpv_.dbfdatafile 4 switched to datafile copyinput datafile copy RECID=17 STAMP=966386399 file name=/ora_backup/tts/auxi/JY/datafile/o1_mf_undotbs1_f6n1tjjq_.dbfdatafile 13 switched to datafile copyinput datafile copy RECID=18 STAMP=966386399 file name=/ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undo_2_f6n20mn5_.dbfdatafile 9 switched to datafile copyinput datafile copy RECID=19 STAMP=966386400 file name=/ora_backup/tts/auxi/JY/datafile/o1_mf_undotbs2_f6n1tjhj_.dbfdatafile 3 switched to datafile copyinput datafile copy RECID=20 STAMP=966386400 file name=/ora_backup/tts/auxi/JY/datafile/o1_mf_sysaux_f6n1tjfj_.dbfdatafile 11 switched to datafile copyinput datafile copy RECID=21 STAMP=966386400 file name=/ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_sysaux_f6n20mlb_.dbfdatafile 22 switched to datafile copyinput datafile copy RECID=22 STAMP=966386400 file name=/ora_backup/tts/tbs/o1_mf_tts_f6n20mr5_.dbfdatafile 23 switched to datafile copyinput datafile copy RECID=23 STAMP=966386401 file name=/ora_backup/tts/tbs/o1_mf_cs_f6n20mso_.dbfcontents of Memory Script:{# set requested point in timeset until scn 16412368;# online the datafiles restored or switchedsql clone 'JYPDB' "alter database datafile 10 online";sql clone "alter database datafile 1 online";sql clone 'JYPDB' "alter database datafile 12 online";sql clone "alter database datafile 4 online";sql clone 'JYPDB' "alter database datafile 13 online";sql clone "alter database datafile 9 online";sql clone "alter database datafile 3 online";sql clone 'JYPDB' "alter database datafile 11 online";sql clone 'JYPDB' "alter database datafile 22 online";sql clone 'JYPDB' "alter database datafile 23 online";# recover and open resetlogsrecover clone database tablespace "JYPDB":"TTS", "JYPDB":"CS", "JYPDB":"SYSTEM", "SYSTEM", "JYPDB":"UNDOTBS1", "UNDOTBS1", "JYPDB":"UNDO_2", "UNDOTBS2", "SYSAUX", "JYPDB":"SYSAUX" delete archivelog;alter clone database open resetlogs;}executing Memory Scriptexecuting command: SET until clausesql statement: alter database datafile 10 onlinesql statement: alter database datafile 1 onlinesql statement: alter database datafile 12 onlinesql statement: alter database datafile 4 onlinesql statement: alter database datafile 13 onlinesql statement: alter database datafile 9 onlinesql statement: alter database datafile 3 onlinesql statement: alter database datafile 11 onlinesql statement: alter database datafile 22 onlinesql statement: alter database datafile 23 onlineStarting recover at 2018-01-26 00:40:04using channel ORA_AUX_DISK_1starting media recoveryarchived log for thread 1 with sequence 184 is already on disk as file +TEST/arch/1_184_961976319.dbfarchived log for thread 2 with sequence 160 is already on disk as file +TEST/arch/2_160_961976319.dbfchannel ORA_AUX_DISK_1: starting archived log restore to default destinationchannel ORA_AUX_DISK_1: restoring archived logarchived log thread=2 sequence=159channel ORA_AUX_DISK_1: restoring archived logarchived log thread=1 sequence=183channel ORA_AUX_DISK_1: reading from backup piece +TEST/rman_backup/arch_jy_20180125_7ospjl3u_1_1channel ORA_AUX_DISK_1: piece handle=+TEST/rman_backup/arch_jy_20180125_7ospjl3u_1_1 tag=TAG20180125T233838channel ORA_AUX_DISK_1: restored backup piece 1channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01archived log file name=/ora_backup/tts/auxi/2_159_961976319.dbf thread=2 sequence=159archived log file name=/ora_backup/tts/auxi/1_183_961976319.dbf thread=1 sequence=183channel clone_default: deleting archived log(s)archived log file name=/ora_backup/tts/auxi/1_183_961976319.dbf RECID=363 STAMP=966386408archived log file name=+TEST/arch/1_184_961976319.dbf thread=1 sequence=184channel clone_default: deleting archived log(s)archived log file name=/ora_backup/tts/auxi/2_159_961976319.dbf RECID=362 STAMP=966386408archived log file name=+TEST/arch/2_160_961976319.dbf thread=2 sequence=160media recovery complete, elapsed time: 00:01:36Finished recover at 2018-01-26 00:41:44database openedcontents of Memory Script:{sql clone 'alter pluggable database JYPDB open';}executing Memory Scriptsql statement: alter pluggable database JYPDB opencontents of Memory Script:{# make read only the tablespace that will be exportedsql clone 'JYPDB' 'alter tablespace "TTS" read only';sql clone 'JYPDB' 'alter tablespace "CS" read only';}executing Memory Scriptsql statement: alter tablespace "TTS" read onlysql statement: alter tablespace "CS" read onlyPerforming export of metadata... EXPDP> Starting "SYS"."TSPITR_EXP_jBqz_ufoz": EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS EXPDP> Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX EXPDP> ORA-39127: unexpected error from call to export_string :=SYS.DBMS_TRANSFORM_EXIMP.INSTANCE_INFO_EXP('AQ$_ORDERS_QUEUETABLE_S','IX',1,1,'12.02.00.00.00',newblock)ORA-00376: file 14 cannot be read at this timeORA-01110: data file 14: '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649'ORA-06512: at "SYS.DBMS_TRANSFORM_EXIMP", line 197ORA-06512: at line 1ORA-06512: at "SYS.DBMS_TRANSFORM_EXIMP", line 197ORA-06512: at line 1ORA-06512: at "SYS.DBMS_METADATA", line 10846ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95ORA-39127: unexpected error from call to export_string :=SYS.DBMS_TRANSFORM_EXIMP.INSTANCE_INFO_EXP('AQ$_STREAMS_QUEUE_TABLE_S','IX',1,1,'12.02.00.00.00',newblock)ORA-00376: file 14 cannot be read at this timeORA-01110: data file 14: '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649'ORA-06512: at "SYS.DBMS_TRANSFORM_EXIMP", line 197ORA-06512: at line 1ORA-06512: at "SYS.DBMS_TRANSFORM_EXIMP", line 197ORA-06512: at line 1ORA-06512: at "SYS.DBMS_METADATA", line 10846ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95 EXPDP> Master table "SYS"."TSPITR_EXP_jBqz_ufoz" successfully loaded/unloaded EXPDP> ****************************************************************************** EXPDP> Dump file set for SYS.TSPITR_EXP_jBqz_ufoz is: EXPDP> /ora_backup/tts/dump/tts.dmp EXPDP> ****************************************************************************** EXPDP> Datafiles required for transportable tablespace CS: EXPDP> /ora_backup/tts/tbs/o1_mf_cs_f6n20mso_.dbf EXPDP> Datafiles required for transportable tablespace TTS: EXPDP> /ora_backup/tts/tbs/o1_mf_tts_f6n20mr5_.dbf EXPDP> Job "SYS"."TSPITR_EXP_jBqz_ufoz" completed with 2 error(s) at Fri Jan 26 00:45:41 2018 elapsed 0 00:02:14Export completedNot performing table import after point-in-time recovery/* The following command may be used to import the tablespaces. Substitute values for and . impdp directory= dumpfile= 'tts.dmp' transport_datafiles= /ora_backup/tts/tbs/o1_mf_tts_f6n20mr5_.dbf, /ora_backup/tts/tbs/o1_mf_cs_f6n20mso_.dbf*/--------CREATE DIRECTORY STREAMS$DIROBJ$1 AS '/ora_backup/tts/tbs/';/* PL/SQL Script to import the exported tablespaces */DECLARE-- tbs_files dbms_streams_tablespace_adm.file_set; cvt_files dbms_streams_tablespace_adm.file_set;-- dump_file dbms_streams_tablespace_adm.file; dp_job_name VARCHAR2(30) := NULL;-- ts_names dbms_streams_tablespace_adm.tablespace_set;BEGIN-- dump_file.file_name := 'tts.dmp'; dump_file.directory_object := 'test_dump';-- tbs_files( 1).file_name := 'o1_mf_tts_f6n20mr5_.dbf'; tbs_files( 1).directory_object := 'STREAMS$DIROBJ$1'; tbs_files( 2).file_name := 'o1_mf_cs_f6n20mso_.dbf'; tbs_files( 2).directory_object := 'STREAMS$DIROBJ$1';-- dbms_streams_tablespace_adm.attach_tablespaces( datapump_job_name => dp_job_name, dump_file => dump_file, tablespace_files => tbs_files, converted_files => cvt_files, tablespace_names => ts_names);-- IF ts_names IS NOT NULL AND ts_names.first IS NOT NULL THEN FOR i IN ts_names.first .. ts_names.last LOOP dbms_output.put_line('imported tablespace '|| ts_names(i)); END LOOP; END IF;END;/--DROP DIRECTORY STREAMS$DIROBJ$1;---------------------------------------------------------------- End of sample PL/SQL script--------------------------------------------------------------Removing automatic instanceshutting down automatic instanceOracle instance shut downAutomatic instance removedauxiliary instance file /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_temp_f6n28lj8_.tmp deletedauxiliary instance file /ora_backup/tts/auxi/JY/datafile/o1_mf_temp_f6n28clb_.tmp deletedauxiliary instance file /ora_backup/tts/auxi/JY/onlinelog/o1_mf_4_f6n2699f_.log deletedauxiliary instance file /ora_backup/tts/auxi/JY/onlinelog/o1_mf_3_f6n2698j_.log deletedauxiliary instance file /ora_backup/tts/auxi/JY/onlinelog/o1_mf_2_f6n2697p_.log deletedauxiliary instance file /ora_backup/tts/auxi/JY/onlinelog/o1_mf_1_f6n26971_.log deletedauxiliary instance file /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_sysaux_f6n20mlb_.dbf deletedauxiliary instance file /ora_backup/tts/auxi/JY/datafile/o1_mf_sysaux_f6n1tjfj_.dbf deletedauxiliary instance file /ora_backup/tts/auxi/JY/datafile/o1_mf_undotbs2_f6n1tjhj_.dbf deletedauxiliary instance file /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undo_2_f6n20mn5_.dbf deletedauxiliary instance file /ora_backup/tts/auxi/JY/datafile/o1_mf_undotbs1_f6n1tjjq_.dbf deletedauxiliary instance file /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undotbs1_f6n20mpv_.dbf deletedauxiliary instance file /ora_backup/tts/auxi/JY/datafile/o1_mf_system_f6n1tjl2_.dbf deletedauxiliary instance file /ora_backup/tts/auxi/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_system_f6n20mok_.dbf deletedauxiliary instance file /ora_backup/tts/auxi/JY/controlfile/o1_mf_f6n1rxq2_.ctl deleted
上面的传输表空间操作完成后生成了传输表空间的数据文件/ora_backup/tts/tbs/o1_mf_tts_f6n20mr5_.dbf,/ora_backup/tts/tbs/o1_mf_cs_f6n20mso_.dbf和Data Pump导出文件dmpfile/ora_backup/tts/dump/tts.dmp,由于我将目标主机的/ora_backup/tts/目录通过nfs挂载成源主机上的/ora_backup/tts/目录,所以这里不需要将这些文件复制就可以在目标主机上访问这些文件。
5.在目标主机上创建相关用户及Data Pump目录(这个目录应该在PDB数据库(jypdb)中创建)并将表空间附加到目标数据库中
SQL> alter session set container=jypdb;Session altered.SQL> create or replace directory test_dump as '/ora_backup/tts/dump';Directory created.SQL> grant read,write on directory test_dump to public;Grant succeeded.SQL> create user tts identified by "tts";User created.SQL> grant dba,connect,resource to tts;Grant succeeded.SQL> create user cs identified by "cs";User created.SQL> grant dba,connect,resource to cs;Grant succeeded.
使用system用户连接到PDB数据库(jypdb)执行下面的导入操作
[oracle@shard1 admin]$ impdp system/abcd@jypdb directory=test_dump dumpfile= 'tts.dmp' transport_datafiles= /ora_backup/tts/tbs/o1_mf_tts_f6n20mr5_.dbf, /ora_backup/tts/tbs/o1_mf_cs_f6n20mso_.dbfImport: Release 12.2.0.1.0 - Production on Thu Jan 25 19:03:34 2018Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionMaster table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloadedStarting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/********@jypdb directory=test_dump dumpfile=tts.dmp transport_datafiles=/ora_backup/tts/tbs/o1_mf_tts_f6n20mr5_.dbf, /ora_backup/tts/tbs/o1_mf_cs_f6n20mso_.dbfProcessing object type TRANSPORTABLE_EXPORT/PLUGTS_BLKProcessing object type TRANSPORTABLE_EXPORT/TABLEProcessing object type TRANSPORTABLE_EXPORT/INDEX/INDEXProcessing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICSProcessing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICSProcessing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKERProcessing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLKJob "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at Thu Jan 25 19:04:06 2018 elapsed 0 00:00:29
6.检查数据来验证传输表空间是否成功
SQL> select count(*) from tts.t1; COUNT(*)---------- 45SQL> select count(*) from cs.t2; COUNT(*)---------- 46
与表空间传输之前的状态一致,最后还需要导入用户tts,cs下的其它元数据这里不再详细介绍具体的操作了。