【BBED】 sys.bootstrap$ 物件的恢復

lhrbest發表於2016-04-18

BBEDsys.bootstrap$ 物件的恢復

 

1.1  BLOG文件結構圖

 

wps2B1A.tmp 

1.2  前言部分

 

1.2.1  導讀和注意事項

各位技術愛好者,看完本文後,你可以掌握如下的技能,也可以學到一些其它你所不知道的知識,~O(∩_∩)O~:

① sys.bootstrap$的知識

sys.bootstrap$塊損壞的修復過程

BBED copy命令的使用

 

  Tips:

       ① 若文章程式碼格式有錯亂,推薦使用QQ、搜狗或360瀏覽器,也可以下載pdf格式的文件來檢視,pdf文件下載地址:http://yunpan.cn/cdEQedhCs2kFz (提取碼:ed9b 

       ② 本篇BLOG中命令的輸出部分需要特別關注的地方我都用灰色背景和粉紅色字型來表示,比如下邊的例子中,thread 1的最大歸檔日誌號為33thread 2的最大歸檔日誌號為43是需要特別關注的地方;而命令一般使用黃色背景和紅色字型注;對程式碼或程式碼輸出部分的注釋一般採用藍色字型表示

 

  List of Archived Logs in backup set 11

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

  ---- ------- ---------- ------------------- ---------- ---------

  1    32      1621589    2015-05-29 11:09:52 1625242    2015-05-29 11:15:48

  1    33      1625242    2015-05-29 11:15:48 1625293    2015-05-29 11:15:58

  2    42      1613951    2015-05-29 10:41:18 1625245    2015-05-29 11:15:49

  2    43      1625245    2015-05-29 11:15:49 1625253    2015-05-29 11:15:53

 

 

 

 

[ZFXXDB1:root]:/>lsvg -o

T_XDESK_APP1_vg

rootvg

[ZFXXDB1:root]:/>

00:27:22 SQL> alter tablespace idxtbs read write;

 

 

====》2097152*512/1024/1024/1024=1G 

 

 

 

本文如有錯誤或不完善的地方請大家多多指正,ITPUB留言或QQ皆可,您的批評指正是我寫作的最大動力。

 

 

1.2.2  相關參考文章連結

 

【推薦】 【BBED】編譯及基本命令(1)http://blog.itpub.net/26736162/viewspace-2075216/

【推薦】 【BBED】丟失歸檔檔案情況下的恢復:http://blog.itpub.net/26736162/viewspace-2079337/

 

1.2.3  本文簡介

本文的實驗過程主要是為了學習BBED

 

 

1.3  相關知識點掃盲(摘自網路)

wps2B2B.tmp 

wps2B2C.tmp 

 

11g下變成了521522523 3個塊。

wps2B3D.tmp 

 

其他相關知識:http://www.cnblogs.com/springside-example/archive/2011/10/31/2529621.html

---------------------------------------------------------------------------------------------------------------------

 

 

第二章 實驗部分

2.1  實驗環境介紹

專案

db

db 型別

單例項

db version

11.2.0.4.0

db 儲存

FS

主機IP地址/hosts配置

192.168.59.129

OS版本及kernel版本

AIX 7.1 64位

歸檔模式

Archive Mode

ORACLE_SID

oralhr

 

 

2.2  實驗目標

破壞sys.bootstrap$物件佔用的4個塊,然後利用BBEDcopy從其他相同版本的檔案中copy4個塊來恢復該物件。

 

2.3  實驗過程

2.3.1  冷備system檔案

[ZFXDESKDB2:oracle]:/oracle>sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 14 16:10:07 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

 

SYS@oralhr> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@oralhr> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

[ZFXDESKDB2:oracle]:/oracle>cp /oracle/app/oracle/datafile/oralhr/system01.dbf /oracle/app/oracle/datafile/oralhr/system01.dbf_bk

[ZFXDESKDB2:oracle]:/oracle>

[ZFXDESKDB2:oracle]:/oracle>sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 14 16:34:04 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SYS@oralhr> startup

ORACLE instance started.

 

Total System Global Area 3089920000 bytes

Fixed Size                  2250360 bytes

Variable Size             721422728 bytes

Database Buffers         2348810240 bytes

Redo Buffers               17436672 bytes

Database mounted.

Database opened.

SYS@oralhr> SELECT dbms_rowid.rowid_relative_fno(rowid) rel_fno,

  2         dbms_rowid.rowid_block_number(rowid) blockno,

  3                      count(1)

  4    FROM sys.bootstrap$ d

  5   group by dbms_rowid.rowid_relative_fno(rowid) ,

  6            dbms_rowid.rowid_block_number(rowid) ;

 

   REL_FNO    BLOCKNO   COUNT(1)

---------- ---------- ----------

         1        523         12

         1        521         26

         1        522         22

 

====》 11g塊號有所變化

 

SYS@oralhr>

SYS@oralhr> set line 9999 pagesize 9999

SYS@oralhr> col name format a80

SYS@oralhr> select file#||' '||name||' '||bytes name from v$datafile;

 

NAME

--------------------------------------------------------------------------------

1 /oracle/app/oracle/datafile/oralhr/system01.dbf 786432000

2 /oracle/app/oracle/datafile/oralhr/sysaux01.dbf 576716800

3 /oracle/app/oracle/datafile/oralhr/undotbs01.dbf 78643200

4 /oracle/app/oracle/datafile/oralhr/users01.dbf 310640640

 

SYS@oralhr>

 

2.3.2  模擬故障

[ZFXDESKDB2:oracle]:/home/oracle>l

total 208

-rwxrwxrwx    1 oracle   dba              57 Apr 05 17:01 bbed.par

-rwxrwxrwx    1 oracle   dba           52224 Apr 14 15:55 bifile.bbd

-rwxrwxrwx    1 oracle   asmadmin       5715 Apr 06 15:34 ctl.sql

-rwxrwxrwx    1 oracle   dba             302 Apr 14 10:32 file.txt

drwxrwxrwx    8 oracle   dba            4096 Apr 13 17:16 gdul

-rwxrwxrwx    1 oracle   dba           21008 Apr 14 16:35 log.bbd

drwxrwxrwx    4 oracle   dba             256 Apr 12 15:52 oracle_bk

drwxrwxrwx    4 oracle   dba             256 Apr 05 16:54 rman_bak

-rwxrwxrwx    1 oracle   dba             757 Apr 11 10:02 rman_bk_db_archive_lhr.sh

-rwxrwxrwx    1 oracle   dba            1023 Apr 08 11:25 rman_bk_db_lhr.sh

[ZFXDESKDB2:oracle]:/home/oracle>cat file.txt

1 /oracle/app/oracle/datafile/oralhr/system01.dbf 786432000

2 /oracle/app/oracle/datafile/oralhr/sysaux01.dbf 566231040

3 /oracle/app/oracle/datafile/oralhr/undotbs01.dbf 78643200

4 /oracle/app/oracle/datafile/oralhr/users01.dbf 310640640

5 /oracle/app/oracle/datafile/oralhr/system01.dbf_bk 786432000

[ZFXDESKDB2:oracle]:/home/oracle>bbed PASSWORD=blockedit  mode=edit blocksize=8192 listfile=/home/oracle/file.txt

 

BBED: Release 2.0.0.0.0 - Limited Production on Thu Apr 14 16:36:00 2016

 

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

 

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

 

BBED> info

File#  Name                                                        Size(blks)

-----  ----                                                        ----------

     1  /oracle/app/oracle/datafile/oralhr/system01.dbf                  96000

     2  /oracle/app/oracle/datafile/oralhr/sysaux01.dbf                  69120

     3  /oracle/app/oracle/datafile/oralhr/undotbs01.dbf                  9600

     4  /oracle/app/oracle/datafile/oralhr/users01.dbf                   37920

     5  /oracle/app/oracle/datafile/oralhr/system01.dbf_bk               96000

BBED> set count 128

        COUNT           128

 

BBED> copy file 1 block 111 to  file 1 block 377

Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y

File: /oracle/app/oracle/datafile/oralhr/system01.dbf (1)

Block: 377              Offsets:    0 to  127           Dba:0x00400179

------------------------------------------------------------------------

1ea20000 0040006f 000000e2 00000104 fa4c0000 00000001 03450080 00000000

00000000 0000f800 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 

<32 bytes="" per="" line="">

 

BBED> copy file 1 block 111 to  file 1 block 378

File: /oracle/app/oracle/datafile/oralhr/system01.dbf (1)

Block: 378              Offsets:    0 to  127           Dba:0x0040017a

------------------------------------------------------------------------

1ea20000 0040006f 000000e2 00000104 fa4c0000 00000001 03450080 00000000

00000000 0000f800 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 

<32 bytes="" per="" line="">

 

BBED> copy file 1 block 111 to  file 1 block 379

File: /oracle/app/oracle/datafile/oralhr/system01.dbf (1)

Block: 379              Offsets:    0 to  127           Dba:0x0040017b

------------------------------------------------------------------------

1ea20000 0040006f 000000e2 00000104 fa4c0000 00000001 03450080 00000000

00000000 0000f800 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 

<32 bytes="" per="" line="">

 

BBED> copy file 1 block 111 to  file 1 block 380

File: /oracle/app/oracle/datafile/oralhr/system01.dbf (1)

Block: 380              Offsets:    0 to  127           Dba:0x0040017c

------------------------------------------------------------------------

1ea20000 0040006f 000000e2 00000104 fa4c0000 00000001 03450080 00000000

00000000 0000f800 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 

<32 bytes="" per="" line="">

 

BBED> sum apply

Check value for File 1, Block 380:

current = 0xfa4c, required = 0xfa4c

 

BBED>

BBED>

 

重啟資料庫:

SYS@oralhr> startup force

ORACLE instance started.

 

Total System Global Area 3089920000 bytes

Fixed Size                  2250360 bytes

Variable Size             721422728 bytes

Database Buffers         2348810240 bytes

Redo Buffers               17436672 bytes

Database mounted.

ORA-01092: ORACLE instance terminated. Disconnection forced

ORA-00704: bootstrap process failure

ORA-00704: bootstrap process failure

ORA-00604: error occurred at recursive SQL level 1

ORA-01578: ORACLE data block corrupted (file # 1, block # 377)

ORA-01110: data file 1: '/oracle/app/oracle/datafile/oralhr/system01.dbf'

Process ID: 32243962

Session ID: 34 Serial number: 3

 

 

SYS@oralhr>

 

10g不會提示,但告警日誌裡有提示,11g直接有提示,告警日誌:

Errors in file /oracle/app/oracle/diag/rdbms/oralhr/oralhr/trace/oralhr_ora_32243962.trc:

ORA-00704: bootstrap process failure

ORA-00704: bootstrap process failure

ORA-00604: error occurred at recursive SQL level 1

ORA-01578: ORACLE data block corrupted (file # 1, block # 377)

ORA-01110: data file 1: '/oracle/app/oracle/datafile/oralhr/system01.dbf'

Error 704 happened during db open, shutting down database

USER (ospid: 32243962): terminating the instance due to error 704

Instance terminated by USER, pid = 32243962

ORA-1092 signalled during: ALTER DATABASE OPEN...

opiodr aborting process unknown ospid (32243962) as a result of ORA-1092

Thu Apr 14 16:40:03 2016

ORA-1092 : opitsk aborting process

 

2.3.3  故障恢復


從其他的相同版本的庫copy 1號檔案,我們有冷備份,直接新增進BBED來恢復。

[ZFXDESKDB2:oracle]:/home/oracle>bbed PASSWORD=blockedit  mode=edit blocksize=8192 listfile=/home/oracle/file.txt

 

BBED: Release 2.0.0.0.0 - Limited Production on Thu Apr 14 16:42:59 2016

 

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

 

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

 

BBED> info

File#  Name                                                        Size(blks)

-----  ----                                                        ----------

     1  /oracle/app/oracle/datafile/oralhr/system01.dbf                  96000

     2  /oracle/app/oracle/datafile/oralhr/sysaux01.dbf                  69120

     3  /oracle/app/oracle/datafile/oralhr/undotbs01.dbf                  9600

     4  /oracle/app/oracle/datafile/oralhr/users01.dbf                   37920

     5  /oracle/app/oracle/datafile/oralhr/system01.dbf_bk               96000

 

BBED> set count 128

        COUNT           128

 

BBED>

BBED>

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

Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y

File: /oracle/app/oracle/datafile/oralhr/system01.dbf (1)

Block: 377              Offsets:    0 to  127           Dba:0x00400179

------------------------------------------------------------------------

06a20000 00400179 000d00f0 00000104 75380000 02000001 00000029 000d00f0

00000000 00010200 00000000 0004000d 0000040d 00c072f0 009e0200 80000000

000d00e9 01008001 00000001 0009002e 1f291efb 0040017a 00080000 1f780000

1f701f68 1f5f1f56 1f4d1f44 1f3b1f32 1f291eb2 1ea71ec8 1ed31e2e 1e231e9c

 

<32 bytes="" per="" line="">

 

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

File: /oracle/app/oracle/datafile/oralhr/system01.dbf (1)

Block: 378              Offsets:    0 to  127           Dba:0x0040017a

------------------------------------------------------------------------

06a20000 0040017a 00033b45 00000104 5e150000 02000000 00000029 00033b45

0000af58 00020200 00000000 0003001f 0000000e 00c003f0 00070100 e0000000

00033742 00000000 00000000 00000000 00000000 00000000 00000000 00008001

00000001 023f04a2 04a80006 00000000 0040017b 00000000 06000000 1f600000

 

<32 bytes="" per="" line="">

 

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

File: /oracle/app/oracle/datafile/oralhr/system01.dbf (1)

Block: 379              Offsets:    0 to  127           Dba:0x0040017b

------------------------------------------------------------------------

06a20000 0040017b 0002fee2 00000106 4c290000 02000000 00000029 0002fed6

00000000 00020200 00000000 00080002 00000048 00c01bb9 00120100 c0000000

0001bf0a 0004001f 000000ff 00c00592 00341200 2002001c 0002fee2 00008001

00000002 02390496 04a10023 00000002 0040017c 0040017a 06000000 1f600000

 

<32 bytes="" per="" line="">

 

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

File: /oracle/app/oracle/datafile/oralhr/system01.dbf (1)

Block: 380              Offsets:    0 to  127           Dba:0x0040017c

------------------------------------------------------------------------

06a20000 0040017c 0008ac20 00000106 55390000 02020003 00000029 0008ab88

00000000 1f020200 00000000 000a000d 0000015e 00c0714e 00330100 60010000

0008ab8a 000a0018 00000151 00c0714d 00330900 20420000 0008ac20 00018001

00000002 021f0462 04670005 00000000 0040017d 0040017b 06000000 1f600000

 

<32 bytes="" per="" line="">

 

BBED> sum apply

Check value for File 1, Block 380:

current = 0x5539, required = 0x5539

 

BBED>

BBED>

 

 

嘗試啟動資料庫:

SYS@oralhr> alter database open;

ERROR:

ORA-03114: not connected to ORACLE

 

 

SYS@oralhr> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

[ZFXDESKDB2:oracle]:/oracle>sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 14 16:44:02 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SYS@oralhr> startup

ORACLE instance started.

 

Total System Global Area 3089920000 bytes

Fixed Size                  2250360 bytes

Variable Size             721422728 bytes

Database Buffers         2348810240 bytes

Redo Buffers               17436672 bytes

Database mounted.

Database opened.

SYS@oralhr>

wps2B4D.tmp 

 

 

 

2.4  實驗總結

11gsys.bootstrap$物件所佔用的塊變成了5205215225234個塊,10g下為3773783793804個塊,但是11g測試的時候破壞520521522523378379380都可以完成這個實驗,其中破壞520的時候報錯:

ORA-01092: ORACLE instance terminated. Disconnection forced

ORA-00704: bootstrap process failure

ORA-01578: ORACLE data block corrupted (file # 1, block # 520)

ORA-01110: data file 1: '/oracle/app/oracle/datafile/oralhr/system01.dbf'

Process ID: 34078884

Session ID: 34 Serial number: 3

 

 

---------------------------------------------------------------------------------------------------------------------




About Me

.............................................................................................................................................

● 本文作者:小麥苗,部分內容整理自網路,若有侵權請聯絡小麥苗刪除

● 本文在itpub(http://blog.itpub.net/26736162/abstract/1/)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新

● 本文itpub地址:http://blog.itpub.net/26736162/viewspace-2083621/

● 本文部落格園地址:http://www.cnblogs.com/lhrbest

● 本文pdf版、個人簡介及小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● 資料庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/

● DBA寶典今日頭條號地址:http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826

.............................................................................................................................................

● QQ群號:230161599(滿)、618766405

● 微信群:可加我微信,我拉大家進群,非誠勿擾

● 聯絡我請加QQ好友646634621,註明新增緣由

● 於 2016-04-14 10:00~ 2016-04-14 19:00 在魔都完成

● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

● 版權所有,歡迎分享本文,轉載請保留出處

.............................................................................................................................................

小麥苗的微店https://weidian.com/s/793741433?wfr=c&ifr=shopdetail

小麥苗出版的資料庫類叢書http://blog.itpub.net/26736162/viewspace-2142121/

.............................................................................................................................................

使用微信客戶端掃描下面的二維碼來關注小麥苗的微信公眾號(xiaomaimiaolhr)及QQ群(DBA寶典),學習最實用的資料庫技術。

   小麥苗的微信公眾號      小麥苗的DBA寶典QQ群1     小麥苗的DBA寶典QQ群2        小麥苗的微店

.............................................................................................................................................

【BBED】 sys.bootstrap$ 物件的恢復
DBA筆試面試講解群1
DBA筆試面試講解群2
歡迎與我聯絡



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2083621/,如需轉載,請註明出處,否則將追究法律責任。

相關文章