Oracle数据库REDO损坏ora-00333修复手札
admin
2023-06-07 12:01:20
0次

1.   事情起因

接到电话,周日意外断电,数据库起不了,报REDO CRASH,ora-00333错误。

相关环境如下:RAC oracle_11.2.0.3,无备份,开归档。

2 处理

一到现场,既然对方没有备份,那就做一个冷备份咯;oracle 11g嘛,把asm里datafile,logfile,controlfile(如果有必要spfile.ora)copy出来就可以了。拼的sql 如下:

select 'cp '||name ||' /databak/datafile/' fromv$datafile union

select 'cp '||member||' /databak/logfile/' from v$logfile union
select 'cp '||name ||' /databak/controlfile/' fromv$controlfile;

转到grid用户下,asmcmd,执行就可以了。时间嘛,那就得看你的数据文件大小和存储的IO速度了。

2.1修改隐含参数

由于有了冷备,可以参数(如果没冷备,改这个参数,那再后面就没那个砖家来陪你玩了)

SQL>create pfile=’/databak/pfile.ora’ from spfile;


修改pfile.ora,增加如下部分

_allow_resetlogs_corruption=TRUE

*.undo_management='MANUAL'

*.rollback_segments='SYSTEM'

可能有人要问,你resetlogs,关undo啥事,但通常事情是这样,redo出问题了,那就意味着有事务没提交完,那undo必然不一致,所以干脆把undo也改了吧。

2.2 启库

改完了,重启咯

SQL>shutdown immediate;

SQL>startup mount pfile=’/databak/pfile.ora’

SQL>RECOVERDATABASE until cancel;

这时数据库会提示你输入下一个logseq,这里没有,直接输cancel;这里你会很高兴的看到那个坏的redo被清掉了,可以欢呼了,起来了,但是世界是非富多彩地,马上就把你的高兴打破:

ORA-01555caused by SQL statement below (SQL ID: 4krwuz0ctqxdt, SCN: 0x0db2.73a0c8cd):
select ctime,mtime, stime from obj$ where obj# = :1
Errors in file/oracle/app/oracle/diag/rdbms/oradb/oradb1/trace/jmrk1_ora_4608.trc:
Errors in file/oracle/app/oracle/diag/rdbms/oradb/oradb1/trace/jmrk1_ora_4364.trc:
ORA-00704:bootstrap process failure
ORA-00704:bootstrap process failure
ORA-00604:error occurred at recursive SQL level 1
ORA-01555:snapshot too old: rollback segment number 20 with name"_SYSSMU20_3214617278$" too small

这里一看,似乎和undo有关系,但看官莫急,仔细看一下

select ctime,mtime, stime from obj$ where obj# = :1这个语句好眼熟,不是初始化最早的语句么,那估计SCN有问题了。

SQL>Selectcurrent_scn from v$database;
-------------------------------------------------------------------
0

为0.HOHO.

这里用两种方法来解决啰:

1设置10046trace

SQL> oradebug setmypid
Statement processed.
SQL> oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12
Statement processed.
SQL> oradebug TRACEFILE_NAME

2 oradebugpoke推进scn

3设置隐含参数_minimum_giga_scn

我这里采用第三种:

selectksppinm,ksppdesc from x$ksppi   whereksppinm like '%giga%'
KSPPINM                        KSPPDESC
---------------------------------------------------------------------------
_minimum_giga_scn              Minimum SCN to start with in 2^30units
selectto_char(checkpoint_change#,'99999999999999') from v$database;
TO_CHAR(CHECKPO---------------
 15060095276784
selectdistinct(to_char(checkpoint_change#,'99999999999999'))  from v$datafile_header;
(TO_CHAR(CHECKP
---------------
 15060095276784
SQL> select15060095276784/1024/1024/1024 from dual; 
15060095276784/1024/1024/1024
-----------------------------
                   14025.8067



修改pfile改修改:

_minimum_giga_scn=14026

现次启动数据库,顺利open,但有一堆JOB报错,估计掉电时正在跑JOB.也就解释了为啥周日掉电也会把数据库redo 搞垮。

SQL> alter system setjob_queue_processes=0;

导出全部做一个逻辑导出咯。

expdp system/systemdirectory=full dumpfile=dump_%u.dmp logfile=export.log full=y parallel=4

导出时也报了一个错,说回滚段不可用,忘了把undo改成真正的undo了,

SQL> create undotablespace  undotbs3 datafile'+ordata(datafile)' size 8G;

修改pfile,改成成undotbs3;再次重启,OK。

2.3 MOS _ALLOW_RESETLOGS_CORRUPTION说明

DB_Parameter _ALLOW_RESETLOGS_CORRUPTION

========================================

 

This documentation has been preparedavoiding the mention of the complex

structures from the code and to simply givean insight to the 'damage it could

cause'. The usage of this parameter leads to an in-consistent Database with no

other alternative but to rebuild thecomplete Database.  This parameter could

be used when we realize that there are nostardard options available and are

convinced that the customer understands theimplications of using the Oracle's

secret parameter.  The factors to be considered are ;--

 

1. Customer does not have a good backup.

2. A lot of time and money has beeninvested after the last good backup and    

  there is no possibility for reproduction of the lost data.

3. The customer has to be ready to exportthe full database and import it    

  back after creating a new one.

4. There is no 100% guarantee that by usingthis parameter the database would

  come up.

5. Oracle does not support the databaseafter using this parameter for      

  recovery.   

6. ALL OPTIONS including the ones mentionedin the action part of the error  

  message have been tried.

简单点来说,就是_ALLOW_RESETLOGS_CORRUPTION这个参数没有100%保证,你redo坏了能用他来OPEN库的,并且了用了这个后不支持恢复了(rman),仅仅支持export.

3总结:

  没啥好说的,有运气成份在里面,如果datafile block有环块那就更麻烦了,如果坏了一片也就没得完了,没事还是不要玩掉电吧,把UPS电池时间弄长一点,加个停电报警,省了一片心,再就是有空建个dataguard吧。


相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...