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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE DG從庫 Rman備份恢復Oracle
- Oracle 備份恢復篇之RMAN catalogOracle
- RMAN備份恢復技巧
- rman 增量備份恢復
- RMAN備份中發現壞塊
- RMAN備份異機恢復
- 【RMAN】Oracle12c以後rman 備份恢復命令參考Oracle
- RMAN備份恢復典型案例——資料檔案存在壞快
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- RMAN備份恢復效能優化優化
- RMAN備份與恢復測試
- RMAN修復壞塊
- Oracle asm磁碟損壞異常恢復OracleASM
- Windows oracle 11g rman備份恢復到linux系統WindowsOracleLinux
- rman備份異機恢復(原創)
- RMAN備份恢復典型案例——異機恢復未知DBID
- Oracle9i RMAN 的優缺點及RMAN 備份及恢復步驟Oracle
- RMAN備份恢復典型案例——ORA-00245
- 12 使用RMAN備份和恢復檔案
- 【RMAN】如果控制檔案損壞那麼如何恢復?恢復控制檔案的方式有哪幾種?
- 【RMAN】Oracle12c之後,rman備份Dataguard備端恢復可能出現邏輯錯誤Oracle
- ORACLE備份&恢復案例(轉)Oracle
- Oracle 備份 與 恢復 概述Oracle
- Oracle 備份恢復之 FlashbackOracle
- G017-ORACLE-MIGRATION-01 RMAN備份異機不完全恢復Oracle
- 備份恢復Lesson 04.Using the RMAN Recovery Catalog
- 深入解析:段頭塊損壞bbed異常恢復
- Oracle RMAN恢復測試Oracle
- ORACLE本地磁碟備份恢復Oracle
- 備份與恢復oracle_homeOracle
- oracle 增量備份恢復驗證Oracle
- Oracle 備份和恢復介紹Oracle
- ORACLE備份&恢復案例三(轉)Oracle
- ORACLE備份&恢復案例二(轉)Oracle
- 【RMAN】在多租戶環境下的RMAN備份及恢復
- Oracle RMAN備份實戰Oracle
- Oracle OCP(60):RMAN 備份Oracle
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- dg丟失歸檔,使用rman增量備份恢復