DBA实践---坏块处理

        前不久维护的数据库出现坏块情况,由于磁盘阵列掉电造成数据库无法启动,接到任务以后首先进行了启动,发现在mount至open阶段时出现坏块错误,进入alert log进行查看,发现如下错误:

ORA-00604: error occurred at recursive SQL level 1
ORA-01578: ORACLE data block corrupted (file # 1024, block # 39177)
ORA-01110: data file 1: '/dev/rvsopsystem'
这个数据库由于是属于生产库的IP段,但是在遇到故障时仅仅属于待上线的状态,也就是测试阶段,也正是因为如此,不是归档模式,也没有任何备份,但是这个数据库已经在测试阶段经历了小半年,如果不能解决这个问题的话,将会造成开发人员这半年的幸苦工作化为泡影,这也意味这责任重大,因此网上随意搜索到的文章是不敢随便进行尝试的,要是因此使问题扩大就不好了。这个时候求助于support.oracle.com 是一个不错的选择,毕竟是交了钱的,不用浪费阿。
support.oracle.com 提交了SR,由于够格,所以紧迫度是1级,因此印度佬回复的速度还算不错。刚开始印度佬一再表示,最好也最简单最妥善的办法就是restore 然后 recovery。但是没有备份这条路肯定是走不通阿。于是我就询问是否有其他内部的方式。第一个印度佬给了一种解决办法 如下:
1.set ORACLE_SID
2. $ rman target / nocatalog
3. run {
allocate channel d1 type disk;
backup check logical validate database;
release channel d1;
}
4. Execute the script
create table segment_corrupted (owner varchar2(10), segment_name varchar2(50), segment_type varchar(20));
truncate table segment_corrupted;
set serveroutput on

declare
nrows number;
badsegs number;
begin
badsegs:=0;
nrows:=0;
for i in (select file#,block# from v$database_block_corruption) loop
begin
insert into segment_corrupted select owner, segment_name, segment_type from dba_extents where file_id=i.file# and i.block# between block_id and block_id + blocks -1;
end;
nrows:=nrows+1;
end loop;
commit;
if nrows>0 then
dbms_output.put_line('List of segments affected by corruption');
end if;
for i in (select distinct owner, segment_name, segment_type from segment_corrupted) loop
dbms_output.put_line(i.segment_type||' '||i.owner||'.'||i.segment_name);
badsegs:=badsegs+1;
end loop;
dbms_output.put_line('Total blocks corrupted: '||to_char(nrows)||'. Total segments affected: '||to_char(badsegs));
end;
/
5. select * from v$database_block_corruption;
但是因为数据库无法open,因此第四步骤就无法进行下去了。
继续问吧,印度佬换了一个人叫做Miguel 他给出了如下方法:
Please do the following:
1. Shutdown the instance
2. set the the following in the pfile
event="10513 trace name context forever, level 2"
3. startup restrict
4. Please find the object belonging the file block
SELECT tablespace_name, segment_type, owner, segment_name, partition_name FROM dba_extents WHERE file_id = 1 and 39177 between block_id AND block_id + blocks - 1;

2- Analyze the failing object
If the object is a table
ANALYZE TABLE . VALIDATE STRUCTURE CASCADE;
if that gives errors, please execute the following too:
ANALYZE TABLE . VALIDATE STRUCTURE;
可惜的是,还是在open时出现问题,无法open:
SQL> startup restrict
ORACLE instance started.

Total System Global Area 3.1457E+10 bytes
Fixed Size 2141552 bytes
Variable Size 3003122320 bytes
Database Buffers 2.8437E+10 bytes
Redo Buffers 14635008 bytes
Database mounted.
ORA-00604: error occurred at recursive SQL level 1
ORA-01578: ORACLE data block corrupted (file # 1024, block # 39177)
ORA-01110: data file 1: '/dev/rvsopsystem'
}
继续反馈结果,印度佬以为我没有设置 10513 events,要求我提交alert log,于是我马上upload alert log,这次回复的人又换成了  Rodica ,貌似这个人经验要丰富些。最后按照他给出的方式 成功open数据库:
1. startup mount
2. alter system set events '10231 trace name context forever, level 10';
3. alter system set db_block_checking=medium;
4. alter database open
数据库open之后,进行了检查,发现只有system表空间出现了坏块,其他的表空间都没有问题,于是exp所有非oracle用户的数据,问题告一段落。接下来想必大家也都知道,重新建一个库 然后把数据导入到新库,删除这个问题库就可以了。至此问题得到解决。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12216142/viewspace-701239/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12216142/viewspace-701239/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值