[20161129]奇怪的转储命令.txt
--如果你转储文件头使用如下命令:
SYS@book> alter system dump datafile 6 block 1;
System altered.
Start dump data blocks tsn: 8 file#:6 minblk 1 maxblk 1
Block 1 (file header) not dumped:use dump file header command
End dump data blocks tsn: 7 file#: 6 minblk 2 maxblk 1
--也就是文件头不能使用这样的方式。
SYS@book> alter system dump datafile '/mnt/ramdisk/book/sugar01.dbf' block 1;
System altered.
*** 2016-11-29 15:07:31.354
Start dump data block from file /mnt/ramdisk/book/sugar01.dbf minblk 1 maxblk 1
V10 STYLE FILE HEADER:
Compatibility Vsn = 186647552=0xb200400
Db ID=1337401710=0x4fb7216e, Db Name='BOOK'
Activation ID=0=0x0
Control Seq=43937=0xaba1, File size=5120=0x1400
File Number=6, Blksiz=8192, File Type=3 DATA
Dump all the blocks in range:
End dump data block from file /mnt/ramdisk/book/sugar01.dbf minblk 2 maxblk 1
--至少可以看到dbid
--如果执行如下:
SYS@book> alter system dump datafile '/mnt/ramdisk/book/sugar01.dbf' block 2;
System altered.
*** 2016-11-29 15:12:14.535
Start dump data block from file /mnt/ramdisk/book/sugar01.dbf minblk 2 maxblk 2
V10 STYLE FILE HEADER:
Compatibility Vsn = 186647552=0xb200400
Db ID=1337401710=0x4fb7216e, Db Name='BOOK'
Activation ID=0=0x0
Control Seq=43937=0xaba1, File size=5120=0x1400
File Number=6, Blksiz=8192, File Type=3 DATA
Dump all the blocks in range:
buffer tsn: 7 rdba: 0x01800002 (6/2)
scn: 0x0000.006ec689 seq: 0x02 flg: 0x04 tail: 0xc6891d02
frmt: 0x02 chkval: 0x8d28 type: 0x1d=KTFB Bitmapped File Space Header
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F1C354AEA00 to 0x00007F1C354B0A00
7F1C354AEA00 0000A21D 01800002 006EC689 04020000 [..........n.....]
7F1C354AEA10 00008D28 00000006 00000008 00001400 [(...............]
7F1C354AEA20 00000009 00000800 003FFFFE 0000007E [..........?.~...]
7F1C354AEA30 000013FF 00000050 00000220 006EC688 [....P... .....n.]
7F1C354AEA40 00000000 00000000 00000000 00000000 [................]
7F1C354AEA50 00000300 00000008 00000000 00000000 [................]
7F1C354AEA60 00000000 00000000 00000000 00000000 [................]
Repeat 504 times
7F1C354B09F0 00000000 00000000 00000000 C6891D02 [................]
File Space Header Block:
Header Control:
RelFno: 6, Unit: 8, Size: 5120, Flag: 9
AutoExtend: YES, Increment: 2048, MaxSize: 4194302
Initial Area: 126, Tail: 5119, First: 80, Free: 544
Deallocation scn: 7259784.0
Header Opcode:
Save: No Pending Op
End dump data block from file /mnt/ramdisk/book/sugar01.dbf minblk 2 maxblk 2
--你可以发现这样实际上访问2个数据块。
SYS@book> alter system dump datafile 6 block 2;
System altered.
*** 2016-11-29 15:15:35.925
Start dump data blocks tsn: 7 file#:6 minblk 2 maxblk 2
Block dump from cache:
Dump of buffer cache at level 4 for tsn=7 rdba=25165826
BH (0x73bf96d0) file#: 6 rdba: 0x01800002 (6/2) class: 13 ba: 0x73ba4000
set: 70 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 35,28
dbwrid: 0 obj: -1 objn: 45 tsn: 7 afn: 6 hint: f
hash: [0x773f98c0,0x849ccd70] lru: [0x73bf98f8,0x73bfa2b8]
ckptq: [NULL] fileq: [NULL] objq: [0x7d1f6fd8,0x7d1f6fd8] objaq: [0x7d1f6fc8,0x7d1f6fc8]
st: XCURRENT md: NULL fpin: 'kttewh00: ktte_get_file_info' tch: 1
flags:
LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [65535]
Block dump from disk:
buffer tsn: 7 rdba: 0x01800002 (6/2)
scn: 0x0000.006ec689 seq: 0x02 flg: 0x04 tail: 0xc6891d02
frmt: 0x02 chkval: 0x8d28 type: 0x1d=KTFB Bitmapped File Space Header
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F1C354AEA00 to 0x00007F1C354B0A00
7F1C354AEA00 0000A21D 01800002 006EC689 04020000 [..........n.....]
7F1C354AEA10 00008D28 00000006 00000008 00001400 [(...............]
7F1C354AEA20 00000009 00000800 003FFFFE 0000007E [..........?.~...]
7F1C354AEA30 000013FF 00000050 00000220 006EC688 [....P... .....n.]
7F1C354AEA40 00000000 00000000 00000000 00000000 [................]
7F1C354AEA50 00000300 00000008 00000000 00000000 [................]
7F1C354AEA60 00000000 00000000 00000000 00000000 [................]
Repeat 504 times
7F1C354B09F0 00000000 00000000 00000000 C6891D02 [................]
File Space Header Block:
Header Control:
RelFno: 6, Unit: 8, Size: 5120, Flag: 9
AutoExtend: YES, Increment: 2048, MaxSize: 4194302
Initial Area: 126, Tail: 5119, First: 80, Free: 544
Deallocation scn: 7259784.0
Header Opcode:
Save: No Pending Op
End dump data blocks tsn: 7 file#: 6 minblk 2 maxblk 2
--仅仅块2的信息。
SYS@book> alter system dump datafile '/mnt/ramdisk/book/sugar01.dbf' block 135;
System altered.
--你可以看到除了文件头信息,还包括块135的信息。也就是使用文件名方式要显示第1块的相关信息。
--即使dump带文件名,要转储135块,这样写:
SYS@book> alter system dump datafile '/mnt/ramdisk/book/sugar01.dbf' block min 135 block max 135;
System altered.
SYS@book> alter system dump datafile '/mnt/ramdisk/book/users01.dbf' block min 135 block max 135;
System altered.
--即使这样也要扫描文件头出现如下信息:
Start dump data block from file /mnt/ramdisk/book/users01.dbf minblk 135 maxblk 135
V10 STYLE FILE HEADER:
Compatibility Vsn = 186647552=0xb200400
Db ID=1337401710=0x4fb7216e, Db Name='BOOK'
Activation ID=0=0x0
Control Seq=44604=0xae3c, File size=6400=0x1900
File Number=4, Blksiz=8192, File Type=3 DATA
Dump all the blocks in range:
buffer tsn: 4 rdba: 0x01000087 (4/135)
scn: 0x0000.000e0ef0 seq: 0x01 flg: 0x06 tail: 0x0ef00601
frmt: 0x02 chkval: 0xe273 type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
--如果你不想使用
alter session set events 'immediate trace name FILE_HDRS level 12';
--要看文件头信息要执行如下:
alter system dump datafile '/mnt/ramdisk/book/sugar01.dbf' block 1;
而不能使用
alter system dump datafile 6 block 1;
--另外一点在mount状态下,不能使用alter system dump datafile 6 block 2;,因为这个时候无法识别文件号,
--一些视图对象还无法访问。