Oracle standby的ORA-01578 ORA-01110 ORA-26040 坑爹的NOLOGGING

guocun09發表於2019-05-08

異常:

DB: Oracle 11.2.0.1 --版本夠low的

五一假期時給使用者DB做了switch over主備切換後,用了發現切換後新的主庫DB中報錯如下:

Wed May 08 09:44:14 2019
Errors in file /u01/product/diag/rdbms/new/orcl/trace/orcl_ora_100843.trc  (incident=50865):
ORA-01578: ORACLE 資料區塊損毀 (檔案編號 126, 區塊編號 4969)
ORA-01110: 資料檔 126: '/data/orcl/smt_idx01.dbf'
ORA-26040: 已使用 NOLOGGING 選項載入資料區塊

Incident details in: /u01/product/diag/rdbms/new/orcl/incident/incdir_50865/orcl_ora_100843_i50865.trc


========= Dump for incident 50865 (ORA 1578) ========

*** 2019-05-08 09:44:14.254
dbkedDefDump(): Starting incident default dumps (flags=0x2, level=3, mask=0x0)
----- Current SQL Statement for this session (sql_id=52s3v0xvc21j8) -----
SELECT
   ROWID, STATION_NUMBER, MACHINE_CODE, PRODUCT_NO,
   VER, EMP_NO, FEEDER_NO,
   KEY_PART_NO, WORK_TIME, SN,
   LINE_NAME, MO_NO, SIDE,
   LOT_NO, VENDOR, DATE_CODE,
   FEEDER_ID, KEY_PART_QTY, HH_PN,
   PACKED_QTY, MFG_PN, PKG_ID,
   CPL_ID, END_TIME, BOM_NO,
   CUST_PN, DIFFERENCE_QTY, USED_QTY
FROM SFISM4.R_SMT_LOG
Where
PKG_ID = 'VCI3011808R05ZI'


分析:

ORA-01578, ORA-01110 第一反應是有資料壞塊


使用DBV檢查壞塊

$dbv file=/data/orcl/smt_idx01.dbf BLOCKSIZE=16384
DBVERIFY: Release 11.2.0.1.0 - Production on Wed May 8 16:15:12 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
DBVERIFY - Verification starting : FILE = /data/orcl/smt_idx01.dbf
DBV-00201: Block, DBA 528482373, marked corrupt for invalid redo application
DBV-00201: Block, DBA 528482374, marked corrupt for invalid redo application
DBV-00201: Block, DBA 528482375, marked corrupt for invalid redo application

....


DBVERIFY - Verification complete

Total Pages Examined         : 294400
Total Pages Processed (Data) : 0
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 259171
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 19965
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 15264
Total Pages Marked Corrupt   : 3
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 2390574971 (2791.2390574971)

DBV-00201 意味著主庫到備庫中部分redo沒有應用到datafile,


檢查切換之前的主庫(現在的備庫) 果然datafile  '/data/orcl/smt_idx01.dbf' 沒有應用

SELECT NAME, UNRECOVERABLE_CHANGE# FROM V$DATAFILE
where UNRECOVERABLE_CHANGE# >0


此類問題通常是因為主庫中一些nologging的操作導致redo 沒能到備庫應用,

結合之前alert.log 的報錯“ ORA-26040: 已使用 NOLOGGING 選項載入資料區塊” ,基本確認了這個問題。

難道data guard 沒用開到force logging模式導致類似append 操作沒用同步?
select force_logging from v$database;

查詢 force_logging 為NO還真沒用啟用 force logging...


解決:

檢查 NOLOGGING影響 沒用同步datafile對應的segment:
select * from dba_extents
where file_id=126 and 4969 between block_id AND block_id + blocks - 1;

還好segment全部是index,rebuild index即可解決。

注:如果是table 或其它檔案需要對原主庫(現備庫)的datafile backup再至現主庫(原備庫)中還原恢復了。


最後,老生常談建立standby,一定記得開啟強制歸檔避免問題發生:

alter database force logging;


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

相關文章