从数据库日志中发现疑似坏块
Sun Feb 5 03:25:03 2012
Hex dump of (file 192, block 429183) in trace file /app/oracle/admin/YDPT/udump/ydpt1_ora_1081724.trc
Corrupt block relative dba: 0x30068c7f (file 192, block 429183)
Fractured block found during backing up datafile
Data in bad block:
type: 6 format: 2 rdba: 0x30068c7f
last change scn: 0x001e.7ed50c39 seq: 0x1 flg: 0x0
执行全库扫描,确认是否存在坏块
登入天翼数据库主机执行如下命令
$ rman target /
RMAN> BACKUP VALIDATE DATABASE;
如果要加快速度,可以改为四通道扫描
$ cat /oradata/dypt/arch1/hp/crman.sh
rman target lgto/lgto@YDPT1 << EOF > ./rman.logs
run {
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
backup blocks all check logical validate database;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
}
该脚本只对数据库进行读操作,不会对数据造成影响,但在执行期间会占用较多的IO
扫描完成后,退出rman,执行如下命令查询是否存在坏块
$sqlplus “/as sysdba”
SQL> select * from v$database_block_corruption;
查询结果是空值,则表示数据库没有存在坏块,如果查询发现有坏块,则需要对坏块进行修复。
若存在坏块,则进行坏块修复
修复坏块命令如下:
$ rman target /
RMAN> blockrecover datafile 9 block 59 from backupset;
以上命令表示修复的是datafile9的block59,具体的修复内容则根据当晚扫描的情况确定。
检查坏块修复情况
RMAN> run {
2> allocate channel t1 type disk;
3> backup blocks all check logical validate datafile 117;
4> release channel t1;
5> }
如果坏块在索引上,需要重建
阅读(283) | 评论(0) | 转发(0) |