Oracle异常恢复BBED系列

0    651    1

Tags:

👉 本文共约65032个字,系统预计阅读时间或需245分钟。

使用BBED修复sys.bootstrap$ 对象

前言部分

导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

① sys.bootstrap$的知识

② sys.bootstrap$块损坏的修复过程

③ BBED copy命令的使用

本文简介

本文的实验过程主要是为了学习BBED。

相关知识点扫盲(摘自网络)

11g下变成了521、522、523 这3个块。

实验环境介绍

项目db
db 类型单实例
db version11.2.0.4.0
db 存储FS
主机IP地址/hosts配置192.168.59.129
OS版本及kernel版本AIX 7.1 64位
归档模式Archive Mode
ORACLE_SIDoralhr

实验目标

破坏sys.bootstrap$对象占用的4个块,然后利用BBED的copy从其他相同版本的文件中copy这4个块来恢复该对象。

实验过程

冷备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>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>

模拟故障

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

本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!
AiDBA后续精彩内容已被站长无情隐藏,请输入验证码解锁本文!
验证码:
获取验证码: 请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“AiDBA”或者“dbaup6”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复