oracle 11g bootstrap被刪除的恢復

感謝https://www.cnblogs.com/lhrbest/articles/5405849.html文檔對我的指導

版本11.2.0.4  linux x64

數據庫無法open。

SQL> startup;
ORACLE instance started.

Total System Global Area  417546240 bytes
Fixed Size		    2253824 bytes
Variable Size		  167775232 bytes
Database Buffers	  243269632 bytes
Redo Buffers		    4247552 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00702: bootstrap verison '' inconsistent with version '8.0.0.0.0'
Process ID: 2479
Session ID: 1 Serial number: 5

後臺alert日誌報錯:

SMON: enabling cache recovery
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_2479.trc:
ORA-00704: bootstrap process failure
ORA-00702: bootstrap verison '' inconsistent with version '8.0.0.0.0'
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_2479.trc:
ORA-00704: bootstrap process failure
ORA-00702: bootstrap verison '' inconsistent with version '8.0.0.0.0'
Error 704 happened during db open, shutting down database
USER (ospid: 2479): terminating the instance due to error 704
Mon Jul 08 11:16:09 2019
ARC1 started with pid=21, OS id=2483 
Instance terminated by USER, pid = 2479
ORA-1092 signalled during: ALTER DATABASE OPEN MIGRATE...
opiodr aborting process unknown ospid (2479) as a result of ORA-1092
​

10046查看

SQL> oradebug setmypid    --跟蹤當前會話

SQL> oradebug EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12   --10046等級=12

SQL> alter session set db_file_multiblocK_read_count=1;          --一次最多讀1個塊    

SQL> oradebug TRACEFILE_NAME                                     --顯示trace文件的名字

SQL> alter database Open;

SQL> oradebug EVENT 10046 trace name context off                 --關閉10046,防止爆漲

WAIT #139636233907032: nam='instance state change' ela= 210 layer=2 value=1 waited=1 obj#=-1 tim=1562555463240603
WAIT #139636233907032: nam='db file sequential read' ela= 10 file#=1 block#=520 blocks=1 obj#=-1 tim=1562555463240886
=====================
PARSING IN CURSOR #139636233898808 len=188 dep=1 uid=0 oct=1 lid=0 tim=1562555463241390 hv=4006182593 ad='788cea18' sqlid='32r4f1brckzq1'
create table bootstrap$ (
END OF STMT
PARSE #139636233898808:c=0,e=421,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=1562555463241389
EXEC #139636233898808:c=0,e=123,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=0,tim=1562555463241545
CLOSE #139636233898808:c=0,e=2,dep=1,type=0,tim=1562555463241583
=====================
PARSING IN CURSOR #139636233898808 len=55 dep=1 uid=0 oct=3 lid=0 tim=1562555463242066 hv=2111436465 ad='788cd0b8' sqlid='6apq2rjyxmxpj'
select line#, sql_text from bootstrap$ where obj# != :1
END OF STMT
PARSE #139636233898808:c=1000,e=475,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=0,tim=1562555463242065
BINDS #139636233898808:
 Bind#0
  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=7eff981e86f0  bln=22  avl=02  flg=05
  value=59
EXEC #139636233898808:c=2000,e=3393,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,plh=867914364,tim=1562555463245514
WAIT #139636233898808: nam='db file sequential read' ela= 11 file#=1 block#=520 blocks=1 obj#=59 tim=1562555463245580
WAIT #139636233898808: nam='db file sequential read' ela= 6 file#=1 block#=521 blocks=1 obj#=59 tim=1562555463245672
WAIT #139636233898808: nam='db file sequential read' ela= 5 file#=1 block#=522 blocks=1 obj#=59 tim=1562555463245710
WAIT #139636233898808: nam='db file sequential read' ela= 4 file#=1 block#=523 blocks=1 obj#=59 tim=1562555463245749
FETCH #139636233898808:c=0,e=214,p=4,cr=5,cu=0,mis=0,r=0,dep=1,og=4,plh=867914364,tim=1562555463245761
STAT #139636233898808 id=1 cnt=0 pid=0 pos=1 obj=59 op='TABLE ACCESS FULL BOOTSTRAP$ (cr=5 pr=4 pw=0 time=215 us)'

*** 2019-07-08 11:11:03.247
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x0] [PC:0x977B2D8, lmebucp()+24] [flags: 0x0, count: 1]
Incident 21753 created, dump file: /u01/app/oracle/diag/rdbms/orcl/orcl/incident/incdir_21753/orcl_ora_2398_i21753.trc
ORA-07445: exception encountered: core dump [lmebucp()+24] [SIGSEGV] [ADDR:0x0] [PC:0x977B2D8] [Address not mapped to object] []

解決方案:

bootstrap$在相同平臺下是一樣的,所以找到一個同平臺,同版本的system01.dbf,用bbed正常的塊替換掉損壞的塊就可以了。

 

1. BBED安裝:

在11g中沒有,需要在對應的平臺上的10g版本上獲取

$ORACLE_HOME/rdbms/lib/ssbbded.o

$ORACLE_HOME/rdbms/lib/sbbdpt.o

$ORACLE_HOME/rdbms/mesg/bbedus.msb

$ORACLE_HOME/rdbms/mesg/bbedus.msg

 

在10g上的如上路徑中將文件cp出來,放在11g的對應的路徑下

進行安裝:

make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed    

該語句是另外指定一個目錄生成bbed文件

 

2. 獲取正常的bootstrap$塊

11g下sys.bootstrap$對象所佔用的塊變成了520、521、522、523這4個塊,10g下爲377、378、379、380這4個塊

找到正常的數據庫

dd if=/xxxx/o1_mf_system_f347jch4_.dbf of=/tmp/bst.dmp bs=10M count=1

註釋:11g位於520-523,所以只需要523*8K大小即可,此處取10MB。

 

3. 編輯bbed的list文件,指引bbed導入需要編輯的文件   

 

[oracle@dongsc bbed_dir]$ cat sys_list.txt 

1 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_f347jch4_.dbf

5 /tmp/bst.dmp

 

4 bbed操作

bbed PASSWORD=blockedit mode=edit blocksize=8192 listfile=/home/oracle/bbed_dir/sys_list.txt

 

BBED> info    --查看是否正確指引到數據文件。

BBED> set count 128

BBED> copy file 5 block 520 to file 1 block 520

BBED> copy file 5 block 521 to file 1 block 521

BBED> copy file 5 block 522 to file 1 block 522

BBED> copy file 5 block 523 to file 1 block 523

BBED> sum apply

 

如下是詳細輸出

[oracle@dongsc bbed_dir]$ bbed PASSWORD=blockedit mode=edit blocksize=8192 listfile=/home/oracle/bbed_dir/sys_list.txt

BBED: Release 2.0.0.0.0 - Limited Production on Mon Jul 8 12:11:01 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> info
 File#  Name                                                        Size(blks)
 -----  ----                                                        ----------
     1  /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_f347jch           0
     5  /tmp/bst.dmp                                                         0

BBED> set count 128
        COUNT           128

BBED> copy file 5 block 520 to file 1 block 520
 File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_f347jch4_.dbf (1)
 Block: 520              Offsets:    0 to  127           Dba:0x00400208
------------------------------------------------------------------------
 10a20000 08024000 d0010000 00000204 43e40000 00000000 00000000 00000000 
 00000000 01000000 07000000 20100000 00000000 03000000 07000000 0c024000 
 00000000 00000000 01000000 03000000 00000000 00000000 00000000 01000000 
 00000000 3b000000 00000040 09024000 07000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> copy file 5 block 521 to file 1 block 521
 File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_f347jch4_.dbf (1)
 Block: 521              Offsets:    0 to  127           Dba:0x00400209
------------------------------------------------------------------------
 06a20000 09024000 d7010000 00000106 fa520000 01000000 3b000000 73010000 
 00000000 01f80200 00000000 00002500 02000000 11024000 02004c00 18200000 
 d7010000 00011800 ffff4200 c6048404 84040000 1800a31f 1a1f951d cd1c4e1b 
 7a1aad19 49177b16 b315d614 0a14ef12 05120e11 380f680e 910d790c 69099c08 

 <32 bytes per line>

BBED> copy file 5 block 522 to file 1 block 522
 File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_f347jch4_.dbf (1)
 Block: 522              Offsets:    0 to  127           Dba:0x0040020a
------------------------------------------------------------------------
 06a20000 0a024000 d7010000 00000106 e81e0000 01000000 3b000000 bb010000 
 00000000 01f80200 00000000 00002500 02000000 20024000 04000700 15200000 
 d7010000 00011500 ffff3c00 b2057605 76050000 1500521d 811cb71b e31a8a18 
 07172216 ce120312 f9102010 410f750e 590dad0c 800bb30a dc096507 9606b205 

 <32 bytes per line>

BBED> copy file 5 block 523 to file 1 block 523
 File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_f347jch4_.dbf (1)
 Block: 523              Offsets:    0 to  127           Dba:0x0040020b
------------------------------------------------------------------------
 06a20000 0b024000 d7010000 00000106 7b7e0000 01000000 3b000000 d0010000 
 00000000 01000300 00000000 00002500 02000000 27024000 04002f00 0f200000 
 d7010000 00010f00 ffff3000 f50dc50d c50d0000 0f00301d 561c481b 821aab19 
 9c18c117 f816b113 ea122011 5110890f c00ef50d 00000000 00000000 00000000 

 <32 bytes per line>

BBED> 
BBED> 
BBED> sum apply
Check value for File 1, Block 523:
current = 0x7e7b, required = 0x7e7b

BBED> 
BBED> 
BBED> 
BBED> exit

然後就可以正常起庫。

11g下sys.bootstrap$對象所佔用的塊變成了520、521、522、523這4個塊,10g下爲377、378、379、380這4個塊

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章