[20121010]global_name為空的恢復-bbed學習.txt

lfree發表於2012-10-10
[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

 <80 bytes per line>

--奇怪,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

 <80 bytes per line>

--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成功!








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

相關文章