模拟bootstrap$坏块故障

bootstap$表在数据库启动的时候初始化其它数据字典表,类似于linux下的init.d,如果bootstap$损坏那么就无法启动数据库,我使用dd命令来修复损坏的数据块。

数据库版本10.2.0.1.0

[oracle@ora10-single-01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Sat Jun 28 16:25:57 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> Alter session set events '10912 trace name context forever, level 1';

Session altered.

SQL> exec dbms_space_admin.tablespace_fix_segment_extblks('SYSTEM');

PL/SQL procedure successfully completed.

SQL>   shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  281018368 bytes
Fixed Size		    2095672 bytes
Variable Size		  180356552 bytes
Database Buffers	   92274688 bytes
Redo Buffers		    6291456 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced


SQL> startup
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> alter database open;
ERROR:
ORA-03114: not connected to ORACLE

数据库起不来了,查看alert日志:

Successful open of redo thread 1
Sat Jun 28 16:26:45 CST 2014
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Sat Jun 28 16:26:45 CST 2014
ARC1: Becoming the 'no FAL' ARCH
ARC1: Becoming the 'no SRL' ARCH
Sat Jun 28 16:26:45 CST 2014
ARC0: Becoming the heartbeat ARCH
Sat Jun 28 16:26:45 CST 2014
SMON: enabling cache recovery
Sat Jun 28 16:26:45 CST 2014
Errors in file /oracle/admin/suq/udump/suq_ora_3112.trc:
ORA-00600: internal error code, arguments: [4000], [6], [], [], [], [], [], []
Sat Jun 28 16:26:47 CST 2014
Errors in file /oracle/admin/suq/udump/suq_ora_3112.trc:
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [4000], [6], [], [], [], [], [], []
Sat Jun 28 16:26:47 CST 2014
Error 704 happened during db open, shutting down database
USER: terminating instance due to error 704
Instance terminated by USER, pid = 3112
ORA-1092 signalled during: ALTER DATABASE OPEN...

查看trace文件:

KSFD PGA DUMPS 
Number of completed I/O requests=0 flags=1
END OF PROCESS STATE 
---------------------
PINNED BUFFER HISTORY (oldest pin first)
---------------------
BH (0x65ffcad8) file#: 1 rdba: 0x00400179 (1/377) class: 4 ba: 0x65fd8000   --从这里知道是1号文件的第377数据块有问题
  set: 3 blksize: 8192 bsi: 0 set-flg: 2 pwbcnt: 0
  dbwrid: 0 obj: 56 objn: 56 tsn: 0 afn: 1
  hash: [65ffcbe8,6df6c540] lru: [65ffcc68,6d8bee40]
  ckptq: [NULL] fileq: [NULL] objq: [687efa48,687efa48]
  st: XCURRENT md: NULL tch: 1
  flags:
  LRBA: [0x0.0.0] HSCN: [0xffff.ffffffff] HSUB: [65535]
  buffer tsn: 0 rdba: 0x00400179 (1/377)
  scn: 0x0000.000c1fc3 seq: 0x01 flg: 0x04 tail: 0x1fc31001
  frmt: 0x02 chkval: 0xe7c8 type: 0x10=DATA SEGMENT HEADER - UNLIMITED
Hex dump of block: st=0, typ_found=1

从一个相同版本的数据上dd一个好的377号数据块

[oracle@ora10-single-01 suq]$ dd if=system01.dbf of=/home/oracle/1 skip=377 bs=8192 count=1                  #skip用来跳过多少数据块
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 9.3308e-05 seconds, 87.8 MB/s

将文件传到出问题的主机,将这个文件dd进1号数据文件

[oracle@ora10-single-01 suq]$  dd if=1 of=system01.dbf seek=377 bs=8192 count=1 conv=notrunc         #使用notrunc不会删除之后的数据,否则第377块后面的数据就被清空了,seek定位到第377个块,做之前先备份文件
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 8.5765e-05 seconds, 95.5 MB/s

打开数据库试试吧

[oracle@ora10-single-01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Sat Jun 28 17:44:25 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  281018368 bytes
Fixed Size		    2095672 bytes
Variable Size		  180356552 bytes
Database Buffers	   92274688 bytes
Redo Buffers		    6291456 bytes
Database mounted.
ORA-01113: file 1 needs media recovery if it was restored from backup, or END
BACKUP if it was not
ORA-01110: data file 1: '/oracle/oradata/suq/system01.dbf'


SQL> recover datafile 1
Media recovery complete.
SQL> alter database open;

Database altered.

参考LUNAR的博客。。。

你可能感兴趣的:(模拟bootstrap$坏块故障)