體驗跨越incarnation進行flashback database相比傳統RMAN RECOVER的便捷性
本文要模擬的是使用flashback database進行不同incarnation之間的flashback,將之與傳統的RMAN recovery進行比較,從中感受一下flashback database高效、便捷的特點
|-----inc3_scn1 |-----inc2_scn1
| |
---inc1_scn1-----------------inc1_scn2--------inc1_scn3
flashback and recovery時序圖說明:
inc1_scn1、inc1_scn2、inc1_scn3同屬於incarnation 1
inc2_scn1屬於incarnation 2
inc3_scn1屬於incarnation 3
前提:開啟flashback database logging
操作場景:
當inc1_scn3時flashback到inc1_scn2,open resetlogs生成incarnation 2,incarnation 2前進到inc2_scn1時,執行flashback到inc1_scn1,open resetlogs生成incarnation 3,之後分別嘗試flashback database和recover database兩種方式從inc3_scn1回到inc2_scn1
具體操作命令如下:
<<<incarnation 1:生成inc1_scn1、inc1_scn2、inc1_scn3各時間節點的資料,從inc1_scn3 flashback到inc1_scn2,製造出incarnation 2>>>
###inc1_scn1:
backup database tag 'inc1_scn1';
alter system switch logfile;
alter system switch logfile;
create table inc1_scn1 (c1 timestamp,c2 number);
insert into inc1_scn1 values(sysdate,dbms_flashback.get_system_change_number+10);
commit;
set numwidth 16 linesize 120
select * from inc1_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.39.46.000000 PM 12723361982199
###inc1_scn2:
backup database tag 'inc1_scn2';
alter system switch logfile;
alter system switch logfile;
create table inc1_scn2 (c1 timestamp,c2 number);
insert into inc1_scn2 values(sysdate,dbms_flashback.get_system_change_number+10);
set numwidth 16 linesize 120
select * from inc1_scn2;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.42.59.000000 PM 12723361982600
###inc1_scn3:
backup database tag 'inc1_scn3';
alter system switch logfile;
alter system switch logfile;
create table inc1_scn3 (c1 timestamp,c2 number);
insert into inc1_scn3 values(sysdate,dbms_flashback.get_system_change_number+10);
set numwidth 16 linesize 120
select * from inc1_scn3;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.45.05.000000 PM 12723361982799
shutdown immediate
startup mount
list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TSTDB1 2030654775 CURRENT 12723361876275 20150501 22:23:18
set numwidth 16
col name format a50
set linesize 150
select name,checkpoint_change#,CHECKPOINT_TIME,RESETLOGS_CHANGE#,RESETLOGS_TIME from v$datafile_header;
NAME CHECKPOINT_CHANGE# CHECKPOINT_TIME RESETLOGS_CHANGE# RESETLOGS_TIME
-------------------------------------------------- ------------------ ----------------- ----------------- -----------------
/oradata06/testaaaaa/system01.dbf 12723361983627 20150502 16:46:49 12723361876275 20150501 22:23:18
/oradata06/testaaaaa/sysaux01.dbf 12723361983627 20150502 16:46:49 12723361876275 20150501 22:23:18
/oradata06/testaaaaa/undotbs01.dbf 12723361983627 20150502 16:46:49 12723361876275 20150501 22:23:18
/oradata06/testaaaaa/users01.dbf 12723361983627 20150502 16:46:49 12723361876275 20150501 22:23:18
/oradata06/testaaaaa/ts0329_1.dbf 12723361983627 20150502 16:46:49 12723361876275 20150501 22:23:18
/oradata06/testaaaaa/xdbts1.dbf 12723361983627 20150502 16:46:49 12723361876275 20150501 22:23:18
/oradata06/testaaaaa/ts0212.dbf 12723357761339 20150315 09:56:23 1 20141110 21:15:35
/oradata06/testaaaaa/ts0212_1.dbf 12723357761339 20150315 09:56:23 1 20141110 21:15:35
/oradata06/testaaaaa/ts0422_1.dbf 12723361983627 20150502 16:46:49 12723361876275 20150501 22:23:18
col FLASHBACK_DATABASE_ALLOWED format a3
set linesize 150
set numwidth 15
select * from v$database_incarnation;
INCARNATION# RESETLOGS_CHANGE# RESETLOGS_TIME PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_T STATUS RESETLOGS_ID PRIOR_INCARNATION# FLA
--------------- ----------------- ----------------- ----------------------- ----------------- ------- --------------- ------------------ ---
1 12723361876275 20150501 22:23:18 12723361866362 20150501 21:07:33 CURRENT 878595798 0 YES
flashback database to scn 12723361982600; <--- 從inc1_scn3->inc1_scn2
***alert.log
Sat May 02 16:50:35 2015
flashback database to scn 12723361982600
Flashback Restore Start
Flashback Restore Complete
Flashback Media Recovery Start
started logmerger process
Sat May 02 16:50:36 2015
Flashback mount Marker scn during SCN 12723361982683
Marker checkpoint scn during mount SCN 12723361982035
Marker fgda seq 1 bno 7
Flashback mount unfinished crash recovery 1
Parallel Media Recovery started with 16 slaves
Flashback unfinished crash recovery is set during start of media recovery
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_7_1jQHi3m6Z_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_8_1jQHi7rLJ_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_9_1jQHtWhju_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_10_1jQHtWgrp_.arc
Recovery of Online Redo Log: Thread 1 Group 2 Seq 11 Reading mem 0
Mem# 0: /oradata06/testaaaaa/redo02a.log
Mem# 1: /oradata06/testaaaaa/redo02b.log
Incomplete Recovery applied until change 12723361982601 time 05/02/2015 16:43:22
Flashback Media Recovery Complete
Completed: flashback database to scn 12723361982600
alter database open resetlogs; <----進入incarnation 2
***alert.log
Sat May 02 16:51:47 2015
alter database open resetlogs
RESETLOGS after incomplete recovery UNTIL CHANGE 12723361982601
Archived Log entry 10 added for thread 1 sequence 13 ID 0x79f2aa03 dest 1:
Archived Log entry 11 added for thread 1 sequence 11 ID 0x79f2aa03 dest 1:
Archived Log entry 12 added for thread 1 sequence 12 ID 0x79f2aa03 dest 1:
Clearing online redo logfile 1 /oradata06/testaaaaa/redo01a.log
Clearing online log 1 of thread 1 sequence number 13
Clearing online redo logfile 1 complete
Clearing online redo logfile 2 /oradata06/testaaaaa/redo02a.log
Clearing online log 2 of thread 1 sequence number 11
Clearing online redo logfile 2 complete
Clearing online redo logfile 3 /oradata06/testaaaaa/redo03a.log
Clearing online log 3 of thread 1 sequence number 12
Clearing online redo logfile 3 complete
Resetting resetlogs activation ID 2045946371 (0x79f2aa03)
Online log /oradata06/testaaaaa/redo01a.log: Thread 1 Group 1 was previously cleared
Online log /oradata06/testaaaaa/redo01b.log: Thread 1 Group 1 was previously cleared
Online log /oradata06/testaaaaa/redo02a.log: Thread 1 Group 2 was previously cleared
Online log /oradata06/testaaaaa/redo02b.log: Thread 1 Group 2 was previously cleared
Online log /oradata06/testaaaaa/redo03a.log: Thread 1 Group 3 was previously cleared
Online log /oradata06/testaaaaa/redo03b.log: Thread 1 Group 3 was previously cleared
Sat May 02 16:51:52 2015
Setting recovery target incarnation to 2
Flashback resetlogs (SCN 12723361876275 -> SCN 12723361982602)
Sat May 02 16:51:52 2015
Assigning activation ID 2046039106 (0x79f41442)
LGWR: STARTING ARCH PROCESSES
Sat May 02 16:51:52 2015
ARC0 started with pid=24, OS id=41681260
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Thread 1 opened at log sequence 1
Current log# 1 seq# 1 mem# 0: /oradata06/testaaaaa/redo01a.log
Current log# 1 seq# 1 mem# 1: /oradata06/testaaaaa/redo01b.log
Successful open of redo thread 1
Sat May 02 16:51:53 2015
SMON: enabling cache recovery
Sat May 02 16:51:53 2015
ARC1 started with pid=25, OS id=5702698
Sat May 02 16:51:53 2015
ARC2 started with pid=26, OS id=10880786
Sat May 02 16:51:53 2015
ARC3 started with pid=27, OS id=1574092
ARC1: Archival started
ARC2: Archival started
ARC2: Becoming the 'no FAL' ARCH
ARC2: Becoming the 'no SRL' ARCH
ARC1: Becoming the heartbeat ARCH
[37093898] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:2199634163 end:2199634270 diff:107 (1 seconds)
Dictionary check beginning
File #7 is offline, but is part of an online tablespace.
data file 7: '/oradata06/testaaaaa/ts0212.dbf'
Successfuly brought file #7 online.
File #8 is offline, but is part of an online tablespace.
data file 8: '/oradata06/testaaaaa/ts0212_1.dbf'
Successfuly brought file #8 online.
Dictionary check complete
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
*********************************************************************
WARNING: The following temporary tablespaces contain no files.
This condition can occur when a backup controlfile has
been restored. It may be necessary to add files to these
tablespaces. That can be done using the SQL statement:
ALTER TABLESPACE <tablespace_name> ADD TEMPFILE
Alternatively, if these temporary tablespaces are no longer
needed, then they can be dropped.
Empty temporary tablespace: TEMP
*********************************************************************
Database Characterset is ZHS16GBK
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Sat May 02 16:51:54 2015
QMNC started with pid=29, OS id=1246314
LOGSTDBY: Validating controlfile with logical metadata
LOGSTDBY: Validation complete
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
Sat May 02 16:51:54 2015
New flashback coordinator
Sat May 02 16:51:55 2015
db_recovery_file_dest_size of 204800 MB is 5.02% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Sat May 02 16:51:55 2015
Starting background process CJQ0
Sat May 02 16:51:55 2015
CJQ0 started with pid=34, OS id=41354144
Completed: alter database open resetlogs
set linesize 100
select * from inc1_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.39.46.000000 PM 12723361982199
select * from inc1_scn2;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.42.59.000000 PM 12723361982600
select * from inc1_scn3;
select * from inc1_scn3
*
ERROR at line 1:
ORA-00942: table or view does not exist
list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
2 2 TSTDB1 2030654775 CURRENT 12723361982602 20150502 16:51:47
set numwidth 16
col name format a50
set linesize 150
select name,checkpoint_change#,CHECKPOINT_TIME,RESETLOGS_CHANGE#,RESETLOGS_TIME from v$datafile_header;
NAME CHECKPOINT_CHANGE# CHECKPOINT_TIME RESETLOGS_CHANGE# RESETLOGS_TIME
-------------------------------------------------- ------------------ ----------------- ----------------- -----------------
/oradata06/testaaaaa/system01.dbf 12723361982605 20150502 16:51:53 12723361982602 20150502 16:51:47
/oradata06/testaaaaa/sysaux01.dbf 12723361982605 20150502 16:51:53 12723361982602 20150502 16:51:47
/oradata06/testaaaaa/undotbs01.dbf 12723361982605 20150502 16:51:53 12723361982602 20150502 16:51:47
/oradata06/testaaaaa/users01.dbf 12723361982605 20150502 16:51:53 12723361982602 20150502 16:51:47
/oradata06/testaaaaa/ts0329_1.dbf 12723361982605 20150502 16:51:53 12723361982602 20150502 16:51:47
/oradata06/testaaaaa/xdbts1.dbf 12723361982605 20150502 16:51:53 12723361982602 20150502 16:51:47
/oradata06/testaaaaa/ts0212.dbf 12723357761339 20150315 09:56:23 1 20141110 21:15:35
/oradata06/testaaaaa/ts0212_1.dbf 12723357761339 20150315 09:56:23 1 20141110 21:15:35
/oradata06/testaaaaa/ts0422_1.dbf 12723361982605 20150502 16:51:53 12723361982602 20150502 16:51:47
col FLASHBACK_DATABASE_ALLOWED format a3
set linesize 150
set numwidth 15
select * from v$database_incarnation;
INCARNATION# RESETLOGS_CHANGE# RESETLOGS_TIME PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_T STATUS RESETLOGS_ID PRIOR_INCARNATION# FLA
--------------- ----------------- ----------------- ----------------------- ----------------- ------- --------------- ------------------ ---
1 12723361876275 20150501 22:23:18 12723361866362 20150501 21:07:33 PARENT 878595798 0 YES
2 12723361982602 20150502 16:51:47 12723361876275 20150501 22:23:18 CURRENT 878662307 1 YES
<<<incarnation 2:生成inc2_scn1時間點的資料,從inc2_scn1 flashback到inc1_scn1,製造出incarnation 3>>>
###inc2_scn1
backup database tag 'inc2_scn1';
alter system switch logfile;
alter system switch logfile;
create table inc2_scn1 (c1 timestamp,c2 number);
insert into inc2_scn1 values(sysdate,dbms_flashback.get_system_change_number+10);
commit;
set numwidth 16 linesize 120
select * from inc2_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 05.00.02.000000 PM 12723361984200
shutdown immediate;
startup mount;
flashback database to scn 12723361982199; <---從inc2_scn1->inc1_scn1,因為inc1_scn1與inc2_scn1在同一條direct ancestral path上所以可以不顯式的指定" RESET DATABASE TO INCARNATION",這一豁免僅限於flashback database操作,而不是recover database
***alert.log
Sat May 02 17:04:45 2015
flashback database to scn 12723361982199
Flashback Restore Start
Flashback Restore Complete
Flashback Media Recovery Start
Sat May 02 17:04:46 2015
Setting recovery target incarnation to 1
started logmerger process
Sat May 02 17:04:46 2015
Flashback mount Marker scn during SCN 12723361982683
Marker checkpoint scn during mount SCN 12723361982035
Marker fgda seq 1 bno 7
Flashback mount unfinished crash recovery 1
Flashback incarnation change (SCN 12723361982602 -> SCN 12723361876275)
Parallel Media Recovery started with 16 slaves
Flashback unfinished crash recovery is set during start of media recovery
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_7_1jQHi3m6Z_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_8_1jQHi7rLJ_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_9_1jQHtWhju_.arc
Incomplete Recovery applied until change 12723361982200 time 05/02/2015 16:40:07
Flashback Media Recovery Complete
Setting recovery target incarnation to 2
Completed: flashback database to scn 12723361982199
alter database open read only;
set linesize 100
set numwidth 16
select * from inc1_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.39.46.000000 PM 12723361982199
select * from inc1_scn2;
select * from inc1_scn2
*
ERROR at line 1:
ORA-00942: table or view does not exist
select * from inc2_scn1;
select * from inc2_scn1
*
ERROR at line 1:
ORA-00942: table or view does not exist
---此處再演示一下如何從inc1_scn1 Flashback回到inc2_scn1;
shutdown immediate
startup mount;
flashback database to scn 12723361984200;
***alert.log
Sat May 02 17:12:51 2015
flashback database to scn 12723361984200
Flashback Restore Start
Flashback Restore Complete
Flashback Media Recovery Start
started logmerger process
Parallel Media Recovery started with 16 slaves
Sat May 02 17:12:53 2015
Media Recovery start incarnation depth : 1, target inc# : 2, irscn : 12723361982601
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_7_1jQHi3m6Z_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_8_1jQHi7rLJ_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_9_1jQHtWhju_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_10_1jQHtWgrp_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_11_1jQIO5Ulj_.arc
Flashback mount Marker scn during SCN 12723361983987
Marker checkpoint scn during mount SCN 12723361982742
Marker fgda seq 1 bno 2785
Flashback mount unfinished crash recovery 0
Flashback incarnation change (SCN 12723361876275 -> SCN 12723361982602)
Recovery of Online Redo Log: Thread 1 Group 1 Seq 1 Reading mem 0
Mem# 0: /oradata06/testaaaaa/redo01a.log
Mem# 1: /oradata06/testaaaaa/redo01b.log
Recovery of Online Redo Log: Thread 1 Group 2 Seq 2 Reading mem 0
Mem# 0: /oradata06/testaaaaa/redo02a.log
Mem# 1: /oradata06/testaaaaa/redo02b.log
Recovery of Online Redo Log: Thread 1 Group 3 Seq 3 Reading mem 0
Mem# 0: /oradata06/testaaaaa/redo03a.log
Mem# 1: /oradata06/testaaaaa/redo03b.log
Incomplete Recovery applied until change 12723361984201 time 05/02/2015 17:00:03
Flashback Media Recovery Complete
Completed: flashback database to scn 12723361984200
alter database open read only;
set linesize 100
set numwidth 16
select * from inc1_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.39.46.000000 PM 12723361982199
select * from inc1_scn2;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.42.59.000000 PM 12723361982600
select * from inc2_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 05.00.02.000000 PM 12723361984200
當然從inc1_scn1到inc2_scn1也可以使用recover database until scn 12723361984200;
---依舊回到inc1_scn1,繼續下面的測試
flashback database to scn 12723361982199; <--- inc2_scn1->inc1_scn1
alter database open resetlogs; <----進入incarnation 3
***alert.log
Sat May 02 17:26:40 2015
alter database open resetlogs
RESETLOGS after incomplete recovery UNTIL CHANGE 12723361982200
Archived Log entry 21 added for thread 1 sequence 1 ID 0x79f41442 dest 1:
Archived Log entry 22 added for thread 1 sequence 2 ID 0x79f41442 dest 1:
Archived Log entry 23 added for thread 1 sequence 3 ID 0x79f41442 dest 1:
Clearing online redo logfile 1 /oradata06/testaaaaa/redo01a.log
Clearing online log 1 of thread 1 sequence number 1
Clearing online redo logfile 1 complete
Clearing online redo logfile 2 /oradata06/testaaaaa/redo02a.log
Clearing online log 2 of thread 1 sequence number 2
Clearing online redo logfile 2 complete
Clearing online redo logfile 3 /oradata06/testaaaaa/redo03a.log
Clearing online log 3 of thread 1 sequence number 3
Clearing online redo logfile 3 complete
Resetting resetlogs activation ID 2046039106 (0x79f41442)
Online log /oradata06/testaaaaa/redo01a.log: Thread 1 Group 1 was previously cleared
Online log /oradata06/testaaaaa/redo01b.log: Thread 1 Group 1 was previously cleared
Online log /oradata06/testaaaaa/redo02a.log: Thread 1 Group 2 was previously cleared
Online log /oradata06/testaaaaa/redo02b.log: Thread 1 Group 2 was previously cleared
Online log /oradata06/testaaaaa/redo03a.log: Thread 1 Group 3 was previously cleared
Online log /oradata06/testaaaaa/redo03b.log: Thread 1 Group 3 was previously cleared
Sat May 02 17:26:45 2015
Setting recovery target incarnation to 3
Flashback resetlogs (SCN 12723361876275 -> SCN 12723361982201)
Sat May 02 17:26:45 2015
Assigning activation ID 2046030896 (0x79f3f430)
LGWR: STARTING ARCH PROCESSES
Sat May 02 17:26:46 2015
ARC0 started with pid=24, OS id=42205420
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Thread 1 opened at log sequence 1
Current log# 1 seq# 1 mem# 0: /oradata06/testaaaaa/redo01a.log
Current log# 1 seq# 1 mem# 1: /oradata06/testaaaaa/redo01b.log
Successful open of redo thread 1
Sat May 02 17:26:47 2015
SMON: enabling cache recovery
Sat May 02 17:26:47 2015
ARC1 started with pid=25, OS id=36635540
Sat May 02 17:26:47 2015
ARC2 started with pid=26, OS id=40698320
Sat May 02 17:26:47 2015
ARC3 started with pid=27, OS id=48628392
ARC1: Archival started
ARC2: Archival started
ARC1: Becoming the 'no FAL' ARCH
ARC1: Becoming the 'no SRL' ARCH
ARC2: Becoming the heartbeat ARCH
[51184380] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:2201727867 end:2201727976 diff:109 (1 seconds)
Dictionary check beginning
File #7 is offline, but is part of an online tablespace.
data file 7: '/oradata06/testaaaaa/ts0212.dbf'
Successfuly brought file #7 online.
File #8 is offline, but is part of an online tablespace.
data file 8: '/oradata06/testaaaaa/ts0212_1.dbf'
Successfuly brought file #8 online.
Dictionary check complete
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
*********************************************************************
WARNING: The following temporary tablespaces contain no files.
This condition can occur when a backup controlfile has
been restored. It may be necessary to add files to these
tablespaces. That can be done using the SQL statement:
ALTER TABLESPACE <tablespace_name> ADD TEMPFILE
Alternatively, if these temporary tablespaces are no longer
needed, then they can be dropped.
Empty temporary tablespace: TEMP
*********************************************************************
Database Characterset is ZHS16GBK
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Sat May 02 17:26:47 2015
QMNC started with pid=29, OS id=39321972
LOGSTDBY: Validating controlfile with logical metadata
LOGSTDBY: Validation complete
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
Sat May 02 17:26:48 2015
New flashback coordinator
Sat May 02 17:26:48 2015
db_recovery_file_dest_size of 204800 MB is 6.63% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Sat May 02 17:26:49 2015
Starting background process CJQ0
Sat May 02 17:26:49 2015
CJQ0 started with pid=32, OS id=41681210
Completed: alter database open resetlogs
list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
3 3 TSTDB1 2030654775 CURRENT 12723361982201 20150502 17:26:40
2 2 TSTDB1 2030654775 ORPHAN 12723361982602 20150502 16:51:47
set numwidth 16
col name format a50
set linesize 150
select name,checkpoint_change#,CHECKPOINT_TIME,RESETLOGS_CHANGE#,RESETLOGS_TIME from v$datafile_header;
NAME CHECKPOINT_CHANGE# CHECKPOINT_TIME RESETLOGS_CHANGE# RESETLOGS_TIME
-------------------------------------------------- ------------------ ----------------- ----------------- -----------------
/oradata06/testaaaaa/system01.dbf 12723361982204 20150502 17:26:47 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/sysaux01.dbf 12723361982204 20150502 17:26:47 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/undotbs01.dbf 12723361982204 20150502 17:26:47 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/users01.dbf 12723361982204 20150502 17:26:47 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/ts0329_1.dbf 12723361982204 20150502 17:26:47 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/xdbts1.dbf 12723361982204 20150502 17:26:47 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/ts0212.dbf 12723357761339 20150315 09:56:23 1 20141110 21:15:35
/oradata06/testaaaaa/ts0212_1.dbf 12723357761339 20150315 09:56:23 1 20141110 21:15:35
/oradata06/testaaaaa/ts0422_1.dbf 12723361982204 20150502 17:26:47 12723361982201 20150502 17:26:40
col FLASHBACK_DATABASE_ALLOWED format a3
set linesize 150
set numwidth 15
select * from v$database_incarnation;
INCARNATION# RESETLOGS_CHANGE# RESETLOGS_TIME PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_T STATUS RESETLOGS_ID PRIOR_INCARNATION# FLA
--------------- ----------------- ----------------- ----------------------- ----------------- ------- --------------- ------------------ ---
1 12723361876275 20150501 22:23:18 12723361866362 20150501 21:07:33 PARENT 878595798 0 YES
2 12723361982602 20150502 16:51:47 12723361876275 20150501 22:23:18 ORPHAN 878662307 1 YES
3 12723361982201 20150502 17:26:40 12723361876275 20150501 22:23:18 CURRENT 878664400 1 YES
<<<incarnation 3:製造出inc3_scn1點的資料,從inc3_scn1 演進到inc2_inc1(使用flashback database/recover database兩種方式)>>>
###inc3_scn1:
backup database tag 'inc3_scn1';
create table inc3_scn1 (c1 timestamp,c2 number);
insert into inc3_scn1 values(sysdate,dbms_flashback.get_system_change_number+10);
commit;
set numwidth 16 linesize 120
select * from inc3_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 05.35.56.000000 PM 12723361984661
shutdown immediate
startup mount
flashback database to scn 12723361984200; <----從inc3_scn1->inc2_inc1的flashback
***alert.log
Sat May 02 17:42:20 2015
flashback database to scn 12723361984200
Flashback Restore Start
Flashback Restore Complete
Flashback Media Recovery Start
started logmerger process
Sat May 02 17:42:21 2015
Flashback mount Marker scn during SCN 12723361984250
Marker checkpoint scn during mount SCN 12723361982336
Marker fgda seq 1 bno 8416
Flashback mount unfinished crash recovery 1
Parallel Media Recovery started with 16 slaves
Flashback unfinished crash recovery is set during start of media recovery
Recovery of Online Redo Log: Thread 1 Group 1 Seq 1 Reading mem 0
Mem# 0: /oradata06/testaaaaa/redo01a.log
Mem# 1: /oradata06/testaaaaa/redo01b.log
Incomplete Recovery applied until change 12723361984201 time 05/02/2015 17:31:57
Flashback Media Recovery Complete
Completed: flashback database to scn 12723361984200
alter database open read only;
set linesize 100
set numwidth 16
select * from inc1_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.39.46.000000 PM 12723361982199
select * from inc3_scn1;
select * from inc3_scn1
*
ERROR at line 1:
ORA-00942: table or view does not exist
select * from inc1_scn2;
select * from inc1_scn2
*
ERROR at line 1:
ORA-00942: table or view does not exist
select * from inc2_scn1;
select * from inc2_scn1
*
ERROR at line 1:
ORA-00942: table or view does not exist
set numwidth 16
col name format a50
set linesize 150
select name,checkpoint_change#,CHECKPOINT_TIME,RESETLOGS_CHANGE#,RESETLOGS_TIME from v$datafile_header;
NAME CHECKPOINT_CHANGE# CHECKPOINT_TIME RESETLOGS_CHANGE# RESETLOGS_TIME
-------------------------------------------------- ------------------ ----------------- ----------------- -----------------
/oradata06/testaaaaa/system01.dbf 12723361984201 20150502 17:31:57 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/sysaux01.dbf 12723361984201 20150502 17:31:57 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/undotbs01.dbf 12723361984201 20150502 17:31:57 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/users01.dbf 12723361984201 20150502 17:31:57 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/ts0329_1.dbf 12723361984201 20150502 17:31:57 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/xdbts1.dbf 12723361984201 20150502 17:31:57 12723361982201 20150502 17:26:40
/oradata06/testaaaaa/ts0212.dbf 12723357761339 20150315 09:56:23 1 20141110 21:15:35
/oradata06/testaaaaa/ts0212_1.dbf 12723357761339 20150315 09:56:23 1 20141110 21:15:35
/oradata06/testaaaaa/ts0422_1.dbf 12723361984201 20150502 17:31:57 12723361982201 20150502 17:26:40
list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
3 3 TSTDB1 2030654775 CURRENT 12723361982201 20150502 17:26:40 <---current incarnation
2 2 TSTDB1 2030654775 ORPHAN 12723361982602 20150502 16:51:47 <---incarnation 2變成了orphan
inc3_scn1、inc1_scn2、inc2_scn1表都沒有記錄,這是為何,因為資料庫當前的incarnation=3,從當前的incarnation到祖先incarnation存在一條唯一的路徑(稱為direct ancestral path),本例中就是incarnation 3->incarnation 1,在不使用reset database to incarnation ...的情況下,scn必須來自於direct ancestral path裡的某個incarnation,從list incarnation的輸出裡可以判斷目標scn=12723361984200來自於incarnation 3,inc3_scn1表建立時的scn是12723361984661>12723361984200,而inc1_scn2、inc2_scn1表所在的路徑不在direct ancestral path裡,所以只有inc1_scn1表能查到內容。
---reset database to incarnation 2,再嘗試從inc3_scn1 flashback到inc2_inc1,這下正常了
shutdown immediate
startup mount
list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
3 3 TSTDB1 2030654775 CURRENT 12723361982201 20150502 17:26:40
2 2 TSTDB1 2030654775 ORPHAN 12723361982602 20150502 16:51:47
RMAN> reset database to incarnation 2;
database reset to incarnation 2
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
3 3 TSTDB1 2030654775 ORPHAN 12723361982201 20150502 17:26:40 <---incarnation 3變成orphan
2 2 TSTDB1 2030654775 CURRENT 12723361982602 20150502 16:51:47 <---incarnation 2變成current
flashback database to scn 12723361984200;
***alert.log
Sat May 02 18:20:36 2015
flashback database to scn 12723361984200
Flashback Restore Start
Flashback Restore Complete
Flashback Media Recovery Start
started logmerger process
Parallel Media Recovery started with 16 slaves
Sat May 02 18:20:39 2015
Media Recovery start incarnation depth : 1, target inc# : 2, irscn : 12723361982601
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_7_1jQHi3m6Z_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_8_1jQHi7rLJ_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_9_1jQHtWhju_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_10_1jQHtWgrp_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_11_1jQIO5Ulj_.arc
Flashback mount Marker scn during SCN 12723361983987
Marker checkpoint scn during mount SCN 12723361982742
Marker fgda seq 1 bno 2785
Flashback mount unfinished crash recovery 0
Flashback incarnation change (SCN 12723361982201 -> SCN 12723361982602)
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_1_1jQKKtU5p_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_2_1jQKKtmNK_.arc
Flashback Media Recovery Log /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_3_1jQKKtsWK_.arc
Incomplete Recovery applied until change 12723361984201 time 05/02/2015 17:00:03
Flashback Media Recovery Complete
Completed: flashback database to scn 12723361984200
alter database open read only;
set linesize 100
set numwidth 16
select * from inc1_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.39.46.000000 PM 12723361982199
select * from inc3_scn1;
select * from inc3_scn1
*
ERROR at line 1:
ORA-00942: table or view does not exist
select * from inc1_scn2;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.42.59.000000 PM 12723361982600
select * from inc2_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 05.00.02.000000 PM 12723361984200
reset database to incarnation 3;
flashback database to scn 12723361984661;
如果我們使用recover database until scn的方式將inc3_scn1->inc2_inc1,必須把整個庫從備份裡恢復出來
RMAN> reset database to incarnation 2;
using target database control file instead of recovery catalog
database reset to incarnation 2
RMAN> recover database until scn 12723361984200;
Starting recover at 20150502 20:39:38
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=530 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 05/02/2015 20:39:39
RMAN-06556: datafile 1 must be restored from backup older than SCN 12723361984200
shutdown immediate
startup mount
reset database to incarnation 2;
--inc2_inc1時刻controlfile restore
RUN
{
SET UNTIL scn 12723361984200;
RESTORE CONTROLFILE to '/home/tstdb1/control.0503';
}
executing command: SET until clause
Starting restore at 20150503 04:48:39
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=530 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: restoring control file
output file name=/home/tstdb1/control.0503
channel ORA_DISK_1: reading from backup piece /oradata06/fra/TSTDB1/autobackup/2015_05_02/o1_mf_s_878662763_1jQIpIPZU_.bkp
channel ORA_DISK_1: piece handle=/oradata06/fra/TSTDB1/autobackup/2015_05_02/o1_mf_s_878662763_1jQIpIPZU_.bkp tag=TAG20150502T165923
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 20150503 04:48:41
--用剛才restore的controlfile啟動例項
cp /home/tstdb1/control.0503 /oradata06/testaaaaa/control01.ctl
cp /home/tstdb1/control.0503 /oradata06/testaaaaa/control02.ctl
shutdown immediate;
startup mount;
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
2 2 TSTDB1 2030654775 CURRENT 12723361982602 20150502 16:51:47
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -----------------
5 Full 3.18G DISK 00:00:38 20150502 16:39:13
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: INC1_SCN1
Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_02/o1_mf_nnndf_INC1_SCN1_1jQHevz44_.bkp
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ----------------- ----
1 Full 12723361982084 20150502 16:38:35 /oradata06/testaaaaa/system01.dbf
2 Full 12723361982084 20150502 16:38:35 /oradata06/testaaaaa/sysaux01.dbf
3 Full 12723361982084 20150502 16:38:35 /oradata06/testaaaaa/undotbs01.dbf
4 Full 12723361982084 20150502 16:38:35 /oradata06/testaaaaa/users01.dbf
5 Full 12723361982084 20150502 16:38:35 /oradata06/testaaaaa/ts0329_1.dbf
6 Full 12723361982084 20150502 16:38:35 /oradata06/testaaaaa/xdbts1.dbf
7 Full 12723357761339 20150315 09:56:23 /oradata06/testaaaaa/ts0212.dbf
8 Full 12723357761339 20150315 09:56:23 /oradata06/testaaaaa/ts0212_1.dbf
9 Full 12723361982084 20150502 16:38:35 /oradata06/testaaaaa/ts0422_1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -----------------
7 Full 3.18G DISK 00:00:40 20150502 16:42:16
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: INC1_SCN2
Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_02/o1_mf_nnndf_INC1_SCN2_1jQHpgOHF_.bkp
List of Datafiles in backup set 7
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ----------------- ----
1 Full 12723361982404 20150502 16:41:36 /oradata06/testaaaaa/system01.dbf
2 Full 12723361982404 20150502 16:41:36 /oradata06/testaaaaa/sysaux01.dbf
3 Full 12723361982404 20150502 16:41:36 /oradata06/testaaaaa/undotbs01.dbf
4 Full 12723361982404 20150502 16:41:36 /oradata06/testaaaaa/users01.dbf
5 Full 12723361982404 20150502 16:41:36 /oradata06/testaaaaa/ts0329_1.dbf
6 Full 12723361982404 20150502 16:41:36 /oradata06/testaaaaa/xdbts1.dbf
7 Full 12723357761339 20150315 09:56:23 /oradata06/testaaaaa/ts0212.dbf
8 Full 12723357761339 20150315 09:56:23 /oradata06/testaaaaa/ts0212_1.dbf
9 Full 12723361982404 20150502 16:41:36 /oradata06/testaaaaa/ts0422_1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -----------------
9 Full 3.18G DISK 00:00:38 20150502 16:44:38
BP Key: 9 Status: AVAILABLE Compressed: NO Tag: INC1_SCN3
Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_02/o1_mf_nnndf_INC1_SCN3_1jQHyHbG9_.bkp
List of Datafiles in backup set 9
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ----------------- ----
1 Full 12723361982670 20150502 16:44:00 /oradata06/testaaaaa/system01.dbf
2 Full 12723361982670 20150502 16:44:00 /oradata06/testaaaaa/sysaux01.dbf
3 Full 12723361982670 20150502 16:44:00 /oradata06/testaaaaa/undotbs01.dbf
4 Full 12723361982670 20150502 16:44:00 /oradata06/testaaaaa/users01.dbf
5 Full 12723361982670 20150502 16:44:00 /oradata06/testaaaaa/ts0329_1.dbf
6 Full 12723361982670 20150502 16:44:00 /oradata06/testaaaaa/xdbts1.dbf
7 Full 12723357761339 20150315 09:56:23 /oradata06/testaaaaa/ts0212.dbf
8 Full 12723357761339 20150315 09:56:23 /oradata06/testaaaaa/ts0212_1.dbf
9 Full 12723361982670 20150502 16:44:00 /oradata06/testaaaaa/ts0422_1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -----------------
12 Full 3.18G DISK 00:00:37 20150502 16:59:14
BP Key: 12 Status: AVAILABLE Compressed: NO Tag: INC2_SCN1
Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_02/o1_mf_nnndf_INC2_SCN1_1jQImZJME_.bkp
List of Datafiles in backup set 12
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ----------------- ----
1 Full 12723361984057 20150502 16:58:37 /oradata06/testaaaaa/system01.dbf
2 Full 12723361984057 20150502 16:58:37 /oradata06/testaaaaa/sysaux01.dbf
3 Full 12723361984057 20150502 16:58:37 /oradata06/testaaaaa/undotbs01.dbf
4 Full 12723361984057 20150502 16:58:37 /oradata06/testaaaaa/users01.dbf
5 Full 12723361984057 20150502 16:58:37 /oradata06/testaaaaa/ts0329_1.dbf
6 Full 12723361984057 20150502 16:58:37 /oradata06/testaaaaa/xdbts1.dbf
7 Full 12723357761339 20150315 09:56:23 /oradata06/testaaaaa/ts0212.dbf
8 Full 12723357761339 20150315 09:56:23 /oradata06/testaaaaa/ts0212_1.dbf
9 Full 12723361984057 20150502 16:58:37 /oradata06/testaaaaa/ts0422_1.dbf
reset database to incarnation 2; <----雖然list incarnation出來incarnation 2是作為Current incarnation,但這裡如果不顯式的指定,restore database會從incarnation 1(tag inc1_scn1)的備份restore,結果會是incarnation 3 scn=12723361984200,或者在下面的Run block裡指定from tag 'inc2_scn1'
RUN
{
SET UNTIL scn 12723361984200;
RESTORE DATABASE;
recover DATABASE;
}
executing command: SET until clause
Starting restore at 20150503 06:09:07
Starting implicit crosscheck backup at 20150503 06:09:07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=530 device type=DISK
Crosschecked 8 objects
Finished implicit crosscheck backup at 20150503 06:09:09
Starting implicit crosscheck copy at 20150503 06:09:09
using channel ORA_DISK_1
Finished implicit crosscheck copy at 20150503 06:09:09
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /oradata06/fra/TSTDB1/archivelog/2015_05_03/o1_mf_1_1_1jQxDKL6n_.arc
File Name: /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_5_1jQGOgOJZ_.arc
File Name: /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_2_1jQIqfl7C_.arc
File Name: /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_1_1jQIqfg-3_.arc
File Name: /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_1_1jQKKtU5p_.arc
File Name: /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_2_1jQKKtmNK_.arc
File Name: /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_3_1jQKKtsWK_.arc
File Name: /oradata06/fra/TSTDB1/autobackup/2015_05_02/o1_mf_s_878662763_1jQIpIPZU_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_05_02/o1_mf_s_878664409_1jQKLPC9n_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_05_02/o1_mf_s_878664913_1jQKpTIOZ_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_04_19/o1_mf_s_877454080_1j9zc3jDi_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_04_22/o1_mf_s_877708937_1jDgyjFjO_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_04_22/o1_mf_s_877710755_1jDif8HjD_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_04_22/o1_mf_s_877725293_1jDwBd9dF_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_04_23/o1_mf_s_877756602_1jENLnnhq_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_04_23/o1_mf_s_877775813_1jEfEqN8a_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_04_23/o1_mf_s_877777253_1jEh987ia_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_04_23/o1_mf_s_877787857_1jEqSkBN4_.bkp
File Name: /oradata06/fra/TSTDB1/autobackup/2015_05_03/o1_mf_s_878706155_1jQxDgMBW_.bkp
File Name: /oradata06/fra/TSTDB1/backupset/2015_05_02/o1_mf_nnndf_INC3_SCN1_1jQKmkAOc_.bkp
using channel ORA_DISK_1
skipping datafile 7; already restored to file /oradata06/testaaaaa/ts0212.dbf
skipping datafile 8; already restored to file /oradata06/testaaaaa/ts0212_1.dbf
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /oradata06/testaaaaa/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /oradata06/testaaaaa/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /oradata06/testaaaaa/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /oradata06/testaaaaa/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /oradata06/testaaaaa/ts0329_1.dbf
channel ORA_DISK_1: restoring datafile 00006 to /oradata06/testaaaaa/xdbts1.dbf
channel ORA_DISK_1: restoring datafile 00009 to /oradata06/testaaaaa/ts0422_1.dbf
channel ORA_DISK_1: reading from backup piece /oradata06/fra/TSTDB1/backupset/2015_05_02/o1_mf_nnndf_INC2_SCN1_1jQImZJME_.bkp
channel ORA_DISK_1: piece handle=/oradata06/fra/TSTDB1/backupset/2015_05_02/o1_mf_nnndf_INC2_SCN1_1jQImZJME_.bkp tag=INC2_SCN1 <---inc2_scn1
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 20150503 06:10:15
Starting recover at 20150503 06:10:15
using channel ORA_DISK_1
datafile 7 not processed because file is read-only
datafile 8 not processed because file is read-only
starting media recovery
archived log for thread 1 with sequence 1 is already on disk as file /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_1_1jQIqfg-3_.arc
archived log for thread 1 with sequence 2 is already on disk as file /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_2_1jQIqfl7C_.arc
archived log for thread 1 with sequence 3 is already on disk as file /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_3_1jQKKtsWK_.arc
archived log file name=/oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_1_1jQIqfg-3_.arc thread=1 sequence=1
archived log file name=/oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_2_1jQIqfl7C_.arc thread=1 sequence=2
archived log file name=/oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_3_1jQKKtsWK_.arc thread=1 sequence=3
media recovery complete, elapsed time: 00:00:01
Finished recover at 20150503 06:10:19
alter database open read only;
SQL> select * from scott.inc1_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.39.46.000000 PM 12723361982199
SQL> select * from scott.inc1_scn2;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 04.42.59.000000 PM 12723361982600
SQL> select * from scott.inc2_scn1;
C1 C2
--------------------------------------------------------------------------- ----------------
02-MAY-15 05.00.02.000000 PM 12723361984200
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
3 3 TSTDB1 2030654775 ORPHAN 12723361982201 20150502 17:26:40
2 2 TSTDB1 2030654775 CURRENT 12723361982602 20150502 16:51:47
上面的測試反映出flashback database logging開啟的情況下,使用flashback Database可以在任意兩個incarnation之間進行flashback,相比傳統的recover database的方法靈活性更佳,效率更高
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/53956/viewspace-1775990/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rman recover databaseDatabase
- 【RMAN】RMAN-20020: DATABASE INCARNATION NOT SETDatabase
- 線上進銷存軟體相比較傳統軟體的優勢
- 使用rman執行recover database 的時候出現RMAN-06054的錯誤提示Database
- How to restore and recover a database from an RMAN backup_881395.1RESTDatabase
- [Flashback]Flashback Database閃回資料庫實驗Database資料庫
- Oracle rman incarnationOracle
- recover database until cancel和 recover database區別Database
- 【Flashback】Flashback Database閃回資料庫功能實驗Database資料庫
- Recover_DatabaseDatabase
- Recover Database Fails with RMAN-06558 [ID 1185074.1]DatabaseAI
- clone database using RMAN without new incarnation (with NORESETLOGS)_1608236.1Database
- LIST INCARNATION OF DATABASE含義Database
- Flashback DatabaseDatabase
- recover database using backup controlfile與 recover database 的區別Database
- 使用Flashback Database進行資料表級別的定點恢復Database
- 使用RMAN duplicate對源庫的某個incarnation進行duplicate操作時遇到的問題
- oracle 10g跨越resetlogs恢復-incarnationOracle 10g
- recover database until timeDatabase
- flashback技術之---flashback databaseDatabase
- flashback database 方法Database
- 配置Flashback DatabaseDatabase
- Oracle Database 12C 新功能 rman RECOVER TABLE (文件 ID 2047644.1)OracleDatabase
- 相比傳統軟體服務,KGB知識圖譜的進階應用體現在哪裡
- 冷備手工完全恢復(recover database,recover tablespace,recover datafile)Database
- standby庫,在sqlplus下用recover standby database進行手工恢復SQLDatabase
- Oracle 10g FLASHBACK DATABASE 實驗記錄Oracle 10gDatabase
- flashback系列文章三(flashback database)Database
- rman 穿越incarnation恢復資料
- Physical Standby上開啟flashback database實驗日誌Database
- 關於flashback databaseDatabase
- How to enable the flashback database:Database
- 測試flashback databaseDatabase
- flashback database測試Database
- oracle flashback特性(3.2)--Flashback Database操作示例OracleDatabase
- flashback總結一之Flashback_DatabaseDatabase
- flashback database如何選擇需要應用的flashback logDatabase
- oracle實驗記錄Rman duplicate database(1)OracleDatabase