bj-jn 发表于 2014-3-14 16:17:53

请教rman异地恢复报ORA-01113和ORA-01110错误的疑问

rman异地恢复报ORA-01113和ORA-01110
版本:10.2.0.5 64bit

以下步骤为restore数据文件之后的操作:
1.源库执行restore database preview summary确认恢复起点与终点scn
RMAN> restore database preview summary;
Media recovery start SCN is 2719124707Recovery must be done beyond SCN 2719644733 to clear data files fuzziness
Finished restore at 14-MAR-14

2.确认恢复终点的日志号
SQL> select sequence#,first_change#,next_change# from v$archived_log where 2719644733 between first_change# and next_change#;

SEQUENCE# FIRST_CHANGE# NEXT_CHANGE#
---------- ------------- ------------
      2431    2719642578   2719646068

3.恢复数据库到指定的日志序列号2433(第一次是恢复到日志序列号2431没成功,然后不断继续应用日志)
SQL> select open_mode from v$database;

OPEN_MODE
----------
Mounted

SQL> recover database using backup controlfile;
ORA-00279: change 2719649541 generated at 03/13/2014 11:28:17 needed for thread 1
ORA-00289: suggestion : /crmbak/oracle/arch/1_2433_841081370.dbf
ORA-00280: change 2719649541 for thread 1 is in sequence #2433


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00279: change 2719652978 generated at 03/13/2014 11:32:19 needed for thread 1
ORA-00289: suggestion : /crmbak/oracle/arch/1_2434_841081370.dbf
ORA-00280: change 2719652978 for thread 1 is in sequence #2434
ORA-00278: log file '/crmbak/oracle/arch/1_2433_841081370.dbf' no longer needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled

4.查询是否消除文件的模糊性
SQL> select file#,checkpoint_change#,fuzzy from v$datafile_header;

     FILE# CHECKPOINT_CHANGE# FUZ
---------- ------------------ ---
         1         2719652978 NO
         2         2719652978 NO
         3         2719652978 NO
         4         2719652978 NO
         5         2719652978 NO




SQL> select file#,checkpoint_change# from v$datafile;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1         2719652978
         2         2719652978
         3         2719652978
         4         2719652978
         5         2719652978




5.resetlogs方式打开数据库报错。。
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery if it was restored from backup, or END
BACKUP if it was not
ORA-01110: data file 1: '/crmbak/oracle/oradata/ORCL/system01.dbf'

6.使用RMAN不完全恢复成功
RMAN> run {
2> set until logseq 2437;
3> recover database;
4> alter database open resetlogs;
5> }

executing command: SET until clause
using target database control file instead of recovery catalog

Starting recover at 14-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

starting media recovery

archive log filename=/crmbak/oracle/arch/1_2434_841081370.dbf thread=1 sequence=2434
archive log filename=/crmbak/oracle/arch/1_2435_841081370.dbf thread=1 sequence=2435
archive log filename=/crmbak/oracle/arch/1_2436_841081370.dbf thread=1 sequence=2436
media recovery complete, elapsed time: 00:00:32
Finished recover at 14-MAR-14

database opened


以下是我的疑问,虚心请教各位,谢谢!
1.是不是只要超过restore database preview summary命令返回的终点scn就一定可以消除文件的模糊性,比如本例中的SCN2719644733是在日志序列号2431中,此时通过数据字典查询时fuzzy=no,但是我在恢复到2431后仍然不能打开数据库
2.sqlplus中的recover database using backup controlfile的方式和rman中不完全恢复效果是等价的吗,从我的实验感觉前者老是报错,而后者执行一次就成功了。

Liu Maclean(刘相兵 发表于 2014-3-16 21:21:13

FYI


RMAN> restore database preview summary;

Starting restore at 16-MAR-14
using channel ORA_DISK_1


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
4       B  F  A DISK        16-MAR-14       1       1       NO         TAG20140316T091633


List of Archived Log Copies
Key     Thrd Seq     S Low Time  Name
------- ---- ------- - --------- ----
8       1    14      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_14_9lc91qjc_.arc
9       1    15      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_15_9lc9229h_.arc
10      1    16      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_16_9lc925b8_.arc
11      1    17      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_17_9lc925cn_.arc
12      1    18      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_18_9lc928b1_.arc
13      1    19      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_19_9lc928cj_.arc
14      1    20      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_20_9lc92cdm_.arc
15      1    21      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_21_9lc92cht_.arc
16      1    22      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_22_9lc92gbm_.arc
17      1    23      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_23_9lc92gdy_.arc
18      1    24      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_24_9lc92kbb_.arc
19      1    25      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_25_9lc92kcp_.arc
20      1    26      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_26_9lc92nbp_.arc
21      1    27      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_27_9lc92nd6_.arc
22      1    28      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_28_9lc92qb8_.arc
23      1    29      A 16-MAR-14 /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_29_9lc92qcg_.arc
Media recovery start SCN is 656230
Recovery must be done beyond SCN 656230 to clear data files fuzziness
Finished restore at 16-MAR-14


SQL> select sequence#,first_change#,next_change# from v$archived_log where 656230 between first_change# and next_change#;

SEQUENCE# FIRST_CHANGE# NEXT_CHANGE#
---------- ------------- ------------
        14        656226       656233

SQL>  recover database using backup controlfile;
ORA-00279: change 656230 generated at 03/16/2014 09:16:33 needed for thread 1
ORA-00289: suggestion :
/s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_14_9lc91qjc_.arc
ORA-00280: change 656230 for thread 1 is in sequence #14


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00279: change 656233 generated at 03/16/2014 09:16:39 needed for thread 1
ORA-00289: suggestion :
/s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_15_9lc9229h_.arc
ORA-00280: change 656233 for thread 1 is in sequence #15
ORA-00278: log file
'/s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_14_9lc91qjc_.arc
' no longer needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL>
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery if it was restored from backup, or END
BACKUP if it was not
ORA-01110: data file 1:
'/s01/oradata/MACLEAN/datafile/o1_mf_system_9jyby238_.dbf'


SQL>  select file#,checkpoint_change#,fuzzy from v$datafile_header;

     FILE# CHECKPOINT_CHANGE# FUZZY
---------- ------------------ ---------
         1             656233 NO
         2             656233 NO
         3             656233 NO
         4             656233 NO
         5             656233 NO
                 
                 
                 
                 

RMAN>            run {
2>  set until scn 656233;
3>  recover database;
4>  alter database open resetlogs;
5>  }

executing command: SET until clause
using target database control file instead of recovery catalog

Starting recover at 16-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=159 devtype=DISK

starting media recovery

archive log thread 1 sequence 15 is already on disk as file /s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_15_9lc9229h_.arc
archive log filename=/s01/flash_recovery_area/MACLEAN/archivelog/2014_03_16/o1_mf_1_15_9lc9229h_.arc thread=1 sequence=15
media recovery complete, elapsed time: 00:00:02
Finished recover at 16-MAR-14

database opened

Liu Maclean(刘相兵 发表于 2014-3-16 21:21:51

2.sqlplus中的recover database using backup controlfile的方式和rman中不完全恢复效果是等价的吗

==>不能的,见我给出的例子

bj-jn 发表于 2014-3-17 17:31:09

Liu Maclean(刘相兵 发表于 2014-3-16 21:21 static/image/common/back.gif
2.sqlplus中的recover database using backup controlfile的方式和rman中不完全恢复效果是等价的吗

==>不 ...

感谢刘大,你的例子中有个疑问,sequece为14的next_change#为656233,而恢复到序列号14即可消除模糊性且rman脚本中设置了set until scn 656233,为什么oracle还要恢复到15号日志才终止恢复呢?
页: [1]
查看完整版本: 请教rman异地恢复报ORA-01113和ORA-01110错误的疑问