ishcat论 RMAN还原归档日志时应注意


fishcat论 RMAN还原归档日志时应注意

1、先备份归档
RMAN> BACKUP
2> FORMAT '/backup/arch_%T_%s_%p'
3> SKIP INACCESSIBLE
4> ARCHIVELOG ALL DELETE INPUT;

Starting backup at 09-JAN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=72 RECID=6 STAMP=804228455
input archived log thread=1 sequence=73 RECID=7 STAMP=804228639
input archived log thread=1 sequence=74 RECID=8 STAMP=804228749
channel ORA_DISK_1: starting piece 1 at 09-JAN-13
channel ORA_DISK_1: finished piece 1 at 09-JAN-13
piece handle=/backup/arch_20130109_6_1 tag=TAG20130109T045229 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/archive1/1_72_803945866.dbf RECID=6 STAMP=804228455
archived log file name=/archive1/1_73_803945866.dbf RECID=7 STAMP=804228639
archived log file name=/archive1/1_74_803945866.dbf RECID=8 STAMP=804228749
Finished backup at 09-JAN-13

2、上边看到备份了sequence72,73,74的归档文件然后还原72-74


RMAN> restore archivelog sequence between 72 and 74;

Starting restore at 09-JAN-13
using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=72
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=73
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=74
channel ORA_DISK_1: reading from backup piece /backup/arch_20130109_6_1
channel ORA_DISK_1: piece handle=/backup/arch_20130109_6_1 tag=TAG20130109T045229
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 09-JAN-13

3、再次备份归档

RMAN> BACKUP
2> FORMAT '/backup/arch_%T_%s_%p'
3> SKIP INACCESSIBLE
4> ARCHIVELOG ALL DELETE INPUT;

Starting backup at 09-JAN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=72 RECID=11 STAMP=804228908
input archived log thread=1 sequence=73 RECID=9 STAMP=804228907
input archived log thread=1 sequence=74 RECID=10 STAMP=804228907
input archived log thread=1 sequence=75 RECID=12 STAMP=804228962
channel ORA_DISK_1: starting piece 1 at 09-JAN-13
channel ORA_DISK_1: finished piece 1 at 09-JAN-13
piece handle=/backup/arch_20130109_7_1 tag=TAG20130109T045602 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/archive1/1_72_803945866.dbf RECID=11 STAMP=804228908
archived log file name=/archive1/1_73_803945866.dbf RECID=9 STAMP=804228907
archived log file name=/archive1/1_74_803945866.dbf RECID=10 STAMP=804228907
archived log file name=/archive1/1_75_803945866.dbf RECID=12 STAMP=804228962
Finished backup at 09-JAN-13

4、上面又出现了72-74的备份,查看rman备份集,又现惊人一幕72-74有重复

RMAN> list backup of archivelog all;


List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
6       27.90M     DISK        00:00:01     09-JAN-13      
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20130109T045229
        Piece Name: /backup/arch_20130109_6_1

  List of Archived Logs in backup set 6
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    72      585166     08-JAN-13 619196     09-JAN-13
  1    73      619196     09-JAN-13 619547     09-JAN-13
  1    74      619547     09-JAN-13 619601     09-JAN-13

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
7       27.91M     DISK        00:00:02     09-JAN-13      
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20130109T045602
        Piece Name: /backup/arch_20130109_7_1

  List of Archived Logs in backup set 7
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    72      585166     08-JAN-13 619196     09-JAN-13
  1    73      619196     09-JAN-13 619547     09-JAN-13
  1    74      619547     09-JAN-13 619601     09-JAN-13
  1    75      619601     09-JAN-13 619722     09-JAN-13

5、如果手动把还原的归档删除,那么在备份的时候会出现如下情况


RMAN> BACKUP
2> FORMAT '/backup/arch_%T_%s_%p'
3> SKIP INACCESSIBLE
4> ARCHIVELOG ALL DELETE INPUT;

Starting backup at 09-JAN-13
current log archived
using channel ORA_DISK_1
archived log /archive1/1_72_803945866.dbf not found or out of sync with catalog
skipping inaccessible file /archive1/1_72_803945866.dbf
archived log /archive1/1_73_803945866.dbf not found or out of sync with catalog
skipping inaccessible file /archive1/1_73_803945866.dbf
archived log /archive1/1_74_803945866.dbf not found or out of sync with catalog
skipping inaccessible file /archive1/1_74_803945866.dbf
RMAN-06061: WARNING: skipping archived log compromises recoverability
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=76 RECID=16 STAMP=804229192
channel ORA_DISK_1: starting piece 1 at 09-JAN-13
channel ORA_DISK_1: finished piece 1 at 09-JAN-13
piece handle=/backup/arch_20130109_8_1 tag=TAG20130109T045952 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/archive1/1_76_803945866.dbf RECID=16 STAMP=804229192
Finished backup at 09-JAN-13

备份语句中不加SKIP INACCESSIBLE则备份就会时失败

RMAN> BACKUP
2> FORMAT '/backup/arch_%T_%s_%p'
3> ARCHIVELOG ALL DELETE INPUT;

Starting backup at 09-JAN-13
current log archived
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 01/09/2013 05:00:17
RMAN-06059: expected archived log not found, loss of archived log compromises recoverability
ORA-19625: error identifying file /archive1/1_72_803945866.dbf
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3


6、遇到删除归档的情况就只能通过crosscheck archivelog处理了,处理后备份正常


RMAN> crosscheck archivelog all;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 device type=DISK
validation failed for archived log
archived log file name=/archive1/1_72_803945866.dbf RECID=15 STAMP=804229133
validation failed for archived log
archived log file name=/archive1/1_73_803945866.dbf RECID=13 STAMP=804229132
validation failed for archived log
archived log file name=/archive1/1_74_803945866.dbf RECID=14 STAMP=804229132
validation succeeded for archived log
archived log file name=/archive1/1_77_803945866.dbf RECID=17 STAMP=804229217
Crosschecked 4 objects


RMAN> delete expired archivelog all;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 device type=DISK
List of Archived Log Copies for database with db_unique_name C1
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - ---------
15      1    72      X 08-JAN-13
        Name: /archive1/1_72_803945866.dbf

13      1    73      X 09-JAN-13
        Name: /archive1/1_73_803945866.dbf

14      1    74      X 09-JAN-13
        Name: /archive1/1_74_803945866.dbf


Do you really want to delete the above objects (enter YES or NO)? yes
deleted archived log
archived log file name=/archive1/1_72_803945866.dbf RECID=15 STAMP=804229133
deleted archived log
archived log file name=/archive1/1_73_803945866.dbf RECID=13 STAMP=804229132
deleted archived log
archived log file name=/archive1/1_74_803945866.dbf RECID=14 STAMP=804229132
Deleted 3 EXPIRED objects


RMAN> BACKUP
2> FORMAT '/backup/arch_%T_%s_%p'
3> ARCHIVELOG ALL DELETE INPUT;

Starting backup at 09-JAN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=77 RECID=17 STAMP=804229217
input archived log thread=1 sequence=78 RECID=18 STAMP=804229976
channel ORA_DISK_1: starting piece 1 at 09-JAN-13
channel ORA_DISK_1: finished piece 1 at 09-JAN-13
piece handle=/backup/arch_20130109_9_1 tag=TAG20130109T051256 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/archive1/1_77_803945866.dbf RECID=17 STAMP=804229217
archived log file name=/archive1/1_78_803945866.dbf RECID=18 STAMP=804229976
Finished backup at 09-JAN-13
标签: 暂无标签
fishcat

写了 55 篇文章,拥有财富 503,被 40 人关注

oracle爱好者
转播转播 分享分享 分享淘帖
回复

使用道具

成为第一个吐槽的人

您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

意见
反馈