【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
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>
二.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
二.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>
二.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 在中行完成
【版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任】
....................................................................................................................................................
............................................................................................ ● 小麦苗的微店:https://weidian.com/s/793741433?wfr=c&ifr=shopdetail ............................................................................................ 使用微信客户端扫描下面的二维码来关注小麦苗的微信公众号(DB宝),学习最实用的数据库技术。
|