Oracle塊損壞恢復(有rman備份)
資料庫shutdown immediate後,使用vi修改相應的資料檔案,或在rman狀態下使用blockrecover datafile 7 block 139 clear;--清除指定的塊,用來模擬資料檔案有壞塊。
重新啟動資料庫報錯:
SQL> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 939526256 bytes
Database Buffers 654311424 bytes
Redo Buffers 7360512 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '/data/oracle/oradata/payment/tbs_test01.dbf'
SQL>
Alert日誌檔案:
ALTER DATABASE OPEN
Errors in file /home/oracle/app/diag/rdbms/payment/payment/trace/payment_dbw0_28505.trc:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '/data/oracle/oradata/payment/tbs_test01.dbf'
ORA-27046: file size is not a multiple of logical block size
Additional information: 1
Errors in file /home/oracle/app/diag/rdbms/payment/payment/trace/payment_ora_28558.trc:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '/data/oracle/oradata/payment/tbs_test01.dbf'
ORA-1157 signalled during: ALTER DATABASE OPEN...
Hex dump of (file 7, block 138) in trace file /home/oracle/app/diag/rdbms/payment/payment/trace/payment_m000_512.trc
Corrupt block relative dba: 0x01c0008a (file 7, block 138)
Bad check value found during buffer read
Data in bad block:
type: 35 format: 2 rdba: 0x01c0008a
last change scn: 0x0000.00d01f21 seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x1f212301
check value in block header: 0xe533
computed block checksum: 0x6c6c
Reading datafile '/data/oracle/oradata/payment/tbs_test01.dbf' for corruption at rdba: 0x01c0008a (file 7, block 138)
Reread (file 7, block 138) found same corrupt data
Corrupt Block Found
TSN = 9, TSNAME = TBS_TEST
RFN = 7, BLK = 138, RDBA = 29360266
OBJN = -1, OBJD = 85609, OBJECT = TBS_TEST, SUBOBJECT =
SEGMENT OWNER = , SEGMENT TYPE = Temporary Segment
Errors in file /home/oracle/app/diag/rdbms/payment/payment/trace/payment_m000_512.trc (incident=23445):
ORA-01578: ORACLE data block corrupted (file # 7, block # 138)
ORA-01110: data file 7: '/data/oracle/oradata/payment/tbs_test01.dbf'
--塊校驗
RMAN> backup validate datafile 7;
Starting backup at 08-APR-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=14 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=52 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/data/oracle/oradata/payment/tbs_test01.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
7 FAILED 0 176 1280 13642832
File Name: /data/oracle/oradata/payment/tbs_test01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 1 897
Index 0 0
Other 5 207
validate found one or more corrupt blocks
See trace file /home/oracle/app/diag/rdbms/payment/payment/trace/payment_ora_568.trc for details
Finished backup at 08-APR-15
--檢視壞塊
SQL> select * from v$database_block_corruption;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO
---------- ---------- ---------- ------------------ ---------
7 138 1 0 CHECKSUM
7 2 1 3.7494E+13 CORRUPT
7 10 1 12635052 CORRUPT
7 275 1 13641438 CHECKSUM
7 1280 1 0 FRACTURED
7 120 1 12635272 CHECKSUM
--恢復指定的塊
RMAN> blockrecover datafile 7 block 275 from backupset;
Starting recover at 08-APR-15
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00007
channel ORA_DISK_1: reading from backup piece /home/oracle/app/flash_recovery_area/PAYMENT/backupset/2015_04_08/o1_mf_nnndf_TAG20150408T085803_bl8z8vr3_.bkp
channel ORA_DISK_1: piece handle=/home/oracle/app/flash_recovery_area/PAYMENT/backupset/2015_04_08/o1_mf_nnndf_TAG20150408T085803_bl8z8vr3_.bkp tag=TAG20150408T085803
channel ORA_DISK_1: restored block(s) from backup piece 1
channel ORA_DISK_1: block restore complete, elapsed time: 00:00:01
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 08-APR-15
RMAN>
ORA-27046: file size is not a multiple of logical block size
造成這個問題的原因一般是因為資料檔案從一個裸裝置DD或是FTP到了檔案系統,正好資料檔案的大小不是按ORACLE的block size的整數倍。
網上找到解決方法如下
把資料檔案resize到oracle的block size的整數倍
alter database datafile '
如果這裡的oracle的block size=8K,那麼這個value一定要是8的整數倍了.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28258625/viewspace-1725765/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 磁碟損壞造成RMAN備份檔案有壞塊的恢復案例
- 非系統表空間損壞,rman備份恢復
- 非系統資料檔案損壞,rman備份恢復
- 無備份的資料塊損壞恢復辦法 dbms_repairAI
- oracle RMAN 備份恢復總結Oracle
- oracle RMAN 備份恢復總結Oracle
- oracle rman備份恢復的例子Oracle
- 備份&恢復之十三:損壞全部控制檔案
- ORACLE DG從庫 Rman備份恢復Oracle
- 轉載:Oracle資料塊損壞恢復總結Oracle
- 備份&恢復之十二:損壞單個控制檔案
- RMAN備份恢復原理
- rman備份恢復-rman入門
- Oracle 備份恢復篇之RMAN catalogOracle
- oracle 10g RMAN備份及恢復Oracle 10g
- [記錄]oracle RMAN 備份恢復總結Oracle
- oracle實驗記錄 (恢復,備份-含壞塊資料檔案)Oracle
- 備份&恢復之十一:損壞當前聯機日誌
- 備份與恢復--資料檔案損壞或丟失
- RMAN備份與恢復之加密備份加密
- Oracle的RMAN備份恢復繼續,RMAN部分引數Oracle
- RMAN備份恢復典型案例——資料檔案存在壞快
- 備份與恢復--重建控制檔案後資料檔案損壞的恢復
- 使用RMAN恢復完全損壞的資料庫資料庫
- Oracle RMAN備份中對壞塊(corrupt block)的處理OracleBloC
- Oracle DG從庫 Rman備份恢復測試Oracle
- 【RMAN】Oracle11g備份恢復新特性Oracle
- Oracle資料庫備份與恢復之RMANOracle資料庫
- oracle實驗記錄 (恢復-rman增量備份)Oracle
- oracle rman備份驗證和備份/恢復進度監控Oracle
- 探索ORACLE之RMAN_07 磁碟損壞資料丟失恢復Oracle
- index損壞恢復Index
- 備份&恢復之十:損壞非當前聯機日誌
- rman備份恢復-rman恢復資料檔案測試
- 備份&恢復之八:RMAN備份歸檔模式下損壞(丟失)多個資料檔案,進行整個資料庫的恢復模式資料庫
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- Oracle asm磁碟損壞異常恢復OracleASM
- ORACLE中修復資料塊損壞Oracle