[20160202]crosscheck archivelog all.txt

lfree發表於2016-02-02

[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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章