[20121010]global_name为空的恢复-bbed学习.txt

[20121010]global_name为空的恢复-bbed学习.txt

前面已经提到如果global_name为空,数据库会起来.
下次开机时,出现如下提示:
SQL> startup
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2215064 bytes
Variable Size            1728054120 bytes
Database Buffers          402653184 bytes
Redo Buffers                4964352 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [18062], [], [], [], [], [], [], [], [], [], [], []
Process ID: 632
Session ID: 530 Serial number: 3

就那这个例子讲讲使用bbed修复:

1.准备工作:我的测试环境11GR2.

先冷备份system数据文件.
$ cp  /u01/app/oracle11g/oradata/test/system01.dbf /data/testtest/

$ ls -ltr /u01/app/oracle11g/oradata/test/system01.dbf /data/testtest/system01.dbf
-rw-r-----  1 oracle11g oinstall 807411712 Oct  9 15:44 /u01/app/oracle11g/oradata/test/system01.dbf
-rw-r-----  1 oracle11g oinstall 807411712 Oct  9 15:49 /data/testtest/system01.dbf

2.启动数据库,修改global_name为空:
SQL> startup
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2215064 bytes
Variable Size            1728054120 bytes
Database Buffers          402653184 bytes
Redo Buffers                4964352 bytes
Database mounted.
Database opened.
SQL> update global_name set global_name='';

1 row updated.

SQL> commit ;

Commit complete.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2215064 bytes
Variable Size            1728054120 bytes
Database Buffers          402653184 bytes
Redo Buffers                4964352 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [18062], [], [], [], [], [], [], [], [], [], [], []
Process ID: 2186
Session ID: 530 Serial number: 3
--问题再现!

3.bbed上路:
修改filelist.txt文件,增加1行,变成如下:
1 /u01/app/oracle11g/oradata/test/system01.dbf 807403520
2 /u01/app/oracle11g/oradata/test/sysaux01.dbf 880803840
3 /u01/app/oracle11g/oradata/test/undotbs01.dbf 1073741824
4 /u01/app/oracle11g/oradata/test/users01.dbf 536870912
5 /u01/app/oracle11g/oradata/test/example01.dbf 104857600
6 /u01/app/oracle11g/oradata/test/rman01.dbf 67108864
7 /u01/app/oracle11g/oradata/test/tools01.dbf 67108864
8 /u01/app/oracle11g/oradata/test/test01.dbf 67108864
9 /data/testtest/system01.dbf 807403520

--我们现在仅仅需要使用copy命令来恢复看看.
从前面的学习已经知道我的测试机器:
SQL> select rowid x,a.* from sys.props$ a where name='GLOBAL_DB_NAME';

X                  NAME                 VALUE$                         COMMENT$
------------------ -------------------- ------------------------------ --------------------
AAAABiAABAAAAMhAAf GLOBAL_DB_NAME       TEST.COM                       Global database name

SQL> @ lookup_rowid.sql  AAAABiAABAAAAMhAAf

    OBJECT       FILE      BLOCK        ROW
---------- ---------- ---------- ----------
        98          1        801         31


--如何定位这些信息在哪里,确实是非常麻烦的问题,我这里先暂时放一下.

BBED> set dba 1,801
        DBA             0x00400321 (4195105 1,801)

BBED> p *kdbr[31]
rowdata[0]
----------
ub1 rowdata[0]                              @5638     0x2c

BBED> x /rccc
rowdata[0]                                  @5638
----------
flag@5638: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@5639: 0x01
cols@5640:    3

col   0[14] @5641: GLOBAL_DB_NAME
col    1[0] @5656: *NULL*
col   2[20] @5657: Global database name

BBED> set dba 9,801
        DBA             0x02400321 (37749537 9,801)

BBED> p *kdbr[31]
rowdata[0]
----------
ub1 rowdata[0]                              @5678     0x2c

BBED> x /rccc
rowdata[0]                                  @5678
----------
flag@5678: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@5679: 0x02
cols@5680:    3

col   0[14] @5681: GLOBAL_DB_NAME
col    1[8] @5696: TEST.COM
col   2[20] @5705: Global database name

--可以发现dba=9,801(冷备份的信息是正确的),而dba=1,801的显示中col1=NULL.仅仅需要从备份中copy回来就ok了.


BBED> help copy
COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]

BBED> copy dba 9,801 to dba 1,801
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
 Block: 801                                                                    Offsets: 5678 to 8191                                                                 Dba:0x00400321
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 2c02030e 474c4f42 414c5f44 425f4e41 4d450854 4553542e 434f4d14 476c6f62 616c2064 61746162 61736520 6e616d65 2c00030e 474c4f42 414c5f44 425f4e41 4d45ff14 476c6f62 616c2064 61746162
 61736520 6e616d65 2c00030e 474c4f42 414c5f44 425f4e41 4d450854 4553542e 434f4d14 476c6f62 616c2064 61746162 61736520 6e616d65 2c02030e 474c4f42 414c5f44 425f4e41 4d45ff14 476c6f62
.............
 6374696f 6e617279 20626173 65207461 626c6573 20766572 73696f6e 20230106 1802

 

--奇怪,copy的显示从5678开始显示,安全期间,重来.

BBED> set dba 9,801
        DBA             0x02400321 (37749537 9,801)

BBED> set offset 0
        OFFSET          0

BBED> set dba 1,801
        DBA             0x00400321 (4195105 1,801)

BBED> set offset 0
        OFFSET          0

BBED> copy dba 9,801 to dba 1,801
 File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
 Block: 801                                                                    Offsets:    0 to 8191                                                                 Dba:0x00400321
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 06a20000 21034000 18026ab3 00000106 43630000 01000000 62000000 17026ab3 00000000 02000300 00000000 03001600 41230000 c20ac000 b6111e00 00800000 b16366b3 07001c00 02220000 d23fc000
 37120d00 01200000 18026ab3 00012500 06005c00 d2159617 96170000 2500701f 571e9218 9c1e101e fb1dffff 981d551d 0f1dd91c b71c941c 731c4a1c 1a1cef1b c51b9c1b 701b471b 191bd61a 931a3c1a
 101aee19 bc198619 4e190d19 d2156018 16189a17 5e173d17 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 ........................ 
 696f6e61 72792062 61736520 7461626c 65732076 65727369 6f6e2023 01061802

 

--OK这样正确了.

BBED> set dba 1,801
        DBA             0x00400321 (4195105 1,801)

BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle11g/oradata/test/system01.dbf
BLOCK = 801

DBVERIFY - Verification complete

Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED

4.启动数据库,看看修复结果:
SQL> startup
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2215064 bytes
Variable Size            1728054120 bytes
Database Buffers          402653184 bytes
Redo Buffers                4964352 bytes
Database mounted.
Database opened.

SQL> column value$ format a20
SQL> column comment$ format a20
SQL> select rowid x,a.* from sys.props$ a where name='GLOBAL_DB_NAME';

X                  NAME                           VALUE$               COMMENT$
------------------ ------------------------------ -------------------- --------------------
AAAABiAABAAAAMhAAf GLOBAL_DB_NAME                 TEST.COM             Global database name

--OK成功!








上一篇:redis成长之路——(二)


下一篇:redis成长之路——(四)