表空间单点恢复(TSPITR)和表单点恢复(TPITR)

1、前提条件

表空间单点恢复(TSPITR),要求必须存在删除表空间时间节点以前的全库备份。

2、特点

数据库不必关机。

先克隆一个数据库实例,在克隆数据库上进行表空间单点恢复,再将恢复的表空间传送回源数据库(XTTS)。

3、步骤

3.1、将要恢复的时间节点转换成SCN

select timestamp_to_scn(to_date('2024-04-12:10:49:15','YYYY-MM-DD:HH24:MI:SS')) from dual;

3.2、执行过程

复制代码
[oracle@classroom ~]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Fri Apr 12 10:58:59 2024

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1691043747)

RMAN> recover tablespace users until scn 2599477
2> auxiliary destination '/u01/app/oracle/oradata';

Starting recover at 12-APR-24
using target database control file instead of recovery catalog
current log archived
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=131 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=130 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Secure Backup
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=254 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=370 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=256 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=13 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=371 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=16 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=135 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=257 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='fFrd'

initialization parameters used for automatic instance:
db_name=ORCL
db_unique_name=fFrd_pitr_ORCL
compatible=12.1.0.2.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/app/oracle
_system_trig_enabled=FALSE
sga_target=1024M
processes=200
db_create_file_dest=/u01/app/oracle/oradata
log_archive_dest_1='location=/u01/app/oracle/oradata'
#No auxiliary parameter file used


starting up automatic instance ORCL

Oracle instance started

Total System Global Area    1073741824 bytes

Fixed Size                     2932632 bytes
Variable Size                293601384 bytes
Database Buffers             771751936 bytes
Redo Buffers                   5455872 bytes
Automatic instance created


List of tablespaces that have been dropped from the target database:
Tablespace USERS

contents of Memory Script:
{
# set requested point in time
set until  scn 2599477;
# 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';
# avoid unnecessary autobackups for structural changes during TSPITR
sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
}
executing Memory Script

executing command: SET until clause

Starting restore at 12-APR-24
allocated channel: ORA_AUX_SBT_TAPE_1
channel ORA_AUX_SBT_TAPE_1: SID=88 device type=SBT_TAPE
channel ORA_AUX_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_AUX_SBT_TAPE_2
channel ORA_AUX_SBT_TAPE_2: SID=169 device type=SBT_TAPE
channel ORA_AUX_SBT_TAPE_2: Oracle Secure Backup
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=250 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=7 device type=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: SID=89 device type=DISK
allocated channel: ORA_AUX_DISK_4
channel ORA_AUX_DISK_4: SID=170 device type=DISK
allocated channel: ORA_AUX_DISK_5
channel ORA_AUX_DISK_5: SID=251 device type=DISK
allocated channel: ORA_AUX_DISK_6
channel ORA_AUX_DISK_6: SID=8 device type=DISK
allocated channel: ORA_AUX_DISK_7
channel ORA_AUX_DISK_7: SID=90 device type=DISK
allocated channel: ORA_AUX_DISK_8
channel ORA_AUX_DISK_8: SID=171 device type=DISK

channel ORA_AUX_SBT_TAPE_1: starting datafile backup set restore
channel ORA_AUX_SBT_TAPE_1: restoring control file
channel ORA_AUX_SBT_TAPE_1: reading from backup piece 0c2o2b01_1_1
channel ORA_AUX_SBT_TAPE_1: piece handle=0c2o2b01_1_1 tag=LABS-14-CONTR-BEFORE-DROP
channel ORA_AUX_SBT_TAPE_1: restored backup piece 1
channel ORA_AUX_SBT_TAPE_1: restore complete, elapsed time: 00:00:25
output file name=/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_m1k90cjx_.ctl
Finished restore at 12-APR-24

sql statement: alter database mount clone database

sql statement: alter system archive log current

sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;

contents of Memory Script:
{
# set requested point in time
set until  scn 2599477;
# 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 tempfile  1 to new;
set newname for datafile  6 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, 6;
 
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

renamed tempfile 1 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 12-APR-24
using channel ORA_AUX_SBT_TAPE_1
using channel ORA_AUX_SBT_TAPE_2
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

channel ORA_AUX_DISK_1: restoring datafile 00001
input datafile copy RECID=7 STAMP=1164534743 file name=/u01/app/oracle/oradata/orcl/system01.dbf
destination for restore of datafile 00001: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_2: restoring datafile 00004
input datafile copy RECID=9 STAMP=1164534743 file name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_3: restoring datafile 00003
input datafile copy RECID=8 STAMP=1164534743 file name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
destination for restore of datafile 00003: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_4: restoring datafile 00006
input datafile copy RECID=11 STAMP=1164534743 file name=/u01/app/oracle/oradata/orcl/users01.dbf
destination for restore of datafile 00006: +data
channel ORA_AUX_DISK_4: copied datafile copy of datafile 00006
output file name=+DATA/ORCL/DATAFILE/users.263.1166094111 RECID=12 STAMP=1166094114
channel ORA_AUX_DISK_2: copied datafile copy of datafile 00004
output file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_m1k90xn8_.dbf RECID=13 STAMP=1166094177
channel ORA_AUX_DISK_3: copied datafile copy of datafile 00003
output file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_m1k90xnb_.dbf RECID=14 STAMP=1166094237
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00001
output file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_m1k90xn6_.dbf RECID=15 STAMP=1166094239
Finished restore at 12-APR-24

datafile 6 switched to datafile copy
input datafile copy RECID=16 STAMP=1166094248 file name=+DATA/ORCL/DATAFILE/users.263.1166094111
datafile 1 switched to datafile copy
input datafile copy RECID=17 STAMP=1166094248 file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_m1k90xn6_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=18 STAMP=1166094248 file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_m1k90xn8_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=19 STAMP=1166094248 file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_m1k90xnb_.dbf

contents of Memory Script:
{
# set requested point in time
set until  scn 2599477;
# 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 "alter database datafile  6 online";
# recover and open resetlogs
recover clone database tablespace  "USERS", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
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  6 online

Starting recover at 12-APR-24
using channel ORA_AUX_SBT_TAPE_1
using channel ORA_AUX_SBT_TAPE_2
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

starting media recovery

archived log for thread 1 with sequence 14 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_14.259.1164535185
archived log for thread 1 with sequence 15 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_15.261.1164535251
archived log for thread 1 with sequence 16 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_16.262.1164535257
archived log for thread 1 with sequence 17 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_17.263.1164535481
archived log for thread 1 with sequence 18 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_18.264.1164578503
archived log for thread 1 with sequence 19 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_03_26/thread_1_seq_19.265.1164596421
archived log for thread 1 with sequence 20 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_20.266.1166086589
archived log for thread 1 with sequence 21 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_21.267.1166087245
archived log for thread 1 with sequence 22 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_22.268.1166090857
archived log for thread 1 with sequence 23 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_23.269.1166093331
archived log for thread 1 with sequence 24 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_24.270.1166093331
archived log for thread 1 with sequence 25 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_25.271.1166093333
archived log for thread 1 with sequence 26 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_26.272.1166093335
archived log for thread 1 with sequence 27 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_27.273.1166093335
archived log for thread 1 with sequence 28 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_28.274.1166093339
archived log for thread 1 with sequence 29 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_29.275.1166094049
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_14.259.1164535185 thread=1 sequence=14
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_15.261.1164535251 thread=1 sequence=15
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_16.262.1164535257 thread=1 sequence=16
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_17.263.1164535481 thread=1 sequence=17
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_03_25/thread_1_seq_18.264.1164578503 thread=1 sequence=18
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_03_26/thread_1_seq_19.265.1164596421 thread=1 sequence=19
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_20.266.1166086589 thread=1 sequence=20
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_21.267.1166087245 thread=1 sequence=21
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_22.268.1166090857 thread=1 sequence=22
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_23.269.1166093331 thread=1 sequence=23
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_24.270.1166093331 thread=1 sequence=24
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_25.271.1166093333 thread=1 sequence=25
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_26.272.1166093335 thread=1 sequence=26
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_27.273.1166093335 thread=1 sequence=27
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_28.274.1166093339 thread=1 sequence=28
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_04_12/thread_1_seq_29.275.1166094049 thread=1 sequence=29
media recovery complete, elapsed time: 00:00:20
Finished recover at 12-APR-24

database opened

contents of Memory Script:
{
# make read only the tablespace that will be exported
sql clone 'alter tablespace  USERS read only';
# create directory for datapump import
sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/app/oracle/oradata''";
# create directory for datapump export
sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/app/oracle/oradata''";
}
executing Memory Script

sql statement: alter tablespace  USERS read only

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/oradata''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/oradata''

Performing export of metadata...
   EXPDP> Starting "SYS"."TSPITR_EXP_fFrd_wwyB":  
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
   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"."TSPITR_EXP_fFrd_wwyB" successfully loaded/unloaded
   EXPDP> ******************************************************************************
   EXPDP> Dump file set for SYS.TSPITR_EXP_fFrd_wwyB is:
   EXPDP>   /u01/app/oracle/oradata/tspitr_fFrd_75652.dmp
   EXPDP> ******************************************************************************
   EXPDP> Datafiles required for transportable tablespace USERS:
   EXPDP>   +DATA/ORCL/DATAFILE/users.263.1166094111
   EXPDP> Job "SYS"."TSPITR_EXP_fFrd_wwyB" successfully completed at Fri Apr 12 11:05:46 2024 elapsed 0 00:00:51
Export completed


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

Oracle instance shut down

Performing import of metadata...
   IMPDP> Master table "SYS"."TSPITR_IMP_fFrd_esty" successfully loaded/unloaded
   IMPDP> Starting "SYS"."TSPITR_IMP_fFrd_esty":  
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
   IMPDP> Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
   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_fFrd_esty" successfully completed at Fri Apr 12 11:06:38 2024 elapsed 0 00:00:33
Import completed


contents of Memory Script:
{
# make read write and offline the imported tablespaces
sql 'alter tablespace  USERS read write';
sql 'alter tablespace  USERS offline';
# enable autobackups after TSPITR is finished
sql 'begin dbms_backup_restore.AutoBackupFlag(TRUE); end;';
}
executing Memory Script

sql statement: alter tablespace  USERS read write

sql statement: alter tablespace  USERS offline

sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end;

Removing automatic instance
Automatic instance removed
auxiliary instance file /u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_m1k963j5_.tmp deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_3_m1k960b2_.log deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_2_m1k95y38_.log deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_1_m1k95xdn_.log deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_m1k90xnb_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_m1k90xn8_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_m1k90xn6_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/controlfile/o1_mf_m1k90cjx_.ctl deleted
auxiliary instance file tspitr_fFrd_75652.dmp deleted
Finished recover at 12-APR-24

RMAN> alter tablespace users online;

Statement processed

RMAN> 
复制代码

 

表单点恢复(TPITR),不要求全库备份,要求存在控制文件、归档日志、system、sysaux、undotbs1、表所在表空间的备份即可。

整个恢复期间不需要关库,先克隆一个数据库实例,在克隆数据库上进行表单点恢复,再将恢复的表用数据泵导入到源数据库。

复制代码
RMAN> recover table hr.t06317_b until scn 11633027
2> auxiliary destination '/u01/app/oracle/oradata';

Starting recover at 2024-05-14:17:15:33
current log archived
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=209 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=87 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Secure Backup
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=210 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=24 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=88 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=148 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=207 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=25 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=89 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=145 device type=DISK

Creating automatic instance, with SID='zkwb'

initialization parameters used for automatic instance:
db_name=ORCL
db_unique_name=zkwb_pitr_ORCL
compatible=12.1.0.2.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/app/oracle
_system_trig_enabled=FALSE
sga_target=1024M
processes=150
db_create_file_dest=/u01/app/oracle/oradata
log_archive_dest_1='location=/u01/app/oracle/oradata'
#No auxiliary parameter file used


starting up automatic instance ORCL

Oracle instance started

Total System Global Area    1073741824 bytes

Fixed Size                     2932632 bytes
Variable Size                293601384 bytes
Database Buffers             771751936 bytes
Redo Buffers                   5455872 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  scn 11633027;
# 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';
# resync catalog
resync catalog;
}
executing Memory Script

executing command: SET until clause

Starting restore at 2024-05-14:17:16:01
allocated channel: ORA_AUX_SBT_TAPE_1
channel ORA_AUX_SBT_TAPE_1: SID=6 device type=SBT_TAPE
channel ORA_AUX_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_AUX_SBT_TAPE_2
channel ORA_AUX_SBT_TAPE_2: SID=63 device type=SBT_TAPE
channel ORA_AUX_SBT_TAPE_2: Oracle Secure Backup
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=131 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=193 device type=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: SID=7 device type=DISK
allocated channel: ORA_AUX_DISK_4
channel ORA_AUX_DISK_4: SID=70 device type=DISK
allocated channel: ORA_AUX_DISK_5
channel ORA_AUX_DISK_5: SID=132 device type=DISK
allocated channel: ORA_AUX_DISK_6
channel ORA_AUX_DISK_6: SID=194 device type=DISK
allocated channel: ORA_AUX_DISK_7
channel ORA_AUX_DISK_7: SID=8 device type=DISK
allocated channel: ORA_AUX_DISK_8
channel ORA_AUX_DISK_8: SID=71 device type=DISK

channel ORA_AUX_SBT_TAPE_1: starting datafile backup set restore
channel ORA_AUX_SBT_TAPE_1: restoring control file
channel ORA_AUX_SBT_TAPE_1: reading from backup piece 042qq1l1_1_1
channel ORA_AUX_SBT_TAPE_1: piece handle=042qq1l1_1_1 tag=TAG20240514T170833
channel ORA_AUX_SBT_TAPE_1: restored backup piece 1
channel ORA_AUX_SBT_TAPE_1: restore complete, elapsed time: 00:00:25
output file name=/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_m46bz6rn_.ctl
Finished restore at 2024-05-14:17:16:32

sql statement: alter database mount clone database

sql statement: alter system archive log current

starting full resync of recovery catalog
full resync complete

contents of Memory Script:
{
# set requested point in time
set until  scn 11633027;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  2 to new;
set newname for clone tempfile  1 to new;
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 3, 2;
 
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

renamed tempfile 1 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_%u_.tmp in control file

Starting restore at 2024-05-14:17:16:40
using channel ORA_AUX_SBT_TAPE_1
using channel ORA_AUX_SBT_TAPE_2
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

channel ORA_AUX_SBT_TAPE_1: starting datafile backup set restore
channel ORA_AUX_SBT_TAPE_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00003 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_SBT_TAPE_1: reading from backup piece 032qq1ki_1_1
channel ORA_AUX_SBT_TAPE_2: starting datafile backup set restore
channel ORA_AUX_SBT_TAPE_2: specifying datafile(s) to restore from backup set
channel ORA_AUX_SBT_TAPE_2: restoring datafile 00001 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_SBT_TAPE_2: restoring datafile 00002 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_SBT_TAPE_2: reading from backup piece 022qq1ki_1_1
channel ORA_AUX_SBT_TAPE_1: piece handle=032qq1ki_1_1 tag=TAG20240514T170833
channel ORA_AUX_SBT_TAPE_1: restored backup piece 1
channel ORA_AUX_SBT_TAPE_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_SBT_TAPE_2: piece handle=022qq1ki_1_1 tag=TAG20240514T170833
channel ORA_AUX_SBT_TAPE_2: restored backup piece 1
channel ORA_AUX_SBT_TAPE_2: restore complete, elapsed time: 00:01:06
Finished restore at 2024-05-14:17:17:48

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=1168967868 file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_m46c0tt6_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=1168967868 file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_m46c0sjq_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=1168967868 file name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_m46c0tso_.dbf

contents of Memory Script:
{
# set requested point in time
set until  scn 11633027;
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  3 online";
sql clone "alter database datafile  2 online";
# recover and open database read only
recover clone database tablespace  "SYSTEM", "UNDOTBS1", "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  3 online

sql statement: alter database datafile  2 online

Starting recover at 2024-05-14:17:17:48
using channel ORA_AUX_SBT_TAPE_1
using channel ORA_AUX_SBT_TAPE_2
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

starting media recovery

archived log for thread 1 with sequence 2 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_05_14/thread_1_seq_2.991.1168967735
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_05_14/thread_1_seq_2.991.1168967735 thread=1 sequence=2
media recovery complete, elapsed time: 00:00:00
Finished recover at 2024-05-14:17:17:53

sql statement: alter database 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 = 
  ''/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_m46bz6rn_.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    1073741824 bytes

Fixed Size                     2932632 bytes
Variable Size                297795688 bytes
Database Buffers             767557632 bytes
Redo Buffers                   5455872 bytes

sql statement: alter system set  control_files =   ''/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_m46bz6rn_.ctl'' comment= ''RMAN set'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1073741824 bytes

Fixed Size                     2932632 bytes
Variable Size                297795688 bytes
Database Buffers             767557632 bytes
Redo Buffers                   5455872 bytes

sql statement: alter database mount clone database

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

executing command: SET until clause

executing command: SET NEWNAME

Starting restore at 2024-05-14:17:18:41
allocated channel: ORA_AUX_SBT_TAPE_1
channel ORA_AUX_SBT_TAPE_1: SID=6 device type=SBT_TAPE
channel ORA_AUX_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_AUX_SBT_TAPE_2
channel ORA_AUX_SBT_TAPE_2: SID=69 device type=SBT_TAPE
channel ORA_AUX_SBT_TAPE_2: Oracle Secure Backup
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=131 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=193 device type=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: SID=7 device type=DISK
allocated channel: ORA_AUX_DISK_4
channel ORA_AUX_DISK_4: SID=70 device type=DISK
allocated channel: ORA_AUX_DISK_5
channel ORA_AUX_DISK_5: SID=132 device type=DISK
allocated channel: ORA_AUX_DISK_6
channel ORA_AUX_DISK_6: SID=194 device type=DISK
allocated channel: ORA_AUX_DISK_7
channel ORA_AUX_DISK_7: SID=8 device type=DISK
allocated channel: ORA_AUX_DISK_8
channel ORA_AUX_DISK_8: SID=71 device type=DISK

channel ORA_AUX_SBT_TAPE_1: starting datafile backup set restore
channel ORA_AUX_SBT_TAPE_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00005 to /u01/app/oracle/oradata/ZKWB_PITR_ORCL/datafile/o1_mf_example_%u_.dbf
channel ORA_AUX_SBT_TAPE_1: reading from backup piece 022qq1ki_1_1
channel ORA_AUX_SBT_TAPE_1: piece handle=022qq1ki_1_1 tag=TAG20240514T170833
channel ORA_AUX_SBT_TAPE_1: restored backup piece 1
channel ORA_AUX_SBT_TAPE_1: restore complete, elapsed time: 00:00:25
Finished restore at 2024-05-14:17:19:12

datafile 5 switched to datafile copy
input datafile copy RECID=10 STAMP=1168967952 file name=/u01/app/oracle/oradata/ZKWB_PITR_ORCL/datafile/o1_mf_example_m46c46l6_.dbf

contents of Memory Script:
{
# set requested point in time
set until  scn 11633027;
# online the datafiles restored or switched
sql clone "alter database datafile  5 online";
# recover and open resetlogs
recover clone database tablespace  "EXAMPLE", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  5 online

Starting recover at 2024-05-14:17:19:12
using channel ORA_AUX_SBT_TAPE_1
using channel ORA_AUX_SBT_TAPE_2
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8

starting media recovery

archived log for thread 1 with sequence 2 is already on disk as file +FRA/ORCL/ARCHIVELOG/2024_05_14/thread_1_seq_2.991.1168967735
archived log file name=+FRA/ORCL/ARCHIVELOG/2024_05_14/thread_1_seq_2.991.1168967735 thread=1 sequence=2
media recovery complete, elapsed time: 00:00:01
Finished recover at 2024-05-14:17:19:17

database opened

contents of Memory Script:
{
# create directory for datapump import
sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/app/oracle/oradata''";
# create directory for datapump export
sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/u01/app/oracle/oradata''";
}
executing Memory Script

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/oradata''

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/oradata''

Performing export of tables...
   EXPDP> \u542f\u52a8 "SYS"."TSPITR_EXP_zkwb_zptd":  
   EXPDP> \u6b63\u5728\u4f7f\u7528 BLOCKS \u65b9\u6cd5\u8fdb\u884c\u4f30\u8ba1...
   EXPDP> \u5904\u7406\u5bf9\u8c61\u7c7b\u578b TABLE_EXPORT/TABLE/TABLE_DATA
   EXPDP> \u4f7f\u7528 BLOCKS \u65b9\u6cd5\u7684\u603b\u4f30\u8ba1: 64 KB
   EXPDP> \u5904\u7406\u5bf9\u8c61\u7c7b\u578b TABLE_EXPORT/TABLE/TABLE
   EXPDP> \u5904\u7406\u5bf9\u8c61\u7c7b\u578b TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   EXPDP> \u5904\u7406\u5bf9\u8c61\u7c7b\u578b TABLE_EXPORT/TABLE/STATISTICS/MARKER
   EXPDP> . . \u5bfc\u51fa\u4e86 "HR"."T06317_B"                             5.070 KB       3 \u884c
   EXPDP> \u5df2\u6210\u529f\u52a0\u8f7d/\u5378\u8f7d\u4e86\u4e3b\u8868 "SYS"."TSPITR_EXP_zkwb_zptd" 
   EXPDP> ******************************************************************************
   EXPDP> SYS.TSPITR_EXP_zkwb_zptd \u7684\u8f6c\u50a8\u6587\u4ef6\u96c6\u4e3a:
   EXPDP>   /u01/app/oracle/oradata/tspitr_zkwb_15806.dmp
   EXPDP> \u4f5c\u4e1a "SYS"."TSPITR_EXP_zkwb_zptd" \u5df2\u4e8e \u661f\u671f\u4e8c 5\u6708 14 17:19:46 2024 elapsed 0 00:00:15 \u6210\u529f\u5b8c\u6210
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> \u5df2\u6210\u529f\u52a0\u8f7d/\u5378\u8f7d\u4e86\u4e3b\u8868 "SYS"."TSPITR_IMP_zkwb_hybe" 
   IMPDP> \u542f\u52a8 "SYS"."TSPITR_IMP_zkwb_hybe":  
   IMPDP> \u5904\u7406\u5bf9\u8c61\u7c7b\u578b TABLE_EXPORT/TABLE/TABLE
   IMPDP> \u5904\u7406\u5bf9\u8c61\u7c7b\u578b TABLE_EXPORT/TABLE/TABLE_DATA
   IMPDP> . . \u5bfc\u5165\u4e86 "HR"."T06317_B"                             5.070 KB       3 \u884c
   IMPDP> \u5904\u7406\u5bf9\u8c61\u7c7b\u578b TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
   IMPDP> \u5904\u7406\u5bf9\u8c61\u7c7b\u578b TABLE_EXPORT/TABLE/STATISTICS/MARKER
   IMPDP> \u4f5c\u4e1a "SYS"."TSPITR_IMP_zkwb_hybe" \u5df2\u4e8e \u661f\u671f\u4e8c 5\u6708 14 17:20:27 2024 elapsed 0 00:00:21 \u6210\u529f\u5b8c\u6210
Import completed


Removing automatic instance
Automatic instance removed
auxiliary instance file /u01/app/oracle/oradata/ORCL/datafile/o1_mf_temp_m46c2226_.tmp deleted
auxiliary instance file /u01/app/oracle/oradata/ZKWB_PITR_ORCL/onlinelog/o1_mf_3_m46c4onb_.log deleted
auxiliary instance file /u01/app/oracle/oradata/ZKWB_PITR_ORCL/onlinelog/o1_mf_2_m46c4odl_.log deleted
auxiliary instance file /u01/app/oracle/oradata/ZKWB_PITR_ORCL/onlinelog/o1_mf_1_m46c4o37_.log deleted
auxiliary instance file /u01/app/oracle/oradata/ZKWB_PITR_ORCL/datafile/o1_mf_example_m46c46l6_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_m46c0tso_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_m46c0sjq_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_m46c0tt6_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/ORCL/controlfile/o1_mf_m46bz6rn_.ctl deleted
auxiliary instance file tspitr_zkwb_15806.dmp deleted
Finished recover at 2024-05-14:17:20:29

RMAN> 
复制代码

 

posted @   霜雪吴钩  阅读(25)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
作者:霜雪吴钩 版权声明:本文为博主原创文章,转载请附上博文链接!
点击右上角即可分享
微信分享提示