[20121011]global_name为空的恢复(new)-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的copy命令,这个要有两个前提:
1.有备份.2 备份的信息是没有修改前的,就是没有执行:update global_name set global_name='';
如果这些条件不存在,只能手工修复.
从前面的学习已经知道我的测试机器:
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
--如何定位这些信息在哪里,确实是非常麻烦的问题.
1.首先补充如何定位的问题:
一般这些对象在system数据文件很靠前.
20*1024*1024=20971520
通过查询特殊的字符串应该很好定位.
SQL> select rowid x,a.* from sys.props$ a ;
SQL> select rowid x,a.* from sys.props$ a ;
X NAME VALUE$ COMMENT$
------------------ ------------------------------ -------------------- --------------------
...
AAAABiAABAAAAMhAAf GLOBAL_DB_NAME TEST.COM Global database name
AAAABiAABAAAAMhAAg EXPORT_VIEWS_VERSION 8 Export views revisio
n #
AAAABiAABAAAAMhAAh WORKLOAD_CAPTURE_MODE CAPTURE implies work
load capture is in p
rogress
....
$ bvi -s 20971520 system01.dbf
搜索
/CAPTURE implies workload
00643860 6C 61 79 20 69 73 20 69 6E 20 70 72 6F 67 72 65 73 73 2C 00 03 15 57 4F 52 4B 4C 4F 41 44 5F 43 41 50 54 55 52 45 5F 4D 4F 44 45 FF 2F 43 41 50 lay is in progress,...WORKLOAD_CAPTURE_MODE./CAP
00643890 54 55 52 45 20 69 6D 70 6C 69 65 73 20 77 6F 72 6B 6C 6F 61 64 20 63 61 70 74 75 72 65 20 69 73 20 69 6E 20 70 72 6F 67 72 65 73 73 2C 00 03 14 TURE implies workload capture is in progress,...
006438C0 45 58 50 4F 52 54 5F 56 49 45 57 53 5F 56 45 52 53 49 4F 4E 01 38 17 45 78 70 6F 72 74 20 76 69 65 77 73 20 72 65 76 69 73 69 6F 6E 20 23 2C 00 EXPORT_VIEWS_VERSION.8.Export views revision #,.
16进制643860= 6568032
6568032/8192 = 801.761718750000
可以确定801块.
2.破坏开始:
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: 9926
Session ID: 530 Serial number: 3
3.bbed修复:
BBED> set dba 1,801
DBA 0x00400321 (4195105 1,801)
BBED> map /v
File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
Block: 801 Dba:0x00400321
------------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
ub1 type_kcbh @0
ub1 frmt_kcbh @1
ub1 spare1_kcbh @2
ub1 spare2_kcbh @3
ub4 rdba_kcbh @4
ub4 bas_kcbh @8
ub2 wrp_kcbh @12
ub1 seq_kcbh @14
ub1 flg_kcbh @15
ub2 chkval_kcbh @16
ub2 spare3_kcbh @18
struct ktbbh, 72 bytes @20
ub1 ktbbhtyp @20
union ktbbhsid, 4 bytes @24
struct ktbbhcsc, 8 bytes @28
sb2 ktbbhict @36
ub1 ktbbhflg @38
ub1 ktbbhfsl @39
ub4 ktbbhfnx @40
struct ktbbhitl[2], 48 bytes @44
struct kdbh, 14 bytes @92
ub1 kdbhflag @92
sb1 kdbhntab @93
sb2 kdbhnrow @94
sb2 kdbhfrre @96
sb2 kdbhfsbo @98
sb2 kdbhfseo @100
sb2 kdbhavsp @102
sb2 kdbhtosp @104
struct kdbt[1], 4 bytes @106
sb2 kdbtoffs @106
sb2 kdbtnrow @108
sb2 kdbr[37] @110
ub1 freespace[5454] @184
ub1 rowdata[2550] @5638
ub4 tailchk @8188
BBED> p kdbr
sb2 kdbr[0] @110 8048
sb2 kdbr[1] @112 7767
sb2 kdbr[2] @114 6290
sb2 kdbr[3] @116 7836
sb2 kdbr[4] @118 7696
sb2 kdbr[5] @120 7675
sb2 kdbr[6] @122 -1
sb2 kdbr[7] @124 7576
sb2 kdbr[8] @126 7509
sb2 kdbr[9] @128 7439
sb2 kdbr[10] @130 7385
sb2 kdbr[11] @132 7351
sb2 kdbr[12] @134 7316
sb2 kdbr[13] @136 7283
sb2 kdbr[14] @138 7242
sb2 kdbr[15] @140 7194
sb2 kdbr[16] @142 7151
sb2 kdbr[17] @144 7109
sb2 kdbr[18] @146 7068
sb2 kdbr[19] @148 7024
sb2 kdbr[20] @150 6983
sb2 kdbr[21] @152 6937
sb2 kdbr[22] @154 6870
sb2 kdbr[23] @156 6803
sb2 kdbr[24] @158 6716
sb2 kdbr[25] @160 6672
sb2 kdbr[26] @162 6638
sb2 kdbr[27] @164 6588
sb2 kdbr[28] @166 6534
sb2 kdbr[29] @168 6478
sb2 kdbr[30] @170 6413
sb2 kdbr[31] @172 5546
sb2 kdbr[32] @174 6240
sb2 kdbr[33] @176 6166
sb2 kdbr[34] @178 6042
sb2 kdbr[35] @180 5982
sb2 kdbr[36] @182 5949
BBED>
-- 最小就是sb2 kdbr[31] @172 5546
BBED> p *kdbr[31]
rowdata[0]
----------
ub1 rowdata[0] @5638 0x2c
BBED> x /37rccc
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
rowdata[40] @5678
-----------
flag@5678: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@5679: 0x00
cols@5680: 3
col 0[14] @5681: GLOBAL_DB_NAME
col 1[8] @5696: TEST.COM
col 2[20] @5705: Global database name
.....
--可以发现@5678就是原来的信息,从以下也可以看到:
BBED> set offset 5678
OFFSET 5678
BBED> x /rccc
rowdata[40] @5678
-----------
flag@5678: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@5679: 0x00
cols@5680: 3
col 0[14] @5681: GLOBAL_DB_NAME
col 1[8] @5696: TEST.COM
col 2[20] @5705: Global database name
-- 5638- 5546 = 92,偏移92. 5678-92= 5586
-- 仅仅需要修改kdbr[31]= 5586 = 0x15D2
BBED> modify /x d215 offset 172
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
Block: 801 Offsets: 172 to 8191 Dba:0x00400321
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
d2156018 16189a17 5e173d17 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
...
BBED> p *kdbr[31]
rowdata[40]
-----------
ub1 rowdata[40] @5678 0x2c
BBED> x /rccc
rowdata[40] @5678
-----------
flag@5678: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@5679: 0x00
cols@5680: 3
col 0[14] @5681: GLOBAL_DB_NAME
col 1[8] @5696: TEST.COM
col 2[20] @5705: Global database name
--Ok显示正确.
BBED> sum apply
Check value for File 1, Block 801:
current = 0x4cde, required = 0x4cde
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle11g/oradata/test/system01.dbf
BLOCK = 801
Block Checking: DBA = 4195105, Block Type = KTB-managed data block
data header at 0x2a97fd625c
kdbchk: xaction header lock count mismatch
trans=1 ilk=1 nlo=0
Block 801 failed with check code 6108
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing (Data) : 1
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.修复校验错误:
BBED> p *kdbr[31]
rowdata[40]
-----------
ub1 rowdata[40] @5678 0x2c
BBED> x /rccc
rowdata[40] @5678
-----------
flag@5678: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@5679: 0x00
cols@5680: 3
col 0[14] @5681: GLOBAL_DB_NAME
col 1[8] @5696: TEST.COM
col 2[20] @5705: Global database name
BBED> modify /x 01 offset 5679
File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
Block: 801 Offsets: 5679 to 8191 Dba:0x00400321
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
01030e47 4c4f4241 4c5f4442 5f4e414d 45085445 53542e43 4f4d1447 6c6f6261 6c206461 74616261 7365206e 616d652c 00030e47 4c4f4241 4c5f4442 5f4e414d 45ff1447 6c6f6261 6c206461 74616261
BBED> set offset 5638
OFFSET 5638
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> modify /x 00 offset 5639
File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
Block: 801 Offsets: 5639 to 8191 Dba:0x00400321
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00030e47 4c4f4241 4c5f4442 5f4e414d 45ff1447 6c6f6261 6c206461 74616261 7365206e 616d652c 01030e47 4c4f4241 4c5f4442 5f4e414d 45085445 53542e43 4f4d1447 6c6f6261 6c206461 74616261
BBED> sum apply
Check value for File 1, Block 801:
current = 0x4cde, required = 0x4cde
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle11g/oradata/test/system01.dbf
BLOCK = 801
Block Checking: DBA = 4195105, Block Type = KTB-managed data block
data header at 0x2a97fd625c
kdbchk: the amount of space used is not equal to block size
used=2058 fsc=8 avsp=6038 dtl=8096
Block 801 failed with check code 6110
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing (Data) : 1
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
BBED> p kdbh
struct kdbh, 14 bytes @92
ub1 kdbhflag @92 0x00 (NONE)
sb1 kdbhntab @93 1
sb2 kdbhnrow @94 37
sb2 kdbhfrre @96 6
sb2 kdbhfsbo @98 92
sb2 kdbhfseo @100 5546
sb2 kdbhavsp @102 6038
sb2 kdbhtosp @104 6046
--修改kdbhtosp=kdbhavsp.
BBED> dump /v offset 102 count 4
File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
Block: 801 Offsets: 102 to 105 Dba:0x00400321
---------------------------------------------------------------------------------------------------------------------------------------------------------------
96179e17 l ....
BBED> modify /x 9617 offset 104
File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
Block: 801 Offsets: 104 to 107 Dba:0x00400321
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
96170000
BBED> p kdbh
struct kdbh, 14 bytes @92
ub1 kdbhflag @92 0x00 (NONE)
sb1 kdbhntab @93 1
sb2 kdbhnrow @94 37
sb2 kdbhfrre @96 6
sb2 kdbhfsbo @98 92
sb2 kdbhfseo @100 5546
sb2 kdbhavsp @102 6038
sb2 kdbhtosp @104 6038
--OK现在两者相等.
BBED> sum apply
Check value for File 1, Block 801:
current = 0x4cd6, required = 0x4cd6
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle11g/oradata/test/system01.dbf
BLOCK = 801
Block Checking: DBA = 4195105, Block Type = KTB-managed data block
data header at 0x2a97fd625c
kdbchk: the amount of space used is not equal to block size
used=2058 fsc=8 avsp=6038 dtl=8096
Block 801 failed with check code 6110
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing (Data) : 1
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
--依旧不行.
BBED> p ktbbhitl
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0x0005
ub2 kxidslt @46 0x0008
ub4 kxidsqn @48 0x00002738
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00c04078
ub2 kubaseq @56 0x12c3
ub1 kubarec @58 0x12
ub2 ktbitflg @60 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @62
sb2 _ktbitfsc @62 8
ub2 _ktbitwrp @62 0x0008
ub4 ktbitbas @64 0xb36a7047
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x0007
ub2 kxidslt @70 0x001c
ub4 kxidsqn @72 0x00002202
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x00c03fd2
ub2 kubaseq @80 0x1237
ub1 kubarec @82 0x0d
ub2 ktbitflg @84 0x8000 (KTBFCOM)
union _ktbitun, 2 bytes @86
sb2 _ktbitfsc @86 0
ub2 _ktbitwrp @86 0x0000
ub4 ktbitbas @88 0xb36a0218
BBED> modify /x 00 offset 62
File: /u01/app/oracle11g/oradata/test/system01.dbf (1)
Block: 801 Offsets: 62 to 65 Dba:0x00400321
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00004770
BBED> p ktbbhitl
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0x0005
ub2 kxidslt @46 0x0008
ub4 kxidsqn @48 0x00002738
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00c04078
ub2 kubaseq @56 0x12c3
ub1 kubarec @58 0x12
ub2 ktbitflg @60 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @62
sb2 _ktbitfsc @62 0
ub2 _ktbitwrp @62 0x0000
ub4 ktbitbas @64 0xb36a7047
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x0007
ub2 kxidslt @70 0x001c
ub4 kxidsqn @72 0x00002202
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x00c03fd2
ub2 kubaseq @80 0x1237
ub1 kubarec @82 0x0d
ub2 ktbitflg @84 0x8000 (KTBFCOM)
union _ktbitun, 2 bytes @86
sb2 _ktbitfsc @86 0
ub2 _ktbitwrp @86 0x0000
ub4 ktbitbas @88 0xb36a0218
BBED> sum apply
Check value for File 1, Block 801:
current = 0x4cde, required = 0x4cde
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
--OK,正常!
5.启动数据库看看:
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.
OK正常!
SQL> select rowid x,a.* from sys.props$ a ;
X NAME VALUE$ COMMENT$
------------------ ------------------------------ ---------------------------------------- --------------------------------------------------
AAAABiAABAAAAMhAAA DICT.BASE 2 dictionary base tables version #
AAAABiAABAAAAMhAAB DEFAULT_TEMP_TABLESPACE TEMP Name of default temporary tablespace
AAAABiAABAAAAMhAAC DEFAULT_PERMANENT_TABLESPACE USERS Name of default permanent tablespace
AAAABiAABAAAAMhAAD DEFAULT_EDITION ORA$BASE Name of the database default edition
AAAABiAABAAAAMhAAE Flashback Timestamp TimeZone GMT Flashback timestamp created in GMT
AAAABiAABAAAAMhAAF TDE_MASTER_KEY_ID
AAAABiAABAAAAMhAAH DST_UPGRADE_STATE NONE State of Day Light Saving Time Upgrade
AAAABiAABAAAAMhAAI DST_PRIMARY_TT_VERSION 11 Version of primary timezone data file
AAAABiAABAAAAMhAAJ DST_SECONDARY_TT_VERSION 0 Version of secondary timezone data file
AAAABiAABAAAAMhAAK DEFAULT_TBS_TYPE SMALLFILE Default tablespace type
AAAABiAABAAAAMhAAL NLS_LANGUAGE AMERICAN Language
AAAABiAABAAAAMhAAM NLS_TERRITORY AMERICA Territory
AAAABiAABAAAAMhAAN NLS_CURRENCY $ Local currency
AAAABiAABAAAAMhAAO NLS_ISO_CURRENCY AMERICA ISO currency
AAAABiAABAAAAMhAAP NLS_NUMERIC_CHARACTERS ., Numeric characters
AAAABiAABAAAAMhAAQ NLS_CHARACTERSET ZHS16GBK Character set
AAAABiAABAAAAMhAAR NLS_CALENDAR GREGORIAN Calendar system
AAAABiAABAAAAMhAAS NLS_DATE_FORMAT DD-MON-RR Date format
AAAABiAABAAAAMhAAT NLS_DATE_LANGUAGE AMERICAN Date language
AAAABiAABAAAAMhAAU NLS_SORT BINARY Linguistic definition
AAAABiAABAAAAMhAAV NLS_TIME_FORMAT HH.MI.SSXFF AM Time format
AAAABiAABAAAAMhAAW NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM Time stamp format
AAAABiAABAAAAMhAAX NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR Time with timezone format
AAAABiAABAAAAMhAAY NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR Timestamp with timezone format
AAAABiAABAAAAMhAAZ NLS_DUAL_CURRENCY $ Dual currency symbol
AAAABiAABAAAAMhAAa NLS_COMP BINARY NLS comparison
AAAABiAABAAAAMhAAb NLS_LENGTH_SEMANTICS BYTE NLS length semantics
AAAABiAABAAAAMhAAc NLS_NCHAR_CONV_EXCP FALSE NLS conversion exception
AAAABiAABAAAAMhAAd NLS_NCHAR_CHARACTERSET AL16UTF16 NCHAR Character set
AAAABiAABAAAAMhAAe NLS_RDBMS_VERSION 11.2.0.1.0 RDBMS version for NLS parameters
AAAABiAABAAAAMhAAf GLOBAL_DB_NAME TEST.COM Global database name
AAAABiAABAAAAMhAAg EXPORT_VIEWS_VERSION 8 Export views revision #
AAAABiAABAAAAMhAAh WORKLOAD_CAPTURE_MODE CAPTURE implies workload capture is in progress
AAAABiAABAAAAMhAAi WORKLOAD_REPLAY_MODE PREPARE implies external replay clients can connec
t; REPLAY implies workload replay is in progress
AAAABiAABAAAAMhAAj NO_USERID_VERIFIER_SALT 8BF56230FC49D6ECFE53EB96A5922DD5
AAAABiAABAAAAMhAAk DBTIMEZONE 00:00 DB time zone
36 rows selected.