【BBED】 sys.bootstrap$ 對象的恢復
【BBED】 sys.bootstrap$ 對象的恢復
一.1 BLOG文檔結構圖
一.2 前言部分
一.2.1 導讀和注意事項
各位技術愛好者,看完本文後,你可以掌握如下的技能,也可以學到一些其它你所不知道的知識,~O(∩_∩)O~:
① sys.bootstrap$的知識
② sys.bootstrap$塊損壞的修復過程
③ BBED copy命令的使用
Tips:
① 若文章代碼格式有錯亂,推薦使用QQ、搜狗或360瀏覽器,也可以下載pdf格式的文檔來查看,pdf文檔下載地址:http://yunpan.cn/cdEQedhCs2kFz (提取碼:ed9b)
② 本篇BLOG中命令的輸出部分需要特別關注的地方我都用灰色背景和粉紅色字體來表示,比如下邊的例子中,thread 1的最大歸檔日誌號爲33,thread 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皆可,您的批評指正是我寫作的最大動力。
一.2.2 相關參考文章鏈接
【推薦】 【BBED】編譯及基本命令(1):http://blog.itpub.net/26736162/viewspace-2075216/
【推薦】 【BBED】丟失歸檔文件情況下的恢復:http://blog.itpub.net/26736162/viewspace-2079337/
一.2.3 本文簡介
本文的實驗過程主要是爲了學習BBED。
一.3 相關知識點掃盲(摘自網絡)
11g下變成了521、522、523 這3個塊。
其他相關知識:http://www.cnblogs.com/springside-example/archive/2011/10/31/2529621.html
---------------------------------------------------------------------------------------------------------------------
第二章 實驗部分
二.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 實驗目標
破壞sys.bootstrap$對象佔用的4個塊,然後利用BBED的copy從其他相同版本的文件中copy這4個塊來恢復該對象。
二.3 實驗過程
二.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
[email protected]> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
[email protected]> 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.
[email protected]> 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.
[email protected]> 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塊號有所變化
[email protected]> set line 9999 pagesize 9999
[email protected]> col name format a80
[email protected]> 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
二.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>
重啓數據庫:
[email protected]> 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
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
二.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>
嘗試啓動數據庫:
[email protected]> alter database open;
ERROR:
ORA-03114: not connected to ORACLE
[email protected]> 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.
[email protected]> 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.
二.4 實驗總結
11g下sys.bootstrap$對象所佔用的塊變成了520、521、522、523這4個塊,10g下爲377、378、379、380這4個塊,但是11g測試的時候破壞520、521、522、523或378、379、380都可以完成這個實驗,其中破壞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 BLOG:
二.4 實驗總結
11g下sys.bootstrap$對象所佔用的塊變成了520、521、522、523這4個塊,10g下爲377、378、379、380這4個塊,但是11g測試的時候破壞520、521、522、523或378、379、380都可以完成這個實驗,其中破壞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 BLOG:http://blog.itpub.net/26736162
本文地址:http://blog.itpub.net/26736162/viewspace-2083621/
本文pdf版:http://yunpan.cn/cdEQedhCs2kFz (提取碼:ed9b)
QQ:642808185 若加QQ請註明您所正在讀的文章標題
於 2016-04-14 10:00~ 2016-04-14 19:00 在中行完成
【版權所有,文章允許轉載,但須以鏈接方式註明源地址,否則追究法律責任】
....................................................................................................................................................