

dbv file='+DATAC1/DBM/DATAFILE/tbs_bffl_0566.dbf'


检查发现存在870988 871208两个坏块,可以通过rman继续查询坏块信息:
RMAN>backup validate datafile 721;

RMAN VALIDATE后,错误信息会记录到v$database_block_corruption视图中,查询vdatabase_block_corruption视图:
select * from v$database_block_corruption;

可看到有两个坏块,通过dba_extents查看坏块上的对象是什么
SELECT * FROM dba_extentsWHERE file_id = &AFNand &BL between block_id AND block_id + blocks - 1;
问题到这里有个疑问,这个数据库有灾备环境,正常来说11g之后如果有灾备,可以自行修复坏块,为什么没自动修复呢?查询官网资料:https://docs.oracle.com/cd/E18283_01/server.112/e17022/manage_ps.htm#SBYDB00707,以下摘自官网说明:
9.2.1.5 Automatic Repair of Corrupt Data Blocks
A physical standby database operating in real-time query mode can also be used to repair corrupt data blocks in a primary database. If possible, any corrupt data block encountered when a primary database is accessed is automatically replaced with an uncorrupted copy of that block from a physical standby database operating in real-time query mode. Note that for this to work, the standby database must be synchronized with the primary database.
If a corrupt data block is discovered on a physical standby database, the server attempts to automatically repair the corruption by obtaining a copy of the block from the primary database if the following database initialization parameters are configured on the standby database:
The parameter is configured with a list and a parameter is configured for the primary database
LOG_ARCHIVE_CONFIGDG_CONFIGLOG_ARCHIVE_DEST_nor
The parameter is configured and its value contains an Oracle Net service name for the primary database
FAL_SERVER
If automatic repair is not possible, an error is returned.ORA-1578
总结起来就是
主库出现坏块自动用备库的块拷贝修复,要求有下:
standby 库需要 using current logfile。
备库出现坏块自动用主库的块修复,要求如下:
The LOG_ARCHIVE_CONFIG 参数配置了DG_CONFIG列表,且 LOG_ARCHIVE_DEST_n parameter is configured for the primary database ,或者:备库配置了 FAL_SERVER 指向主库。
经过检查发现adg配置不满足要求因此无法自动修复。由于客户生产端rman备份好久没成功,因此从灾备备份相应文件传输到主库修复。
2.灾备端备份相应数据文件
backup datafile 721 format '/u01/app/oracle/rmanbk/721,bak';

scp传输到主库。
3.主库修复
rman>catalog start with '/u01/app/oracle/rmanbk';rman>blockrecover datafile 721 block 870988 from backupset;rman>blockrecover datafile 721 block 871208 from backupset;

dbv检查:
dbv file='+DATAC1/DBM/DATAFILE/tbs_bffl_0566.dbf'

至此修复完成,本次就分享到这里,如有不对,请指正!




