環境中遇到了ora-00600 4000錯誤,涉及的對象即為cluster table,下面我這裡簡單模擬了一下。供參考!
++++創建測試表
? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66SQL> conn roger/roger
Connected.
SQL> create
cluster t_cluster(id number(2)) ;
Cluster created.
SQL> create
table t_0610
2 (id number(2)
primary key,
3
name varchar2(13))
4 cluster t_cluster(id);
Table
created.
SQL> create
index t_cluster_idx
on cluster t_cluster;
Index
created.
SQL>
SQL> insert
into t_0610 values(1,'baidu');
1 row created.
SQL> insert
into t_0610 values(2,'google');
1 row created.
SQL> insert
into t_0610 values(8,'roger');
1 row created.
SQL> commit;
Commit
complete.
SQL> select
* from
t_0610;
ID NAME
---------- -------------
1 baidu
2 google
8 roger
SQL> select
dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) blk#
2
from t_0610;
FILE# BLK#
---------- ----------
6 172
6 173
6 174
SQL> oradebug setmypid
ORA-01031: insufficient
privileges
SQL> conn /as
sysdba
Connected.
SQL> oradebug setmypid
Statement processed.
SQL> alter
system flush buffer_cache;
System altered.
SQL> alter
system dump datafile 6 block 172;
System altered.
SQL> oradebug close_trace
Statement processed.
SQL> oradebug tracefile_name
/oracle/diag/rdbms/roger/roger/trace/roger_ora_16777.trc
++++blockdump內容
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Dump of buffer cache at level 4 for tsn=7 rdba=25165996
BH (0x71bf2f28) file#: 6 rdba: 0x018000ac (6/172) class: 1 ba: 0x71ad8000
set: 3 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,15
dbwrid: 0 obj: 77519 objn: 77520 tsn: 7 afn: 6 hint: f
hash: [0x8abfa738,0x8abfa738] lru: [0x74ff33a0,0x7abf47d0]
lru-flags: on_auxiliary_list
ckptq: [NULL] fileq: [NULL] objq: [NULL] objaq: [NULL]
st: FREE md: NULL fpin: 'ktspbwh2: ktspfmdb' tch: 0 lfb: 33
flags:
Block dump from disk:
buffer tsn: 7 rdba: 0x018000ac (6/172)
scn: 0x0000.00b941a6 seq: 0x01 flg: 0x06 tail: 0x41a60601
frmt: 0x02 chkval: 0xcb52 type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007FADB771EA00 to 0x00007FADB7720A00
7FADB771EA00 0000A206 018000AC 00B941A6 06010000 [.........A......]
7FADB771EA10 0000CB52 00000001 00012ECF 00B94199 [R............A..]
7FADB771EA20 00000000 00320002 018000A8 00080006 [......2.........]
7FADB771EA30 00000515 00C00562 002E014E 00008000 [....b...N.......]
7FADB771EA40 00B94198 001D0007 000004C9 00C03C08 [.A...........<..]
7FADB771EA50 0032019D 00002001 00B941A6 00000000 [..2.. ...A......]
7FADB771EA60 00000000 00020201 001AFFFF 1F5E1F78 [............x.^.]
7FADB771EA70 00001F5E 00010001 1F820001 00001F78 [^...........x...]
7FADB771EA80 00000000 00000000 00000000 00000000 [................]
Repeat 500 times
7FADB77209D0 00000000 00000000 00000000 0001026C [............l...]
7FADB77209E0 69616205 00AC7564 01000101 00800100 [.baidu..........]
7FADB77209F0 010000AC 00AC0080 02C10200 41A60601 [...............A]
Block header dump: 0x018000ac
Object id on Block? Y
seg/obj: 0x12ecf csc: 0x00.b94199 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x18000a8 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0006.008.00000515 0x00c00562.014e.2e C--- 0 scn 0x0000.00b94198
0x02 0x0007.01d.000004c9 0x00c03c08.019d.32 --U- 1 fsc 0x0000.00b941a6
bdba: 0x018000ac
data_block_dump,data header at 0x7fadb771ea64
===============
tsiz: 0x1f98
hsiz: 0x1a
pbl: 0x7fadb771ea64
76543210
flag=-------K
ntab=2 ---- > 大於2,說明這是一個cluster table
nrow=2
frre=-1
fsbo=0x1a
fseo=0x1f78
avsp=0x1f5e
tosp=0x1f5e
0xe:pti[0] nrow=1 offs=0
0x12:pti[1] nrow=1 offs=1
0x16:pri[0] offs=0x1f82
0x18:pri[1] offs=0x1f78
block_row_dump:
tab 0, row 0, @0x1f82
tl: 22 fb: K-H-FL-- lb: 0x0 cc: 1
curc: 1 comc: 1 pk: 0x018000ac.0 nk: 0x018000ac.0
col 0: [ 2] c1 02
tab 1, row 0, @0x1f78
tl: 10 fb: -CH-FL-- lb: 0x2 cc: 1 cki: 0
col 0: [ 5] 62 61 69 64 75
end_of_block_dump
End dump data blocks tsn: 7 file#: 6 minblk 172 maxblk 172
大家可以看到,這跟普通的data block的dump內容是有所差別的,因為這裡涉及到cluster table。
下面來模擬下手工提交cluster table的事務。
+++++模擬事務不提交
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
SQL> alter
system checkpoint;
System altered.
SQL> alter
system flush buffer_cache;
System altered.
SQL> show user
USER
is "SYS"
SQL> conn roger/roger
Connected.
SQL> delete
from t_0610 where
id=8; ++++++不提交
1 row deleted.
SQL> alter
system flush buffer_cache;
System altered.
SQL> select
xidusn,xidslot,xidsqn,ubablk,ubafil,ubarec from
v$transaction;
XIDUSN XIDSLOT XIDSQN UBABLK UBAFIL UBAREC
---------- ---------- ---------- ---------- ---------- ----------
3 17 1212 1066 3 20
SQL>
這裡我們可以看到對於這個未提交的事務XID為:3.17.1212 前面我們已經知道
測試表中的數據分布在3個block中,這裡我模擬的情況是刪除第3條數據,且不提交,通過bbed來實現手工
提交這個未提交事務,注意:第3條數據是在第3個block中,即174 block。
+++++首先修改表的itl等信息
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
BBED> set file 6 block 174
FILE# 6
BLOCK# 174
BBED> map
File: /oracle/oradata/roger/roger01.dbf (6)
Block: 174 Dba:0x018000ae
------------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
struct ktbbh, 72 bytes @20
struct kdbh, 14 bytes @100
struct kdbt[2], 8 bytes @114
sb2 kdbr[2] @122