标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 kfed MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-01110 ORA-01555 ORA-01578 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (102)
- 数据库 (1,670)
- DB2 (22)
- MySQL (73)
- Oracle (1,532)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (21)
- ORA-xxxxx (159)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (14)
- ORACLE 21C (3)
- Oracle 23ai (7)
- Oracle ASM (65)
- Oracle Bug (8)
- Oracle RAC (52)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (560)
- Oracle安装升级 (91)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (78)
- PostgreSQL (18)
- PostgreSQL恢复 (6)
- SQL Server (27)
- SQL Server恢复 (8)
- TimesTen (7)
- 达梦数据库 (2)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (37)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (20)
-
最近发表
- ORA-600 krse_arc_complete.4
- Oracle 19c 202410补丁(RUs+OJVM)
- ntfs MFT损坏(ntfs文件系统故障)导致oracle异常恢复
- .mkp扩展名oracle数据文件加密恢复
- 清空redo,导致ORA-27048: skgfifi: file header information is invalid
- A_H_README_TO_RECOVER勒索恢复
- 通过alert日志分析客户自行对一个数据库恢复的来龙去脉和点评
- ORA-12514: TNS: 监听进程不能解析在连接描述符中给出的SERVICE_NAME
- ORA-01092 ORA-00604 ORA-01558故障处理
- ORA-65088: database open should be retried
- Oracle 19c异常恢复—ORA-01209/ORA-65088
- ORA-600 16703故障再现
- 数据库启动报ORA-27102 OSD-00026 O/S-Error: (OS 1455)
- .[metro777@cock.li].Elbie勒索病毒加密数据库恢复
- 应用连接错误,初始化mysql数据库恢复
- RAC默认服务配置优先节点
- Oracle 19c RAC 替换私网操作
- 监听报TNS-12541 TNS-12560 TNS-00511错误
- drop tablespace xxx including contents恢复
- Linux 8 修改网卡名称
标签归档:undo异常
模拟19c数据库root pdb undo异常恢复
对于19c在pdb情况下三种常见故障进行了模拟测试:
模拟19c数据库redo异常恢复
模拟19c数据库pdb undo异常恢复
模拟19c数据库root pdb undo异常恢复
模拟oracle 19c cdb模式下root pdb中undo丢失故障恢复
会话1,pdb中插入大量数据,未提交
SQL> alter session set container=pdb; Session altered. SQL> alter database open; Database altered. SQL> create user xff identified by oracle default tablespace users; grant dba to xff; conn xff/oracle@127.0.0.1/pdb create table t_xifenfei as select * from dba_objects; insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei; User created. SQL> Grant succeeded. SQL> Connected. SQL> Table created. SQL> 72351 rows created. SQL> 144702 rows created. SQL> 289404 rows created. SQL> 578808 rows created. SQL> 1157616 rows created. SQL> SQL> SQL>
会话2中root pdb模拟事务
[oracle@localhost ~]$ ss SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 16 16:56:01 2020 Version 19.5.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.5.0.0.0 SQL> SQL> SQL> conn system/oracle Connected. SQL> create table t_xifenfei tablespace users as select * from dba_objects; insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei; Table created. SQL> 72380 rows created. SQL> 144760 rows created. SQL> 289520 rows created. SQL> 579040 rows created. SQL> 1158080 rows created. SQL> SQL>
会话3 abort库并删除root pdb中undo文件
[oracle@localhost ~]$ ss SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 16 16:56:55 2020 Version 19.5.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.5.0.0.0 SQL> shutdown abort; ORACLE instance shut down. SQL> [oracle@localhost oradata]$ cd ORA19C [oracle@localhost ORA19C]$ ls control01.ctl control02.ctl pdb pdbseed redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf [oracle@localhost ORA19C]$ rm -rf undotbs01.dbf
启动数据库报ORA-01157 ORA-01110错误
SQL> alter database datafile 4 offline drop; Database altered. SQL> alter database open; Database altered. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB MOUNTED SQL> alter session set container=pdb; Session altered. SQL> alter database open; Database altered. SQL> conn / as sysdba Connected. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB READ WRITE NO SQL> SQL> select tablespace_name,segment_name,status from dba_rollback_segs; TABLESPACE_NAME SEGMENT_NAME STATUS ------------------------------ ------------------------------ -------------------------------- SYSTEM SYSTEM ONLINE UNDOTBS1 _SYSSMU1_1261223759$ NEEDS RECOVERY UNDOTBS1 _SYSSMU2_27624015$ NEEDS RECOVERY UNDOTBS1 _SYSSMU3_2421748942$ NEEDS RECOVERY UNDOTBS1 _SYSSMU4_625702278$ NEEDS RECOVERY UNDOTBS1 _SYSSMU5_2101348960$ NEEDS RECOVERY UNDOTBS1 _SYSSMU6_813816332$ NEEDS RECOVERY UNDOTBS1 _SYSSMU7_2329891355$ NEEDS RECOVERY UNDOTBS1 _SYSSMU8_399776867$ NEEDS RECOVERY UNDOTBS1 _SYSSMU9_1692468413$ NEEDS RECOVERY UNDOTBS1 _SYSSMU10_930580995$ NEEDS RECOVERY
本次测试比较幸运,虽然undo段状态为NEEDS RECOVERY,但是数据库直接open成功.实际生产情况,可能比这个要复杂很多
Oracle 12c undo异常处理—root pdb undo异常
在12c pdb环境中如果root pdb的undo文件异常,数据库该如何恢复呢?这篇文章模拟undo丢失的情况下进行恢复
模拟环境
三个会话,其中第一个会话对pdb1中的表进行操作,并且有事务未提交,第二个会话对pdb2进行操作,也未提交事务;第三个会话直接abort库,模拟突然库异常,然后删除root pdb下面的undo文件
--会话1 [oracle@ora1221 oradata]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.0.3 Production on Thu Jun 16 22:24:20 2016 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 2516582400 bytes Fixed Size 8260048 bytes Variable Size 671090224 bytes Database Buffers 1828716544 bytes Redo Buffers 8515584 bytes Database mounted. Database opened. SQL> SQL> SQL> SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 MOUNTED 4 PDB2 MOUNTED SQL> alter session set container=pdb1; Session altered. SQL> alter database open; Database altered. SQL> create user chf identified by oracle; User created. SQL> grant dba to chf; Grant succeeded. SQL> create table chf.t_xifenfei_p1 as 2 select * from dba_objects; Table created. SQL> insert into chf.t_xifenfei_p1 2 select * from dba_objects; 72427 rows created. SQL> select count(*) from chf.t_xifenfei_p1; COUNT(*) ---------- 144853 --会话2 [oracle@ora1221 ~]$ ss SQL*Plus: Release 12.2.0.0.3 Production on Thu Jun 16 22:34:01 2016 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.0.3 - 64bit Production SQL> alter session set container=pdb2; Session altered. SQL> alter database open; Database altered. SQL> create user chf identified by oracle; User created. SQL> grant dba to chf; Grant succeeded. SQL> create table chf.t_xifenfei_p2 2 as select * from dba_objects; Table created. SQL> delete from chf.t_xifenfei_p2; 72426 rows deleted. SQL> select count(*) from chf.t_xifenfei_p2; COUNT(*) ---------- 0 --会话3 [oracle@ora1221 ~]$ ss SQL*Plus: Release 12.2.0.0.3 Production on Thu Jun 16 22:36:16 2016 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.0.3 - 64bit Production SQL> shutdown abort ORACLE instance shut down. --删除cdb undo文件 [oracle@ora1221 orcl12c2]$ ls -ltr total 2040912 drwxr-x---. 2 oracle oinstall 4096 Jun 16 18:26 pdbseed drwxr-x---. 2 oracle oinstall 4096 Jun 16 18:27 pdb2 drwxr-x---. 2 oracle oinstall 4096 Jun 16 18:28 pdb1 -rw-r-----. 1 oracle oinstall 209715712 Jun 16 22:24 redo03.log -rw-r-----. 1 oracle oinstall 5251072 Jun 16 22:24 users01.dbf -rw-r-----. 1 oracle oinstall 34611200 Jun 16 22:25 temp01.dbf -rw-r-----. 1 oracle oinstall 849354752 Jun 16 22:35 system01.dbf -rw-r-----. 1 oracle oinstall 73408512 Jun 16 22:35 undotbs01.dbf -rw-r-----. 1 oracle oinstall 492838912 Jun 16 22:35 sysaux01.dbf -rw-r-----. 1 oracle oinstall 209715712 Jun 16 22:36 redo02.log -rw-r-----. 1 oracle oinstall 209715712 Jun 16 22:36 redo01.log -rw-r-----. 1 oracle oinstall 18726912 Jun 16 22:36 control02.ctl -rw-r-----. 1 oracle oinstall 18726912 Jun 16 22:36 control01.ctl [oracle@ora1221 orcl12c2]$ rm undotbs01.dbf [oracle@ora1221 orcl12c2]$ ls -l un* ls: cannot access un*: No such file or directory
启动数据库
由于有undo文件丢失数据库在启动的时候检测到文件丢失(ORA-01157),无法open,offline文件后依旧无法启动(ORA-00376)
[oracle@ora1221 orcl12c2]$ ss SQL*Plus: Release 12.2.0.0.3 Production on Thu Jun 16 22:51:21 2016 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to an idle instance. SQL> startup pfile='/tmp/pfile' ORACLE instance started. Total System Global Area 2516582400 bytes Fixed Size 8260048 bytes Variable Size 671090224 bytes Database Buffers 1828716544 bytes Redo Buffers 8515584 bytes Database mounted. ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl12c2/undotbs01.dbf' offline 数据文件 SQL> alter database datafile 4 offline ; alter database datafile 4 offline * ERROR at line 1: ORA-01145: offline immediate disallowed unless media recovery enabled SQL> alter database datafile 4 offline drop; Database altered. SQL> alter database open; alter database open * ERROR at line 1: ORA-00603: ORACLE server session terminated by fatal error ORA-01092: ORACLE instance terminated. Disconnection forced ORA-00604: error occurred at recursive SQL level 1 ORA-00376: file 4 cannot be read at this time ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl12c2/undotbs01.dbf' Process ID: 7547 Session ID: 16 Serial number: 56234
把undo_management修改为manual后启动库,依旧报ORA-00376
SQL> startup pfile='/tmp/pfile' mount; ORACLE instance started. Total System Global Area 2516582400 bytes Fixed Size 8260048 bytes Variable Size 671090224 bytes Database Buffers 1828716544 bytes Redo Buffers 8515584 bytes Database mounted. SQL> show parameter undo_management; NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ undo_management string MANUAL SQL> alter database open; alter database open * ERROR at line 1: ORA-00603: ORACLE server session terminated by fatal error ORA-01092: ORACLE instance terminated. Disconnection forced ORA-00604: error occurred at recursive SQL level 1 ORA-00376: file 4 cannot be read at this time ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl12c2/undotbs01.dbf' Process ID: 7981 Session ID: 16 Serial number: 56572
设置_corrupted_rollback_segments参数
SQL> startup pfile='/tmp/pfile' mount; ORACLE instance started. Total System Global Area 2516582400 bytes Fixed Size 8260048 bytes Variable Size 671090224 bytes Database Buffers 1828716544 bytes Redo Buffers 8515584 bytes Database mounted. SQL> show parameter _corrupted_rollback_segments; NAME TYPE ------------------------------------ ---------------------- VALUE ------------------------------ _corrupted_rollback_segments string _SYSSMU1_3200770482$, _SYSSMU2 _3597554035$, _SYSSMU3_2898427 493$, _SYSSMU4_670955920$, _SY SSMU5_1233449977$, _SYSSMU6_32 67641983$, _SYSSMU7_2822479342 $, _SYSSMU8_1645196706$, _SYSS MU9_3032014485$, _SYSSMU10_474 465626$ SQL> alter database open; Database altered.
通过设置_corrupted_rollback_segments参数之后,数据库正常启动,下面继续其他pdb
open pdb1
SQL> alter session set container=pdb1; Session altered. SQL> alter database open; Database altered. SQL> select count(*) from chf.t_xifenfei_p1; COUNT(*) ---------- 72426
pdb2 open
SQL> alter session set container=pdb2; Session altered. SQL> alter database open; Database altered. SQL> select count(*) from chf.t_xifenfei_p2; COUNT(*) ---------- 72426
至此数据库基本上恢复完成,但是看到的pdb里面两个测试表的数据和我们预测的有一定的偏差,看来cdb中的undo和pdb中的undo还是有一定的依赖关系.同时也说明了root的undo异常对于其他pdb的open最少在恢复上面影响不大.下一篇测试业务pdb中undo异常处理
记录一次系统回滚段坏块恢复
在上一篇中深入分析一次ORA-00314错误的数据库继续恢复,出现file 1 block 403和404等坏块,使得后面的恢复进一步写入了复杂境地.更加麻烦的是,这个库里面有一张核心表有40个字段,包括long,nvarchar2等一些字段,但是使用aul,dul,odu挖取都出现异常(表的行数正确,但是有些列的数据不能正常被挖出来),原因是该表中有特殊字段数据,被逼无赖只能继续拉库
数据库启动报错
SQL> startup mount pfile='c:\pfile.txt' ORACLE 例程已经启动。 Total System Global Area 452984832 bytes Fixed Size 1291120 bytes Variable Size 201329808 bytes Database Buffers 243269632 bytes Redo Buffers 7094272 bytes 数据库装载完毕。 SQL> recover database; 完成介质恢复。 SQL> alter database open; alter database open upgrade * 第 1 行出现错误: ORA-01092: ORACLE 实例终止。强制断开连接
查看alert日志
SMON: enabling cache recovery Fri May 16 22:49:53 2014 Hex dump of (file 1, block 404) in trace file c:\oracle\product\10.2.0\admin\interlib\udump\interlib_ora_2788.trc Corrupt block relative dba: 0x00400194 (file 1, block 404) Fractured block found during buffer read Data in bad block: type: 0 format: 0 rdba: 0x00000000 last change scn: 0x0000.00000000 seq: 0x0 flg: 0x00 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x00000000 check value in block header: 0x0 block checksum disabled Reread of rdba: 0x00400194 (file 1, block 404) found same corrupted data Fri May 16 22:49:55 2014 Errors in file c:\oracle\product\10.2.0\admin\interlib\udump\interlib_ora_2788.trc: ORA-00604: error occurred at recursive SQL level 1 ORA-01578: ORACLE data block corrupted (file # 1, block # 404) ORA-01110: data file 1: 'C:\ORADATA\INTERLIB\SYSTEM01.DBF' Error 604 happened during db open, shutting down database USER: terminating instance due to error 604
跟踪数据库启动过程
这里可以清晰的看到是因为block 404有坏块,数据库递归sql访问到该坏块报错,从而数据库无法继续open,对数据库启动过程做10046跟踪
PARSING IN CURSOR #2 len=148 dep=1 uid=0 oct=6 lid=0 tim=80533759 hv=3540833987 ad='2a6ce1ec' update undo$ set name=:2,file#=:3,block#=:4,status$=:5,user#=:6,undosqn=:7,xactsqn=:8,scnbas=:9,scnwrp=:10,inst#=:11,ts#=:12,spare1=:13 where us#=:1 END OF STMT PARSE #2:c=62500,e=211766,p=14,cr=85,cu=0,mis=1,r=0,dep=1,og=4,tim=80533755 BINDS #2: kkscoacd Bind#0 oacdty=01 mxl=32(09) mxlc=00 mal=00 scl=00 pre=00 oacflg=18 fl2=0001 frm=01 csi=852 siz=32 off=0 kxsbbbfp=2a6ceac2 bln=32 avl=09 flg=09 value="_SYSSMU1$" Bind#1 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9b7c bln=24 avl=02 flg=05 value=2 Bind#2 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9b58 bln=24 avl=02 flg=05 value=9 Bind#3 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9b34 bln=24 avl=02 flg=05 value=2 Bind#4 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9b10 bln=24 avl=02 flg=05 value=1 Bind#5 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9aec bln=24 avl=04 flg=05 value=13332 Bind#6 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9ac8 bln=24 avl=04 flg=05 value=24672 Bind#7 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9aa4 bln=24 avl=05 flg=05 value=47727002 Bind#8 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9a80 bln=24 avl=01 flg=05 value=0 Bind#9 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9a5c bln=24 avl=01 flg=05 value=0 Bind#10 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9a38 bln=24 avl=02 flg=05 value=1 Bind#11 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9a14 bln=24 avl=02 flg=05 value=1 Bind#12 oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00 oacflg=08 fl2=0001 frm=00 csi=00 siz=24 off=0 kxsbbbfp=099b9ba0 bln=22 avl=02 flg=05 value=1 WAIT #2: nam='db file sequential read' ela= 10794 file#=1 block#=404 blocks=1 obj#=-1 tim=80546515 Hex dump of (file 1, block 404) Dump of memory from 0x1FB9C000 to 0x1FB9E000 1FB9C000 00000000 00000000 00000000 00000000 [................] Repeat 286 times 1FB9D1F0 00000000 00000000 00000000 00000001 [................] 1FB9D200 0000A200 0001D831 00000000 05010000 [....1...........] 1FB9D210 00007F30 00000000 00000000 00000000 [0...............] 1FB9D220 00000000 00000000 00000000 00000000 [................] Repeat 221 times Corrupt block relative dba: 0x00400194 (file 1, block 404) Fractured block found during buffer read Data in bad block: type: 0 format: 0 rdba: 0x00000000 last change scn: 0x0000.00000000 seq: 0x0 flg: 0x00 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x00000000 check value in block header: 0x0 block checksum disabled Reread of rdba: 0x00400194 (file 1, block 404) found same corrupted data EXEC #2:c=0,e=45015,p=1,cr=1,cu=3,mis=1,r=0,dep=1,og=4,tim=80578919 ERROR #2:err=1578 tim=811723 ORA-00604: error occurred at recursive SQL level 1 ORA-01578: ORACLE data block corrupted (file # 1, block # 404) ORA-01110: data file 1: 'C:\ORADATA\INTERLIB\SYSTEM01.DBF' EXEC #1:c=328125,e=3468857,p=52,cr=619,cu=10,mis=0,r=0,dep=0,og=1,tim=82331842 ERROR #1:err=1092 tim=811898
dbv检测坏块
C:\oracle\product\10.2.0\db_1\BIN>dbv FILE = C:\ORADATA\INTERLIB\SYSTEM01.DBF DBVERIFY: Release 10.2.0.3.0 - Production on 星期一 5月 19 15:22:41 2014 Copyright (c) 1982, 2005, Oracle. All rights reserved. DBVERIFY - 开始验证: FILE = C:\ORADATA\INTERLIB\SYSTEM01.DBF 页 403 标记为损坏 Corrupt block relative dba: 0x00400193 (file 1, block 403) Bad header found during dbv: Data in bad block: type: 70 format: 1 rdba: 0x00030030 last change scn: 0x0000.3a6c2e79 seq: 0x0 flg: 0x00 spare1: 0x4c spare2: 0x45 spare3: 0x2 consistency value in tail: 0x00070000 check value in block header: 0x1 block checksum disabled 页 404 流入 - 很可能是介质损坏 Corrupt block relative dba: 0x00400194 (file 1, block 404) Fractured block found during dbv: Data in bad block: type: 0 format: 0 rdba: 0x00000000 last change scn: 0x0000.00000000 seq: 0x0 flg: 0x00 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x00000000 check value in block header: 0x0 block checksum disabled 页 498 流入 - 很可能是介质损坏 Corrupt block relative dba: 0x004001f2 (file 1, block 498) Fractured block found during dbv: Data in bad block: type: 6 format: 2 rdba: 0x004001f2 last change scn: 0x0000.02d7eb9d seq: 0x1 flg: 0x06 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x37290601 check value in block header: 0x6c5e computed block checksum: 0xc2b5 页 61078 流入 - 很可能是介质损坏 Corrupt block relative dba: 0x0040ee96 (file 1, block 61078) Fractured block found during dbv: Data in bad block: type: 6 format: 2 rdba: 0x0040ee96 last change scn: 0x0000.02d5cf11 seq: 0x1 flg: 0x06 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xa6e30601 check value in block header: 0x51d4 computed block checksum: 0xf572 页 61147 流入 - 很可能是介质损坏 Corrupt block relative dba: 0x0040eedb (file 1, block 61147) Fractured block found during dbv: Data in bad block: type: 6 format: 2 rdba: 0x0040eedb last change scn: 0x0000.02d7f7e6 seq: 0x1 flg: 0x06 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x6ed80601 check value in block header: 0x4ae8 computed block checksum: 0x893f 页 61502 流入 - 很可能是介质损坏 Corrupt block relative dba: 0x0040f03e (file 1, block 61502) Fractured block found during dbv: Data in bad block: type: 6 format: 2 rdba: 0x0040f03e last change scn: 0x0000.02d810dd seq: 0x1 flg: 0x06 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xaf4c0601 check value in block header: 0xd99b computed block checksum: 0xbf91 页 61989 流入 - 很可能是介质损坏 Corrupt block relative dba: 0x0040f225 (file 1, block 61989) Fractured block found during dbv: Data in bad block: type: 6 format: 2 rdba: 0x0040f225 last change scn: 0x0000.02d80f65 seq: 0x1 flg: 0x06 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xdff70601 check value in block header: 0x4e2a computed block checksum: 0xd092 DBVERIFY - 验证完成 检查的页总数: 62720 处理的页总数 (数据): 37740 失败的页总数 (数据): 0 处理的页总数 (索引): 7021 失败的页总数 (索引): 0 处理的页总数 (其它): 1784 处理的总页数 (段) : 0 失败的总页数 (段) : 0 空的页总数: 16169 标记为损坏的总页数: 7 流入的页总数: 5 最高块 SCN : 316431787 (0.316431787) C:\oracle\product\10.2.0\db_1\BIN>
根据我们的经验,对数据库启动影响很大的,主要是403,404,498三个坏块,在10201的库中查询得出结论(403,404是rollback,498是seq$).那现在我们可以理解在数据库启动过程中需要undo$表中相关列信息,但是由于rollback对应的block有坏块,使得数据库无法操作update操作,从而无法正常启动.
SQL> SELECT OWNER, SEGMENT_NAME, SEGMENT_TYPE, TABLESPACE_NAME, A.PARTITION_NAME 2 FROM DBA_EXTENTS A 3 WHERE FILE_ID = &FILE_ID 4 AND &BLOCK_ID BETWEEN BLOCK_ID AND BLOCK_ID + BLOCKS - 1; 输入 file_id 的值: 1 原值 3: WHERE FILE_ID = &FILE_ID 新值 3: WHERE FILE_ID = 1 输入 block_id 的值: 404 原值 4: AND &BLOCK_ID BETWEEN BLOCK_ID AND BLOCK_ID + BLOCKS - 1 新值 4: AND 404 BETWEEN BLOCK_ID AND BLOCK_ID + BLOCKS - 1 OWNER ------------------------------ SEGMENT_NAME -------------------------------------------------------------------------------- SEGMENT_TYPE TABLESPACE_NAME PARTITION_NAME ------------------ ------------------------------ ------------------------------ SYS SYSTEM ROLLBACK SYSTEM
常用方法
设置event跳过坏块,使用隐含参数屏蔽回滚段
_corrupted_rollback_segments= _SYSSMU1$, _SYSSMU2$, _SYSSMU3$, _SYSSMU4$, _SYSSMU5$, _SYSSMU6$, _SYSSMU7$, _SYSSMU8$, _SYSSMU9$, _SYSSMU10$, _SYSSMU11$, _SYSSMU12$, _SYSSMU13$, _SYSSMU14$, _SYSSMU15$, _SYSSMU16$, _SYSSMU17$, _SYSSMU18$, _SYSSMU19$, _SYSSMU20$ undo_management = MANUAL event = 10231 trace name context forever, level 10, 10232 trace name context forever, level 10, 10233 trace name context forever, level 10 SQL> startup mount pfile='c:\pfile.txt' ORACLE 例程已经启动。 Total System Global Area 452984832 bytes Fixed Size 1291120 bytes Variable Size 201329808 bytes Database Buffers 243269632 bytes Redo Buffers 7094272 bytes 数据库装载完毕。 SQL> recover database; 完成介质恢复。 SQL> alter database open; alter database open upgrade * 第 1 行出现错误: ORA-01092: ORACLE 实例终止。强制断开连接
这里可以看出来,数据库在update undo$的时候因为rollback异常无法通过屏蔽回滚段和跳过坏块的方法来解决。因为是system undo系统块,想法就是从别的相同版本库中拷贝一个相同位置块过来试试看。
拷贝数据块
C:\oracle\product\10.2.0\db_1\BIN>bbed listfile=c:\bbed.txt Password: BBED: Release 2.0.0.0.0 - Limited Production on Mon May 19 10:47:14 2014 (c) Copyright 2000 Oracle Corporation. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> set blocksize 8192 BLOCKSIZE 8192 BBED> set mode edit MODE Edit BBED> copy file 2 block 405 to file 1 block 405 File: C:\ORADATA\INTERLIB\SYSTEM01.DBF (1) Block: 405 Offsets: 0 to 511 Dba:0x00400195 ------------------------------------------------------------------------ 02a20000 94014000 d4c50800 00000104 60890000 00000500 36000000 66004545 0000e81f 401fc81e 201ea01d 481da01c f81b501b e81a801a d8197019 08196018 f8179017 e8168016 1816c815 68152815 d8145814 f8137813 18139812 3812f811 a8116811 18119810 3810b80f 580fd80e 780e380e e80da80d 580d180d c80c480c f00b480b e00a380a d0092809 c0087008 1008d007 80074007 f006b006 60062006 d0052805 a8046004 2004d003 d802b401 6001e000 00000000 0a001800 0c001400 1300ff1d 78100000 78100000 02000000 00000000 0a165f45 00002e00 0201e71e 94014000 4c004300 03020100 2b05c000 5e15c000 0c001800 0c002000 29000100 82230000 82230000 02000000 00000000 0a163347 00003200 02014500 94014000 58004600 03022100 f30ec000 f50ec000 00000000 00000000 03000000 0d000e00 0e000e00 06c52008 4b5a2705 c51e3337 5f06c520 084b5a27 06c51f4c 28393906 c520084b 5a2706c5 273e0355 0d000000 ff165f43 0a001800 0c001400 0d004000 82230000 82230000 02000000 00000000 0a163346 00003200 02014500 94014000 58004500 03020100 f30ec000 f80ec000 00000000 00000000 06c52008 4b5a2705 c4201c60 5f000000 0c001800 0c002000 2a000100 82230000 82230000 02000000 00000000 0a163345 00003200 02014500 94014000 58004400 03022100 f30ec000 <32 bytes per line> BBED> sum apply Check value for File 1, Block 405: current = 0x8960, required = 0x8960
重新启动数据库
SQL> startup mount pfile='c:\pfile.txt' ORACLE 例程已经启动。 Total System Global Area 452984832 bytes Fixed Size 1291120 bytes Variable Size 201329808 bytes Database Buffers 243269632 bytes Redo Buffers 7094272 bytes 数据库装载完毕。 SQL> recover database; 完成介质恢复。 SQL> alter database open; alter database open upgrade * 第 1 行出现错误: ORA-01092: ORACLE 实例终止。强制断开连接
分析alert日志
Mon May 19 10:54:05 2014 Recovery of Online Redo Log: Thread 1 Group 3 Seq 13 Reading mem 0 Mem# 0: C:\ORADATA\INTERLIB\REDO03.LOG Block recovery stopped at EOT rba 13.5.16 Block recovery completed at rba 13.5.16, scn 0.316366922 Doing block recovery for file 1 block 9 Block recovery from logseq 13, block 3 to scn 316366921 Mon May 19 10:54:05 2014 Recovery of Online Redo Log: Thread 1 Group 3 Seq 13 Reading mem 0 Mem# 0: C:\ORADATA\INTERLIB\REDO03.LOG Block recovery completed at rba 13.5.16, scn 0.316366922 Mon May 19 10:54:07 2014 Errors in file c:\oracle\product\10.2.0\admin\interlib\udump\interlib_ora_1208.trc: ORA-00604: 递归 SQL 级别 1 出现错误 ORA-00607: 当更改数据块时出现内部错误 ORA-00600: 内部错误代码, 参数: [4193], [102], [58], [], [], [], [], [] Error 604 happened during db open, shutting down database USER: terminating instance due to error 604
这里是因为我们拷贝了一个其他库的undo段过来,然后数据库启动的时候首先使用到该undo块和rollback segment header 不匹配,所以通过通过修改undo header 来修复,使用bbed修改段头信息,因为在以前的文章中描述过,在此不再重复,具体参考:使用bbed解决ORA-00607/ORA-00600[4194]故障启动数据库
SQL> startup mount pfile='c:\pfile.txt' ORACLE 例程已经启动。 Total System Global Area 452984832 bytes Fixed Size 1291120 bytes Variable Size 201329808 bytes Database Buffers 243269632 bytes Redo Buffers 7094272 bytes 数据库装载完毕。 SQL> recover database; 完成介质恢复。 SQL> alter database open upgrade; 数据库已更改。
但是因为seq$有坏块,数据库启动后,如果使用非系统认证登录数据库会报如下错误
C:\oracle\product\10.2.0\db_1\BIN>sqlplus interlib/oracle SQL*Plus: Release 10.2.0.3.0 - Production on 星期一 5月 19 16:29:29 2014 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. ERROR: ORA-00600: 内部错误代码, 参数: [6807], [AUDSES$], [144], [], [], [], [], [] 请输入用户名: C:\oracle\product\10.2.0\db_1\BIN>sqlplus / as sysdba SQL*Plus: Release 10.2.0.3.0 - Production on 星期一 5月 19 16:30:08 2014 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options SQL> select object_type from dba_objects where object_name='AUDSES$'; OBJECT_TYPE ------------------- SEQUENCE
因为seq$有坏块导致该问题,因为该数据库需要重建,使用exp导出来数据,然后重建完成相关工作