2 cases to recover standby after primary open resetlogs:
It's supported by oracle:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/manage_ps.htm#i1026480
| If the standby database. . . | Then. . . | Perform these steps. . . |
|---|---|---|
| Has not applied redo data past the new resetlogs SCN (past the start of the new branch of redo data) | Redo Apply automatically takes the new branch of redo. | No manual intervention is necessary. The MRP automatically resynchronizes the standby database with the new branch of redo data. |
| Has applied redo data past the new resetlogs SCN (past the start of the new branch of redo data) and Flashback Database is enabled on the standby database | The standby database is recovered in the future of the new branch of redo data. |
The MRP automatically resynchronizes the standby database with the new branch. |
| Has applied redo data past the new resetlogs SCN (past the start of the new branch of redo data) and Flashback Database is not enabled on the standby database | The primary database has diverged from the standby on the indicated primary database branch. | Re-create the physical standby database following the procedures in Chapter 3. |
| Is missing intervening archived redo log files from the new branch of redo data | The MRP cannot continue until the missing log files are retrieved. | Locate and register missing archived redo log files from each branch. |
| Is missing archived redo log files from the end of the previous branch of redo data. | The MRP cannot continue until the missing log files are retrieved. | Locate and register missing archived redo log files from the previous branch. |
首先是incarnation的概念,原本打算自己讲解一下来着,发现已有前辈研究过,以供各位学习:
http://space.itpub.net/22235/viewspace-348212
这块信息是记录在controlfile内的,所以如果你是重建controlfile那么这块信息肯定会丢失。
可以通过oradebug dump controlf 3来查看这段内容:
*************************************************************************** INCARNATION RECORDS *************************************************************************** (size = 56, compat size = 56, section max = 292, section in-use = 3, last-recid= 3, old-recno = 1, last-recno = 3) (extent = 1, blkno = 141, numrecs = 292) Earliest record: RECID #1 Recno 1 Record timestamp Resetlogs scn and time scn: 0x0000.00000001 10/15/07 10:08:59 Previous Resetlogs scn and time scn: 0x0000.00000000 01/01/88 00:00:00 Incarnation (parent inc#, flag)=(0, 0) Latest record: RECID #3 Recno 3 Record timestamp Resetlogs scn and time scn: 0x0000.00152a4f 09/25/09 17:00:20 Previous Resetlogs scn and time scn: 0x0000.000d8624 01/02/09 12:17:36 Incarnation (parent inc#, flag)=(2, 2) |
通过rman,list incarnation可以查看:
数据库原型列表
DB 关键字 Inc 关键字 DB 名 DB ID STATUS 重置 SCN 重置时间
------- ------- -------- ---------------- --- ---------- ----------
1 1 O11 1712983965 PARENT 1 15-10月-07
2 2 O11 1712983965 PARENT 886308 02-1月 -09
3 3 O11 1712983965 CURRENT 1387087 25-9月 -09
OK, 言归正传。
1. managed standby: 这种最简单,什么都不用做,standby会自动恢复过resetlog点。
2. normal physical standby using manually recovery: 需要copy primary的controlfile
首先是1的测试结果:
这次测试没有做任何操作,从库能够自动恢复过resetlog点6314837,注意这里不同的地方是open resetlog之后scn号还是连续的,普遍意义上应该是scn+1为新的sequence1的first_scn.个人感觉是oracle为了managed standby能够正常恢复而故意为之。没有测试,有机会再测一遍。
For managed standby database, it can fix this automatically:
In primary, we open resetlogs:
SQL> select SEQUENCE#, FIRST_CHANGE#, NEXT_CHANGE# from v$archived_log;
SEQUENCE# FIRST_CHANGE# NEXT_CHANGE#
---------- ------------- ------------
992 6304959 6305379
993 6305379 6306626
994 6306626 6314837
994 6306626 6314837 =>此处open resetlogs, 但是下一个log的scn还是连续的,所以standby无需任何操作能够继续恢复。
1 6314837 6314971
1 6314837 6314971
2 6314971 6314978
2 6314971 6314978
In standby, no action needed:
RFS[3]: Archived Log: '/oracle/GBPGW/data01/ALEX/archive/ALEX_994.1_686522382_arc' Sat Sep 26 04:35:05 2009 Media Recovery Log /oracle/GBPGW/data01/ALEX/archive/ALEX_994.1_686522382_arc Sat Sep 26 04:35:21 2009 Redo Shipping Client Connected as PUBLIC -- Connected User is Valid RFS[4]: Assigned to RFS process 10752 RFS[4]: Identified database type as 'physical standby' RFS[4]: New Archival REDO Branch: 698560439 Current: 686522382 RFS[4]: Archived Log: '/oracle/GBPGW/data01/ALEX/archive/ALEX_1.1_698560439_arc' RFS[4]: New Archival REDO Branch(resetlogs_id): 698560439 Prior: 686522382 RFS[4]: Archival Activation ID: 0x75a48f2d Current: 0x7574942a RFS[4]: Effect of primary database OPEN RESETLOGS RFS[4]: Managed Standby Recovery process is active New incarnation branch detected in ArchiveLog, filename /oracle/GBPGW/data01/ALEX/archive/ALEX_1.1_698560439_arc Inspection of file changed rdi from 1 to 2 Setting recovery target incarnation to 2 Sat Sep 26 04:35:21 2009 RFS[4]: Incarnation entry added for Branch(resetlogs_id): 698560439 (ALEX) Sat Sep 26 04:35:22 2009 Setting recovery target incarnation to 2 Sat Sep 26 04:35:28 2009 MRP0: Incarnation has changed! Retry recovery... Sat Sep 26 04:35:28 2009 Errors in file /oracle/GBPGW/data01/ALEX/trace/bdump/alex_mrp0_3081.trc: ORA-19906: recovery target incarnation changed during recovery Recovery interrupted! Recovered data files to a consistent state at change 6314836 Sat Sep 26 04:35:31 2009 Errors in file /oracle/GBPGW/data01/ALEX/trace/bdump/alex_mrp0_3081.trc: ORA-19906: recovery target incarnation changed during recovery Sat Sep 26 04:35:40 2009 RFS[3]: Archived Log: '/oracle/GBPGW/data01/ALEX/archive/ALEX_2.1_698560439_arc' Sat Sep 26 04:35:51 2009 Managed Standby Recovery not using Real Time Apply Media Recovery apply resetlogs offline range for datafile 1, incarnation : 0 Media Recovery apply resetlogs offline range for datafile 2, incarnation : 0 Media Recovery apply resetlogs offline range for datafile 3, incarnation : 0 Media Recovery apply resetlogs offline range for datafile 4, incarnation : 0 Media Recovery apply resetlogs offline range for datafile 5, incarnation : 0 Media Recovery apply resetlogs offline range for datafile 6, incarnation : 0 Media Recovery apply resetlogs offline range for datafile 7, incarnation : 0 Media Recovery apply resetlogs offline range for datafile 8, incarnation : 0 parallel recovery started with 3 processes Sat Sep 26 04:35:52 2009 Waiting for all non-current ORLs to be archived... Media Recovery Log /oracle/GBPGW/data01/ALEX/archive/ALEX_1.1_698560439_arc Media Recovery Log /oracle/GBPGW/data01/ALEX/archive/ALEX_2.1_698560439_arc |
测试2的结果:
name sequence resetlog start_scn end_scn C:ORACLECSHANORADATAO11ARCHIVEARC00041_0675087456.001 41 886308 1380849 1384557 C:ORACLECSHANORADATAO11ARCHIVEARC00042_0675087456.001 42 886308 1384557 1386235 C:ORACLECSHANORADATAO11ARCHIVEARC00043_0675087456.001 43 886308 1386235 1386333 C:ORACLECSHANORADATAO11ARCHIVEARC00044_0675087456.001 44 886308 1386333 1387086 |
After primary did an open resetlogs(the second time):
primary:
数据库原型列表
DB 关键字 Inc 关键字 DB 名 DB ID STATUS 重置 SCN 重置时间
------- ------- -------- ---------------- --- ---------- ----------
1 1 O11 1712983965 PARENT 1 15-10月-07
2 2 O11 1712983965 PARENT 886308 02-1月 -09
3 3 O11 1712983965 CURRENT 1387087 25-9月 -09
standby:
RMAN> list incarnation;
使用目标数据库控制文件替代恢复目录
数据库原型列表
DB 关键字 Inc 关键字 DB 名 DB ID STATUS 重置 SCN 重置时间
------- ------- -------- ---------------- --- ---------- ----------
1 1 O11 1712983965 PARENT 1 15-10月-07
2 2 O11 1712983965 CURRENT 886308 02-1月 -09
SQL> select SEQUENCE#, FIRST_CHANGE#, NEXT_CHANGE# from v$archived_log;
SEQUENCE# FIRST_CHANGE# NEXT_CHANGE#
---------- ------------- ------------
1 1387087 1388681
recoved standby until 1387086: => sequence 44 which is the latest archivelog before open resetlogs
SQL> select file#,RESETLOGS_CHANGE#,CHECKPOINT_CHANGE# from v$datafile_header;
FILE# RESETLOGS_CHANGE# CHECKPOINT_CHANGE#
---------- ----------------- ------------------
1 886308 1387086
2 886308 1387086
3 886308 1387086
4 886308 1387086
5 886308 1387086
copy controlfile from primary:
数据库原型列表
DB 关键字 Inc 关键字 DB 名 DB ID STATUS 重置 SCN 重置时间
------- ------- -------- ---------------- --- ---------- ----------
1 1 O11 1712983965 PARENT 1 15-10月-07
2 2 O11 1712983965 PARENT 886308 02-1月 -09
3 3 O11 1712983965 CURRENT 1387087 25-9月 -09
SQL> select file#,RESETLOGS_CHANGE#,CHECKPOINT_CHANGE# from v$datafile_header;
FILE# RESETLOGS_CHANGE# CHECKPOINT_CHANGE#
---------- ----------------- ------------------
1 886308 1387086
2 886308 1387086
3 886308 1387086
4 886308 1387086
5 886308 1387086
SQL> recover standby database until cancel;
ORA-00279: 更改 1387087 (在 09/25/2009 17:00:20 生成) 对于线程 1 是必需的
ORA-00289: 建议: C:ORACLECSHANORADATAO11ARCHIVEARC00001_0698518820.001
ORA-00280: 更改 1387087 (用于线程 1) 在序列 #1 中
after this:
SQL> select file#,RESETLOGS_CHANGE#,CHECKPOINT_CHANGE# from v$datafile_header;
FILE# RESETLOGS_CHANGE# CHECKPOINT_CHANGE#
---------- ----------------- ------------------
1 1387087 1387087
2 1387087 1387087
3 1387087 1387087
4 1387087 1387087
5 1387087 1387087
指定日志: {
auto
ORA-00279: 更改 1388681 (在 09/25/2009 17:13:28 生成) 对于线程 1 是必需的
ORA-00289: 建议: C:ORACLECSHANORADATAO11ARCHIVEARC00002_0698518820.001
ORA-00280: 更改 1388681 (用于线程 1) 在序列 #2 中
ORA-00278: 此恢复不再需要日志文件
'C:ORACLECSHANORADATAO11ARCHIVEARC00001_0698518820.001'
ORA-00308: 无法打开归档日志
'C:ORACLECSHANORADATAO11ARCHIVEARC00002_0698518820.001'
ORA-27041: 无法打开文件
OSD-04002: ???????
O/S-Error: (OS 2) The system cannot find the file specified
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21084389/viewspace-1027588/ ,如需转载,请注明出处,否则将追究法律责任。