[20160223]檢查redo日誌的完整性.txt

dbhelper發表於2016-02-25

[20160223]檢查redo日誌的完整性.txt

--在論壇裡問的問題:
http://www.itpub.net/thread-2053302-1-1.html

1.直接檢查dump logfile 後面加入引數validate。

SYS@book> @ &r/logfile
GROUP# THREAD# SEQUENCE#       BYTES BLOCKSIZE MEMBERS ARC STATUS     FIRST_CHANGE# FIRST_TIME          NEXT_CHANGE# NEXT_TIME           GROUP# STATUS     TYPE       MEMBER                        IS_
------ ------- --------- ----------- --------- ------- --- ---------- ------------- ------------------- ------------ ------------------- ------ ---------- ---------- ----------------------------- ---
     1       1       382    52428800       512       1 YES INACTIVE      1.3223E+10 2016-02-22 11:09:33   1.3223E+10 2016-02-22 22:00:13      1            ONLINE     /mnt/ramdisk/book/redo01.log  NO
     2       1       383    52428800       512       1 YES INACTIVE      1.3223E+10 2016-02-22 22:00:13   1.3223E+10 2016-02-22 22:36:19      2            ONLINE     /mnt/ramdisk/book/redo02.log  NO
     3       1       384    52428800       512       1 NO  CURRENT       1.3223E+10 2016-02-22 22:36:19   2.8147E+14                          3            ONLINE     /mnt/ramdisk/book/redo03.log  NO

SYS@book> alter system dump logfile '/mnt/ramdisk/book/redo03.log' validate;
System altered.

2.使用DBMS_HM包:

BEGIN
   DBMS_HM.RUN_CHECK
   (
      check_name   => 'Redo Integrity Check'
     ,run_name     => 'redo_check'
     ,input_params => 'SCN_TEXT=0'
   );
END;
/

--可以加入scn_text 表示從某個scn開始。

SYS@book> select dbms_hm.get_run_report('redo_check') from dual;
DBMS_HM.GET_RUN_REPORT('REDO_CHECK')
-----------------------------------------------------------------
Basic Run Information
Run Name                     : redo_check
Run Id                       : 4221
Check Name                   : Redo Integrity Check
Mode                         : MANUAL
Status                       : COMPLETED
Start Time                   : 2016-02-23 11:31:10.753766 +08:00
End Time                     : 2016-02-23 11:31:12.387839 +08:00
Error Encountered            : 0
Source Incident Id           : 0
Number of Incidents Created  : 0
Input Paramters for the Run
SCN_TEXT=0
Run Findings And Recommendations

--如何刪除,僅僅知道使用adrci:
adrci> show hm_run -p "RUN_ID=4261"
ADR Home = /u01/app/oracle/diag/rdbms/book/book:
*************************************************************************
**********************************************************
HM RUN RECORD 1
**********************************************************
   RUN_ID                        4261
   RUN_NAME                      redo_check1
   CHECK_NAME                    Redo Integrity Check
   NAME_ID                       4
   MODE                          0
   START_TIME                    2016-02-23 11:34:27.605690 +08:00
   RESUME_TIME                   <NULL>
   END_TIME                      2016-02-23 11:34:29.116844 +08:00
   MODIFIED_TIME                 2016-02-23 11:34:35.227078 +08:00
   TIMEOUT                       0
   FLAGS                         0
   STATUS                        5
   SRC_INCIDENT_ID               0
   NUM_INCIDENTS                 0
   ERR_NUMBER                    0
   REPORT_FILE                   /u01/app/oracle/diag/rdbms/book/book/hm/HMREPORT_redo_check1.hm
1 rows fetched

adrci> select * from HM_RUN where run_id=4261;

ADR Home = /u01/app/oracle/diag/rdbms/book/book:
*************************************************************************
RUN_ID RUN_NAME     CHECK_NAME           NAME_ID  MODE  START_TIME                        RESUME_TIME END_TIME                          MODIFIED_TIME                     TIMEOUT FLAGS STATUS SRC_INCIDENT_ID NUM_INCIDENTS ERR_NUMBER REPORT_FILE
------ ------------ -------------------- -------- ----- --------------------------------- ----------- --------------------------------- --------------------------------- ------- ----- ------ --------------- ------------- ---------- ----------------------------------------------------------------
4261   redo_check1  Redo Integrity Check 4        0     2016-02-23 11:34:27.605690 +08:00             2016-02-23 11:34:29.116844 +08:00 2016-02-23 11:34:35.227078 +08:00 0       0     5      0               0             0          /u01/app/oracle/diag/rdbms/book/book/hm/HMREPORT_redo_check1.hm
1 rows fetched

adrci> delete  from HM_RUN where run_id=4261;
1 Row Deleted

adrci> commit ;
Transaction Committed

adrci> select * from HM_RUN where run_id=4261;
ADR Home = /u01/app/oracle/diag/rdbms/book/book:
*************************************************************************
0 rows fetched

3. 使用rman的validate:

RMAN> validate archivelog sequence 4830;

Starting validate at 2016-02-23 14:50:18
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting validation of archived log
channel ORA_DISK_1: specifying archived log(s) for validation
input archived log thread=1 sequence=4830 RECID=1626 STAMP=904574667
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
List of Archived Logs
=====================
Thrd Seq     Status Blocks Failing Blocks Examined Name
---- ------- ------ -------------- --------------- ---------------
1    4830    OK     0              67              /u01/app/oracle11g/archivelog/1_4830_798551880.dbf
Finished validate at 2016-02-23 14:50:21

--理論講這個不能對redo 的STATUS=CURRENT驗證。不過可以作為一種補充方式。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8494287/viewspace-1994329/,如需轉載,請註明出處,否則將追究法律責任。

相關文章