千家信息网

Oracle 12C使用RMAN将PDB中分表的多个分区恢复到新用户方案中

发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,Oracle 12C使用RMAN将PDB中分表的多个分区恢复到新用户方案中的操作如下1.对整个CDB(jy)生成RMAN备份[oracle@jytest1 ~]$ rman target/ catal
千家信息网最后更新 2025年02月02日Oracle 12C使用RMAN将PDB中分表的多个分区恢复到新用户方案中

Oracle 12C使用RMAN将PDB中分表的多个分区恢复到新用户方案中的操作如下
1.对整个CDB(jy)生成RMAN备份

[oracle@jytest1 ~]$ rman target/ catalog rco/abcd@jypdb_173Recovery Manager: Release 12.2.0.1.0 - Production on Thu Jan 11 00:43:42 2018Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.connected to target database: JY (DBID=979425723)connected to recovery catalog databaseRMAN> backup as compressed backupset database format '+test/rman_backup/%d_%I_%U_%t' plus archivelog format '+test/rman_backup/arc_%d_%T_%U';Starting backup at 2018-01-11 00:43:49current log archivedallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=393 instance=jy1 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=70 RECID=184 STAMP=965090640input archived log thread=1 sequence=95 RECID=183 STAMP=965090635channel ORA_DISK_1: starting piece 1 at 2018-01-11 00:44:03channel ORA_DISK_1: finished piece 1 at 2018-01-11 00:44:18piece handle=+TEST/rman_backup/arc_jy_20180111_18soc7aj_1_1 tag=TAG20180111T004402 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:15Finished backup at 2018-01-11 00:44:18Starting backup at 2018-01-11 00:44:18using 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=00001 name=+DATA/JY/DATAFILE/system.317.962209603input datafile file number=00004 name=+DATA/JY/DATAFILE/undotbs1.277.962209605input datafile file number=00009 name=+DATA/JY/DATAFILE/undotbs2.312.962209605input datafile file number=00007 name=+DATA/JY/DATAFILE/users.301.962209605channel ORA_DISK_1: starting piece 1 at 2018-01-11 00:44:20channel ORA_DISK_1: finished piece 1 at 2018-01-11 00:46:05piece handle=+TEST/rman_backup/jy_979425723_19soc7b4_1_1_965090660 tag=TAG20180111T004418 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:01:45channel 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=00010 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649input datafile file number=00012 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649input datafile file number=00013 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649input datafile file number=00015 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609channel ORA_DISK_1: starting piece 1 at 2018-01-11 00:46:06channel ORA_DISK_1: finished piece 1 at 2018-01-11 00:47:01piece handle=+TEST/rman_backup/jy_979425723_1asoc7ee_1_1_965090766 tag=TAG20180111T004418 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=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-11 00:47:01channel ORA_DISK_1: finished piece 1 at 2018-01-11 00:47:46piece handle=+TEST/rman_backup/jy_979425723_1bsoc7g5_1_1_965090821 tag=TAG20180111T004418 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 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-11 00:47:47channel ORA_DISK_1: finished piece 1 at 2018-01-11 00:48:32piece handle=+TEST/rman_backup/jy_979425723_1csoc7hj_1_1_965090867 tag=TAG20180111T004418 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:45Finished backup at 2018-01-11 00:48:32Starting backup at 2018-01-11 00:48:32current 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=1 sequence=96 RECID=185 STAMP=965090913input archived log thread=2 sequence=71 RECID=186 STAMP=965090913channel ORA_DISK_1: starting piece 1 at 2018-01-11 00:48:37channel ORA_DISK_1: finished piece 1 at 2018-01-11 00:48:38piece handle=+TEST/rman_backup/arc_jy_20180111_1dsoc7j5_1_1 tag=TAG20180111T004835 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 2018-01-11 00:48:38Starting Control File and SPFILE Autobackup at 2018-01-11 00:48:38piece handle=+TEST/rman_backup/c-979425723-20180111-00 comment=NONEFinished Control File and SPFILE Autobackup at 2018-01-11 00:48:46

2.在删除表sh.sales的SALES_Q3_1998与SALES_Q4_1998分区中的数据之前记录当前时间,在执行恢复时它们被用来指定恢复时间点

SQL>  alter session set nls_date_format='yyyy-mm-dd hh34:mi:ss';Session altered.SQL> select count(*) from sales partition(SALES_Q3_1998);  COUNT(*)----------     50515SQL> select count(*) from sales partition(SALES_Q4_1998);  COUNT(*)----------     48874SQL> select sysdate from dual;SYSDATE-------------------2018-01-11 01:03:47SQL> select current_scn   from v$database;CURRENT_SCN-----------    8629695SQL> delete from sales partition(SALES_Q3_1998);50515 rows deleted.SQL> delete from sales partition(SALES_Q4_1998);48874 rows deleted.SQL> commit;Commit complete.SQL> select count(*) from sales partition(SALES_Q3_1998);  COUNT(*)----------         0SQL> select count(*) from sales partition(SALES_Q4_1998);  COUNT(*)----------         0

3.启动RMAN并使用有sysbacup或sysdba权限的用户连接到目标数据库

[oracle@jytest1 ~]$ export NLS_DATE_FORMAT='yyyy-mm-dd hh34:mi:ss'[oracle@jytest1 ~]$ rman target/ catalog rco/abcd@jypdb_173Recovery Manager: Release 12.2.0.1.0 - Production on Wed Jan 10 02:22:13 2018Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.connected to target database: ORCL (DBID=1492772871)

4.通过使用recover table命令将要被恢复的表或表分区恢复到指定的时间点。 使用auxiliary destination子句(/run/recover辅助数据文件存储目录)与until scn来指定恢复时间点,并且在recover命令中使用子句dump file与datapump destination,指定包含被恢复表或表分区的导出dump文件的文件名(t_emp_recvr.dmp)与存储位置(/run/dump)。 使用remap table子句将分区SH.SALES:SALES_Q3_1998恢复成表JY.SALES_Q3_1998,分区 SH.SALES:SALES_Q4_1998恢复成表JY.SALES_Q4_1998使用remap tablespace子句将sh用户方案中的表分区从表空间users恢复到表空间test中

RMAN> run2> {3> recover table SH.SALES:SALES_Q3_1998, SH.SALES:SALES_Q4_1998 of pluggable database jypdb4> until time '2018-01-11 01:03:47'5> auxiliary destination '/run/recover'6> datapump destination '/run/dump'7> dump file 't_emp_recvr.dmp'8> remap table SH.SALES:SALES_Q3_1998:JY.SALES_Q3_1998,SH.SALES:SALES_Q4_1998:JY.SALES_Q4_19989> remap tablespace 'USERS':'TEST';10> }Starting recover at 2018-01-11 01:46:51using channel ORA_DISK_1Creating automatic instance, with SID='lCEx'initialization parameters used for automatic instance:db_name=JYdb_unique_name=lCEx_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=/run/recoverlog_archive_dest_1='location=/run/recover'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 createdcontents of Memory Script:{# set requested point in timeset until  time "2018-01-11 01:03:47";# 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-11 01:47:37allocated 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-20180111-00channel ORA_AUX_DISK_1: piece handle=+TEST/rman_backup/c-979425723-20180111-00 tag=TAG20180111T004839channel ORA_AUX_DISK_1: restored backup piece 1channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:05output file name=/run/recover/JY/controlfile/o1_mf_f5dnfy2z_.ctlFinished restore at 2018-01-11 01:47:43sql 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  time "2018-01-11 01:03:47";# 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;# 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;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 NEWNAMErenamed tempfile 1 to /run/recover/JY/datafile/o1_mf_temp_%u_.tmp in control filerenamed tempfile 3 to /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_temp_%u_.tmp in control fileStarting restore at 2018-01-11 01:47:55using 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 /run/recover/JY/datafile/o1_mf_system_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00004 to /run/recover/JY/datafile/o1_mf_undotbs1_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00009 to /run/recover/JY/datafile/o1_mf_undotbs2_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00003 to /run/recover/JY/datafile/o1_mf_sysaux_%u_.dbfchannel ORA_AUX_DISK_1: reading from backup piece +TEST/rman_backup/jy_979425723_19soc7b4_1_1_965090660channel ORA_AUX_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_19soc7b4_1_1_965090660 tag=TAG20180111T004418channel ORA_AUX_DISK_1: restored backup piece 1channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:55channel 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 /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_system_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00012 to /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undotbs1_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00013 to /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undo_2_%u_.dbfchannel ORA_AUX_DISK_1: restoring datafile 00011 to /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_sysaux_%u_.dbfchannel ORA_AUX_DISK_1: reading from backup piece +TEST/rman_backup/jy_979425723_1asoc7ee_1_1_965090766channel ORA_AUX_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_1asoc7ee_1_1_965090766 tag=TAG20180111T004418channel ORA_AUX_DISK_1: restored backup piece 1channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45Finished restore at 2018-01-11 01:50:35datafile 10 switched to datafile copyinput datafile copy RECID=12 STAMP=965094635 file name=/run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_system_f5dnkync_.dbfdatafile 1 switched to datafile copyinput datafile copy RECID=13 STAMP=965094635 file name=/run/recover/JY/datafile/o1_mf_system_f5dngcjj_.dbfdatafile 12 switched to datafile copyinput datafile copy RECID=14 STAMP=965094635 file name=/run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undotbs1_f5dnkynd_.dbfdatafile 4 switched to datafile copyinput datafile copy RECID=15 STAMP=965094635 file name=/run/recover/JY/datafile/o1_mf_undotbs1_f5dngcjk_.dbfdatafile 13 switched to datafile copyinput datafile copy RECID=16 STAMP=965094635 file name=/run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undo_2_f5dnkynd_.dbfdatafile 9 switched to datafile copyinput datafile copy RECID=17 STAMP=965094635 file name=/run/recover/JY/datafile/o1_mf_undotbs2_f5dngcjl_.dbfdatafile 3 switched to datafile copyinput datafile copy RECID=18 STAMP=965094635 file name=/run/recover/JY/datafile/o1_mf_sysaux_f5dngcjh_.dbfdatafile 11 switched to datafile copyinput datafile copy RECID=19 STAMP=965094635 file name=/run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_sysaux_f5dnkynb_.dbfcontents of Memory Script:{# set requested point in timeset until  time "2018-01-11 01:03:47";# 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";# recover and open database read onlyrecover clone database tablespace  "JYPDB":"SYSTEM", "SYSTEM", "JYPDB":"UNDOTBS1", "UNDOTBS1", "JYPDB":"UNDO_2", "UNDOTBS2", "SYSAUX", "JYPDB":"SYSAUX";sql clone 'alter database open read only';}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 onlineStarting recover at 2018-01-11 01:50:36using channel ORA_AUX_DISK_1starting media recoveryarchived log for thread 1 with sequence 96 is already on disk as file +TEST/arch/1_96_961976319.dbfarchived log for thread 1 with sequence 97 is already on disk as file +TEST/arch/1_97_961976319.dbfarchived log for thread 2 with sequence 71 is already on disk as file +TEST/arch/2_71_961976319.dbfarchived log for thread 2 with sequence 72 is already on disk as file +TEST/arch/2_72_961976319.dbfarchived log file name=+TEST/arch/1_96_961976319.dbf thread=1 sequence=96archived log file name=+TEST/arch/2_71_961976319.dbf thread=2 sequence=71archived log file name=+TEST/arch/1_97_961976319.dbf thread=1 sequence=97archived log file name=+TEST/arch/2_72_961976319.dbf thread=2 sequence=72media recovery complete, elapsed time: 00:00:01Finished recover at 2018-01-11 01:50:39sql statement: alter database open read onlycontents of Memory Script:{sql clone 'alter pluggable database  JYPDB open read only';}executing Memory Scriptsql statement: alter pluggable database  JYPDB open read onlycontents of Memory Script:{   sql clone "create spfile from memory";   shutdown clone immediate;   startup clone nomount;   sql clone "alter system set  control_files =  ''/run/recover/JY/controlfile/o1_mf_f5dnfy2z_.ctl'' comment= ''RMAN set'' scope=spfile";   shutdown clone immediate;   startup clone nomount;# mount databasesql clone 'alter database mount clone database';}executing Memory Scriptsql statement: create spfile from memorydatabase closeddatabase dismountedOracle instance shut downconnected to auxiliary database (not started)Oracle instance startedTotal System Global Area    2147483648 bytesFixed Size                     8794848 bytesVariable Size                553651488 bytesDatabase Buffers            1577058304 bytesRedo Buffers                   7979008 bytessql statement: alter system set  control_files =   ''/run/recover/JY/controlfile/o1_mf_f5dnfy2z_.ctl'' comment= ''RMAN set'' scope=spfileOracle instance shut downconnected to auxiliary database (not started)Oracle instance startedTotal System Global Area    2147483648 bytesFixed Size                     8794848 bytesVariable Size                553651488 bytesDatabase Buffers            1577058304 bytesRedo Buffers                   7979008 bytessql statement: alter database mount clone databasecontents of Memory Script:{# set requested point in timeset until  time "2018-01-11 01:03:47";# set destinations for recovery set and auxiliary set datafilesset newname for datafile  14 to new;# restore the tablespaces in the recovery set and the auxiliary setrestore clone datafile  14;switch clone datafile all;}executing Memory Scriptexecuting command: SET until clauseexecuting command: SET NEWNAMEStarting restore at 2018-01-11 01:51:49allocated 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: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00014 to /run/recover/LCEX_PITR_JYPDB_JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_users_%u_.dbfchannel ORA_AUX_DISK_1: reading from backup piece +TEST/rman_backup/jy_979425723_1asoc7ee_1_1_965090766channel ORA_AUX_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_1asoc7ee_1_1_965090766 tag=TAG20180111T004418channel ORA_AUX_DISK_1: restored backup piece 1channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:49Finished restore at 2018-01-11 01:52:39datafile 14 switched to datafile copyinput datafile copy RECID=21 STAMP=965094759 file name=/run/recover/LCEX_PITR_JYPDB_JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_users_f5dnot2n_.dbfcontents of Memory Script:{# set requested point in timeset until  time "2018-01-11 01:03:47";# online the datafiles restored or switchedsql clone 'JYPDB' "alter database datafile 14 online";# recover and open resetlogsrecover clone database tablespace  "JYPDB":"USERS", "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  14 onlineStarting recover at 2018-01-11 01:52:39using channel ORA_AUX_DISK_1starting media recoveryarchived log for thread 1 with sequence 96 is already on disk as file +TEST/arch/1_96_961976319.dbfarchived log for thread 1 with sequence 97 is already on disk as file +TEST/arch/1_97_961976319.dbfarchived log for thread 2 with sequence 71 is already on disk as file +TEST/arch/2_71_961976319.dbfarchived log for thread 2 with sequence 72 is already on disk as file +TEST/arch/2_72_961976319.dbfarchived log file name=+TEST/arch/1_96_961976319.dbf thread=1 sequence=96archived log file name=+TEST/arch/2_71_961976319.dbf thread=2 sequence=71archived log file name=+TEST/arch/1_97_961976319.dbf thread=1 sequence=97archived log file name=+TEST/arch/2_72_961976319.dbf thread=2 sequence=72media recovery complete, elapsed time: 00:00:01Finished recover at 2018-01-11 01:52:42database openedcontents of Memory Script:{sql clone 'alter pluggable database  JYPDB open';}executing Memory Scriptsql statement: alter pluggable database  JYPDB opencontents of Memory Script:{# create directory for datapump importsql 'JYPDB' "create or replace directoryTSPITR_DIROBJ_DPDIR as ''/run/dump''";# create directory for datapump exportsql clone 'JYPDB' "create or replace directoryTSPITR_DIROBJ_DPDIR as ''/run/dump''";}executing Memory Scriptsql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/run/dump''sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/run/dump''Performing export of tables...   EXPDP> Starting "SYS"."TSPITR_EXP_lCEx_rDzp":   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE   EXPDP> Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT   EXPDP> Processing object type TABLE_EXPORT/TABLE/COMMENT   EXPDP> . . exported "SH"."SALES":"SALES_Q3_1998"                1.634 MB   50515 rows   EXPDP> . . exported "SH"."SALES":"SALES_Q4_1998"                1.581 MB   48874 rows   EXPDP> Master table "SYS"."TSPITR_EXP_lCEx_rDzp" successfully loaded/unloaded   EXPDP> ******************************************************************************   EXPDP> Dump file set for SYS.TSPITR_EXP_lCEx_rDzp is:   EXPDP>   /run/dump/t_emp_recvr.dmp   EXPDP> Job "SYS"."TSPITR_EXP_lCEx_rDzp" successfully completed at Thu Jan 11 01:53:35 2018 elapsed 0 00:00:41Export completedcontents of Memory Script:{# shutdown clone before importshutdown clone abort}executing Memory ScriptOracle instance shut downPerforming import of tables...   IMPDP> Master table "SYS"."TSPITR_IMP_lCEx_pFDE" successfully loaded/unloaded   IMPDP> Starting "SYS"."TSPITR_IMP_lCEx_pFDE":   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA   IMPDP> . . imported "JY"."SALES_Q3_1998"                        1.634 MB   50515 rows   IMPDP> . . imported "JY"."SALES_Q4_1998"                        1.581 MB   48874 rows   IMPDP> Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT   IMPDP> ORA-39083: Object type OBJECT_GRANT failed to create with error:ORA-00942: table or view does not existFailing sql is:GRANT SELECT ON "JY"."SALES" TO "BI"   IMPDP> Processing object type TABLE_EXPORT/TABLE/COMMENT   IMPDP> ORA-39083: Object type COMMENT failed to create with error:ORA-00942: table or view does not existFailing sql is: COMMENT ON TABLE "JY"."SALES"  IS 'facts table, without a primary key; all rows are uniquely identified by the combination of all foreign keys'ORA-39083: Object type COMMENT:"PROD_ID" failed to create with error:ORA-00942: table or view does not existFailing sql is: COMMENT ON COLUMN "JY"."SALES"."PROD_ID" IS 'FK to the products dimension table'ORA-39083: Object type COMMENT:"CUST_ID" failed to create with error:ORA-00942: table or view does not existFailing sql is: COMMENT ON COLUMN "JY"."SALES"."CUST_ID" IS 'FK to the customers dimension table'ORA-39083: Object type COMMENT:"TIME_ID" failed to create with error:ORA-00942: table or view does not existFailing sql is: COMMENT ON COLUMN "JY"."SALES"."TIME_ID" IS 'FK to the times dimension table'ORA-39083: Object type COMMENT:"CHANNEL_ID" failed to create with error:ORA-00942: table or view does not existFailing sql is: COMMENT ON COLUMN "JY"."SALES"."CHANNEL_ID" IS 'FK to the channels dimension table'ORA-39083: Object type COMMENT:"PROMO_ID" failed to create with error:ORA-00942: table or view does not existFailing sql is: COMMENT ON COLUMN "JY"."SALES"."PROMO_ID" IS 'promotion identifier, without FK constraint (intentionally) to show outer join optimization'ORA-39083: Object type COMMENT:"QUANTITY_SOLD" failed to create with error:ORA-00942: table or view does not existFailing sql is: COMMENT ON COLUMN "JY"."SALES"."QUANTITY_SOLD" IS 'product quantity sold with the transaction'ORA-39083: Object type COMMENT:"AMOUNT_SOLD" failed to create with error:ORA-00942: table or view does not existFailing sql is: COMMENT ON COLUMN "JY"."SALES"."AMOUNT_SOLD" IS 'invoiced amount to the customer'   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER   IMPDP> Job "SYS"."TSPITR_IMP_lCEx_pFDE" completed with 9 error(s) at Thu Jan 11 01:55:38 2018 elapsed 0 00:01:38import completed with errors; Oracle Data Pump dump file t_emp_recvr.dmp is retainedRemoving automatic instanceAutomatic instance removedauxiliary instance file /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_temp_f5dnmkjx_.tmp deletedauxiliary instance file /run/recover/JY/datafile/o1_mf_temp_f5dnmj7f_.tmp deletedauxiliary instance file /run/recover/LCEX_PITR_JYPDB_JY/onlinelog/o1_mf_4_f5dnqbjt_.log deletedauxiliary instance file /run/recover/LCEX_PITR_JYPDB_JY/onlinelog/o1_mf_3_f5dnqbhs_.log deletedauxiliary instance file /run/recover/LCEX_PITR_JYPDB_JY/onlinelog/o1_mf_2_f5dnqbh8_.log deletedauxiliary instance file /run/recover/LCEX_PITR_JYPDB_JY/onlinelog/o1_mf_1_f5dnqbgj_.log deletedauxiliary instance file /run/recover/LCEX_PITR_JYPDB_JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_users_f5dnot2n_.dbf deletedauxiliary instance file /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_sysaux_f5dnkynb_.dbf deletedauxiliary instance file /run/recover/JY/datafile/o1_mf_sysaux_f5dngcjh_.dbf deletedauxiliary instance file /run/recover/JY/datafile/o1_mf_undotbs2_f5dngcjl_.dbf deletedauxiliary instance file /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undo_2_f5dnkynd_.dbf deletedauxiliary instance file /run/recover/JY/datafile/o1_mf_undotbs1_f5dngcjk_.dbf deletedauxiliary instance file /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_undotbs1_f5dnkynd_.dbf deletedauxiliary instance file /run/recover/JY/datafile/o1_mf_system_f5dngcjj_.dbf deletedauxiliary instance file /run/recover/JY/5F9AC6865E87549FE053AB828A0ADE94/datafile/o1_mf_system_f5dnkync_.dbf deletedauxiliary instance file /run/recover/JY/controlfile/o1_mf_f5dnfy2z_.ctl deletedFinished recover at 2018-01-11 01:55:46starting full resync of recovery catalogfull resync complete
5.验证是否分区SH.SALES:SALES_Q3_1998被恢复成表JY.SALES_Q3_1998,分区SH.SALES:SALES_Q4_1998被恢复成表JY.SALES_Q4_1998,从查询记录可以看到已经成功恢复
SQL> select count(*) from JY.SALES_Q3_1998;  COUNT(*)----------     50515SQL> select count(*) from JY.SALES_Q4_1998;  COUNT(*)----------     48874
0