oracle 12c R1 新特性對單個表的恢復

paulyibinyi發表於2015-11-10

下面是一個例子
% rman target sys/oracle@t12ccdb log recover_table5.log
RMAN> RECOVER TABLE SMEDS."RECTEST" OF PLUGGABLE DATABASE T12CPDB1
          UNTIL SEQUENCE 64 thread 1
          AUXILIARY DESTINATION '/testcases/SR3-6629539201/rectbl'
          REMAP TABLE 'SMEDS'.'RECTEST':'TEST4_RECTEST';

Starting recover at 21-JAN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=16 device type=DISK
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified Point-in-Time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1

Creating automatic instance, with SID='naxj'

initialization parameters used for automatic instance:
db_name=T12CCDB
db_unique_name=naxj_pitr_T12CCDB
compatible=12.0.0.0.0
db_block_size=8192
db_files=200
sga_target=1G
processes=80
db_create_file_dest=/testcases/SR3-6629539201/rectbl
log_archive_dest_1='location=/testcases/SR3-6629539201/rectbl'
_enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used


starting up automatic instance T12CCDB

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2268624 bytes
Variable Size                281018928 bytes
Database Buffers             780140544 bytes
Redo Buffers                   5509120 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  logseq 64 thread 1;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET until clause

Starting restore at 21-JAN-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=109 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/autobackup/2013_01_21/o1_mf_s_805312613_8hv0c5yz_.bkp
channel ORA_AUX_DISK_1: piece handle=/bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/autobackup/2013_01_21/o1_mf_s_805312613_8hv0c5yz_.bkp tag=TAG20130121T175653
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/testcases/SR3-6629539201/rectbl/T12CCDB/controlfile/o1_mf_8hv7z47y_.ctl
Finished restore at 21-JAN-13

sql statement: alter database mount clone database

sql statement: alter system archive log current

contents of Memory Script:
{
# set requested point in time
set until  logseq 64 thread 1;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  4 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  8 to new;
set newname for clone datafile  9 to new;
set newname for clone tempfile  1 to new;
set newname for clone tempfile  3 to new;
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 4, 3, 8, 9;
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 3 to /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 21-JAN-13
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00009 to /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_nnndf_TAG20130121T175546_8hv092yj_.bkp
channel ORA_AUX_DISK_1: piece handle=/bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_nnndf_TAG20130121T175546_8hv092yj_.bkp tag=TAG20130121T175546
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:25
Finished restore at 21-JAN-13

datafile 1 switched to datafile copy
input datafile copy RECID=55 STAMP=805320511 file name=/testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_system_8hv7zblx_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=56 STAMP=805320511 file name=/testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_undotbs1_8hv7zbob_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=57 STAMP=805320512 file name=/testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_sysaux_8hv7zbn2_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=58 STAMP=805320512 file name=/testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_system_8hv7zbnt_.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=59 STAMP=805320512 file name=/testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_sysaux_8hv7zbn7_.dbf

contents of Memory Script:
{
# set requested point in time
set until  logseq 64 thread 1;
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  4 online";
sql clone "alter database datafile  3 online";
sql clone 'T12CPDB1' "alter database datafile  8 online";
sql clone 'T12CPDB1' "alter database datafile  9 online";
# recover and open database read only
recover clone database tablespace  "SYSTEM", "UNDOTBS1", "SYSAUX", "T12CPDB1":"SYSTEM", "T12CPDB1":"SYSAUX";
sql clone 'alter database open read only';
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  1 online
sql statement: alter database datafile  4 online
sql statement: alter database datafile  3 online
sql statement: alter database datafile  8 online
sql statement: alter database datafile  9 online

Starting recover at 21-JAN-13
using channel ORA_AUX_DISK_1

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=58
channel ORA_AUX_DISK_1: reading from backup piece /bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_annnn_TAG20130121T175652_8hv0c4bf_.bkp
channel ORA_AUX_DISK_1: piece handle=/bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_annnn_TAG20130121T175652_8hv0c4bf_.bkp tag=TAG20130121T175652
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/testcases/SR3-6629539201/rectbl/1_58_804254048.dbf thread=1 sequence=58
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=59
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=60
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=61
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=62
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=63
channel ORA_AUX_DISK_1: reading from backup piece /bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_annnn_TAG20130121T200313_8hv7r1hz_.bkp
channel ORA_AUX_DISK_1: piece handle=/bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_annnn_TAG20130121T200313_8hv7r1hz_.bkp tag=TAG20130121T200313
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/testcases/SR3-6629539201/rectbl/1_59_804254048.dbf thread=1 sequence=59
archived log file name=/testcases/SR3-6629539201/rectbl/1_60_804254048.dbf thread=1 sequence=60
archived log file name=/testcases/SR3-6629539201/rectbl/1_61_804254048.dbf thread=1 sequence=61
archived log file name=/testcases/SR3-6629539201/rectbl/1_62_804254048.dbf thread=1 sequence=62
archived log file name=/testcases/SR3-6629539201/rectbl/1_63_804254048.dbf thread=1 sequence=63
media recovery complete, elapsed time: 00:00:05
Finished recover at 21-JAN-13

sql statement: alter database open read only

contents of Memory Script:
{
sql clone 'alter pluggable database  T12CPDB1 open read only';
}
executing Memory Script

sql statement: alter pluggable database  T12CPDB1 open read only

contents of Memory Script:
{
   sql clone "create spfile from memory";
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  control_files = ''/testcases/SR3-6629539201/rectbl/T12CCDB/controlfile/o1_mf_8hv7z47y_.ctl'' comment=''RMAN set'' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
# mount database
sql clone 'alter database mount clone database';
}
executing Memory Script

sql statement: create spfile from memory

database closed
database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2268624 bytes
Variable Size                285213232 bytes
Database Buffers             775946240 bytes
Redo Buffers                   5509120 bytes

sql statement: alter system set  control_files =''/testcases/SR3-6629539201/rectbl/T12CCDB/controlfile/o1_mf_8hv7z47y_.ctl'' comment= ''RMAN set'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2268624 bytes
Variable Size                285213232 bytes
Database Buffers             775946240 bytes
Redo Buffers                   5509120 bytes

sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  logseq 64 thread 1;
# set destinations for recovery set and auxiliary set datafiles
set newname for datafile  20 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  20;
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

Starting restore at 21-JAN-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=115 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00020 to /testcases/SR3-6629539201/rectbl/NAXJ_PITR_T12CCDB/datafile/o1_mf_rectbl_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_nnndf_TAG20130121T175546_8hv092yj_.bkp
channel ORA_AUX_DISK_1: piece handle=/bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_nnndf_TAG20130121T175546_8hv092yj_.bkp tag=TAG20130121T175546
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 21-JAN-13

datafile 20 switched to datafile copy
input datafile copy RECID=61 STAMP=805320570 file name=/testcases/SR3-6629539201/rectbl/NAXJ_PITR_T12CCDB/datafile/o1_mf_rectbl_8hv83qpg_.dbf

contents of Memory Script:
{
# set requested point in time
set until  logseq 64 thread 1;
# online the datafiles restored or switched
sql clone 'T12CPDB1' "alter database datafile  20 online";
# recover and open resetlogs
recover clone database tablespace  "T12CPDB1":"RECTBL", "SYSTEM", "UNDOTBS1", "SYSAUX", "T12CPDB1":"SYSTEM", "T12CPDB1":"SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  20 online

Starting recover at 21-JAN-13
using channel ORA_AUX_DISK_1

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=58
channel ORA_AUX_DISK_1: reading from backup piece /bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_annnn_TAG20130121T175652_8hv0c4bf_.bkp
channel ORA_AUX_DISK_1: piece handle=/bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_annnn_TAG20130121T175652_8hv0c4bf_.bkp tag=TAG20130121T175652
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/testcases/SR3-6629539201/rectbl/1_58_804254048.dbf thread=1 sequence=58
channel clone_default: deleting archived log(s)
archived log file name=/testcases/SR3-6629539201/rectbl/1_58_804254048.dbf RECID=131 STAMP=805320572
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=59
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=60
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=61
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=62
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=63
channel ORA_AUX_DISK_1: reading from backup piece /bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_annnn_TAG20130121T200313_8hv7r1hz_.bkp
channel ORA_AUX_DISK_1: piece handle=/bugmnt17/em/celclnx14/SR3.5377673271/app/oracle/fast_recovery_area/T12CCDB/backupset/2013_01_21/o1_mf_annnn_TAG20130121T200313_8hv7r1hz_.bkp tag=TAG20130121T200313
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/testcases/SR3-6629539201/rectbl/1_59_804254048.dbf thread=1 sequence=59
channel clone_default: deleting archived log(s)
archived log file name=/testcases/SR3-6629539201/rectbl/1_59_804254048.dbf RECID=133 STAMP=805320573
archived log file name=/testcases/SR3-6629539201/rectbl/1_60_804254048.dbf thread=1 sequence=60
channel clone_default: deleting archived log(s)
archived log file name=/testcases/SR3-6629539201/rectbl/1_60_804254048.dbf RECID=134 STAMP=805320573
archived log file name=/testcases/SR3-6629539201/rectbl/1_61_804254048.dbf thread=1 sequence=61
channel clone_default: deleting archived log(s)
archived log file name=/testcases/SR3-6629539201/rectbl/1_61_804254048.dbf RECID=132 STAMP=805320573
archived log file name=/testcases/SR3-6629539201/rectbl/1_62_804254048.dbf thread=1 sequence=62
channel clone_default: deleting archived log(s)
archived log file name=/testcases/SR3-6629539201/rectbl/1_62_804254048.dbf RECID=136 STAMP=805320573
archived log file name=/testcases/SR3-6629539201/rectbl/1_63_804254048.dbf thread=1 sequence=63
channel clone_default: deleting archived log(s)
archived log file name=/testcases/SR3-6629539201/rectbl/1_63_804254048.dbf RECID=135 STAMP=805320573
media recovery complete, elapsed time: 00:00:00
Finished recover at 21-JAN-13

database opened

contents of Memory Script:
{
sql clone 'alter pluggable database  T12CPDB1 open';
}
executing Memory Script

sql statement: alter pluggable database  T12CPDB1 open

contents of Memory Script:
{
# create directory for datapump import
sql 'T12CPDB1' "create or replace directory TSPITR_DIROBJ_DPDIR as ''/testcases/SR3-6629539201/rectbl''";
# create directory for datapump export
sql clone 'T12CPDB1' "create or replace directory TSPITR_DIROBJ_DPDIR as ''/testcases/SR3-6629539201/rectbl''";
}
executing Memory Script

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/testcases/SR3-6629539201/rectbl''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/testcases/SR3-6629539201/rectbl''

Performing export of tables...
   EXPDP> Starting "SYS"."TSPITR_EXP_naxj_kswu":  
   EXPDP> Estimate in progress using BLOCKS method...
   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
   EXPDP> Total estimation using BLOCKS method: 128 KB
   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
   EXPDP> . . exported "SMEDS"."RECTEST"                           6.109 KB      32 rows
   EXPDP> Master table "SYS"."TSPITR_EXP_naxj_kswu" successfully loaded/unloaded
   EXPDP> ******************************************************************************
   EXPDP> Dump file set for SYS.TSPITR_EXP_naxj_kswu is:
   EXPDP>   /testcases/SR3-6629539201/rectbl/tspitr_naxj_85941.dmp
   EXPDP> Job "SYS"."TSPITR_EXP_naxj_kswu" successfully completed at Mon Jan 21 20:10:28 2013 elapsed 0 00:00:31
Export completed


contents of Memory Script:
{
# shutdown clone before import
shutdown clone abort
}
executing Memory Script

Oracle instance shut down

Performing import of tables...
   IMPDP> Master table "SYS"."TSPITR_IMP_naxj_uklm" successfully loaded/unloaded
   IMPDP> Starting "SYS"."TSPITR_IMP_naxj_uklm":  
   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
   IMPDP> . . imported "SMEDS"."TEST4_RECTEST"                     6.109 KB      32 rows
   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
   IMPDP> Job "SYS"."TSPITR_IMP_naxj_uklm" successfully completed at Mon Jan 21 20:10:40 2013 elapsed 0 00:00:06
Import completed


Removing automatic instance
Automatic instance removed
auxiliary instance file /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_temp_8hv82j8f_.tmp deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_temp_8hv82bj8_.tmp deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/NAXJ_PITR_T12CCDB/onlinelog/o1_mf_3_8hv840bs_.log deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/NAXJ_PITR_T12CCDB/onlinelog/o1_mf_2_8hv83zp1_.log deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/NAXJ_PITR_T12CCDB/onlinelog/o1_mf_1_8hv83z15_.log deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/NAXJ_PITR_T12CCDB/datafile/o1_mf_rectbl_8hv83qpg_.dbf deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_sysaux_8hv7zbn7_.dbf deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_system_8hv7zbnt_.dbf deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_sysaux_8hv7zbn2_.dbf deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_undotbs1_8hv7zbob_.dbf deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/T12CCDB/datafile/o1_mf_system_8hv7zblx_.dbf deleted
auxiliary instance file /testcases/SR3-6629539201/rectbl/T12CCDB/controlfile/o1_mf_8hv7z47y_.ctl deleted
auxiliary instance file tspitr_naxj_85941.dmp deleted
Finished recover at 21-JAN-13


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-1827409/,如需轉載,請註明出處,否則將追究法律責任。

相關文章