ITPub博客

首页 > 数据库 > Oracle > [20160202]crosscheck archivelog all.txt

[20160202]crosscheck archivelog all.txt

原创 Oracle 作者:lfree 时间:2016-02-02 15:44:54 0 删除 编辑

[20160202]crosscheck archivelog all.txt

--当使用crosscheck archivelog all检查时注意一个细节,通过例子来说明:

1.环境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

RMAN> list archivelog all;

List of Archived Log Copies for database with db_unique_name BOOK
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
294     1    309     A 2016-02-01 05:00:22
        Name: /u01/app/oracle/archivelog/book/1_309_896605872.dbf

295     1    310     A 2016-02-01 22:00:15
        Name: /u01/app/oracle/archivelog/book/1_310_896605872.dbf


$ cd /u01/app/oracle/archivelog/book/
$ ll
total 89164
-rw-r----- 1 oracle oinstall 44703744 2016-02-01 22:00:16 1_309_896605872.dbf
-rw-r----- 1 oracle oinstall 46494208 2016-02-01 22:13:55 1_310_896605872.dbf

--仅仅存在2个备份,改名1个archive log:
$ mv 1_309_896605872.dbf 1_309_896605872.dbf_xxx

2.测试:
--备份archive log:
RMAN> backup archivelog all  format '/home/oracle/backup/archive_%u' ;

Starting backup at 2016-02-02 15:37:53
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 02/02/2016 15:37:54
RMAN-06059: expected archived log not found, loss of archived log compromises recoverability
ORA-19625: error identifying file /u01/app/oracle/archivelog/book/1_309_896605872.dbf
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

RMAN> crosscheck archivelog all ;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=123 device type=DISK
validation failed for archived log
archived log file name=/u01/app/oracle/archivelog/book/1_309_896605872.dbf RECID=294 STAMP=902700016
validation succeeded for archived log
archived log file name=/u01/app/oracle/archivelog/book/1_310_896605872.dbf RECID=295 STAMP=902700835
validation succeeded for archived log
archived log file name=/u01/app/oracle/archivelog/book/1_311_896605872.dbf RECID=296 STAMP=902763474
Crosschecked 3 objects

--可以发现校验/u01/app/oracle/archivelog/book/1_309_896605872.dbf RECID=294失败。而这个时候接着执行:

RMAN> backup archivelog all  format '/home/oracle/backup/archive_%u' ;
Starting backup at 2016-02-02 15:39:48
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=310 RECID=295 STAMP=902700835
input archived log thread=1 sequence=311 RECID=296 STAMP=902763474
input archived log thread=1 sequence=312 RECID=297 STAMP=902763588
channel ORA_DISK_1: starting piece 1 at 2016-02-02 15:39:49
channel ORA_DISK_1: finished piece 1 at 2016-02-02 15:39:50
piece handle=/home/oracle/backup/archive_25qsu525 tag=TAG20160202T153948 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2016-02-02 15:39:50

--可以发现这个时候备份成功,但是漏掉了1_309_896605872.dbf.也就是讲当做了crosscheck archivelog all 后,已经表示那些文件不存在,这样才解决
--问题前已经漏掉了一些备份。

3.改名回来:
$ mv 1_309_896605872.dbf_xxx 1_309_896605872.dbf

RMAN> list archivelog all;

List of Archived Log Copies for database with db_unique_name BOOK
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
294     1    309     X 2016-02-01 05:00:22
        Name: /u01/app/oracle/archivelog/book/1_309_896605872.dbf

295     1    310     A 2016-02-01 22:00:15
        Name: /u01/app/oracle/archivelog/book/1_310_896605872.dbf

296     1    311     A 2016-02-01 22:13:55
        Name: /u01/app/oracle/archivelog/book/1_311_896605872.dbf

297     1    312     A 2016-02-02 15:37:53
        Name: /u01/app/oracle/archivelog/book/1_312_896605872.dbf

--注意: S=X.

RMAN> crosscheck archivelog all ;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=123 device type=DISK
validation succeeded for archived log
archived log file name=/u01/app/oracle/archivelog/book/1_309_896605872.dbf RECID=294 STAMP=902700016
validation succeeded for archived log
archived log file name=/u01/app/oracle/archivelog/book/1_310_896605872.dbf RECID=295 STAMP=902700835
validation succeeded for archived log
archived log file name=/u01/app/oracle/archivelog/book/1_311_896605872.dbf RECID=296 STAMP=902763474
validation succeeded for archived log
archived log file name=/u01/app/oracle/archivelog/book/1_312_896605872.dbf RECID=297 STAMP=902763588
Crosschecked 4 objects


RMAN> list archivelog all;

List of Archived Log Copies for database with db_unique_name BOOK
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
294     1    309     A 2016-02-01 05:00:22
        Name: /u01/app/oracle/archivelog/book/1_309_896605872.dbf

295     1    310     A 2016-02-01 22:00:15
        Name: /u01/app/oracle/archivelog/book/1_310_896605872.dbf

296     1    311     A 2016-02-01 22:13:55
        Name: /u01/app/oracle/archivelog/book/1_311_896605872.dbf

297     1    312     A 2016-02-02 15:37:53
        Name: /u01/app/oracle/archivelog/book/1_312_896605872.dbf

--这样才恢复正常。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-1985656/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2466
  • 访问量
    6275387