文档课题:运用bbed查数据文件头部记录的控制文件seq号.
1、定义测试文件
--为方便测试,定义一个文件,将数据文件查询出来,放到参数文件中.
[oracle@leo-oracle-11g ~]$ vi parameter.txt
blocksize=8192
listfile=dbfiles.txt
mode=edit
[oracle@leo-oracle-11g ~]$ vi dbfiles.txt
1 /u01/app/oracle/oradata/orcl/system01.dbf 817889280
2 /u01/app/oracle/oradata/orcl/sysaux01.dbf 534773760
3 /u01/app/oracle/oradata/orcl/undotbs01.dbf 529530880
4 /u01/app/oracle/oradata/orcl/users01.dbf 5242880
说明:如上内容为通过以下语句查询所得.
select file# || chr(9) || name || chr(9) || bytes from v$datafile;
2、BBED确认SEQ
--以4号文件users01.dbf作为测试文件.
BBED> set file 4
FILE# 4
BBED> set block 1
BLOCK# 1
--查看block里面的信息.
BBED> map /v
File: /u01/app/oracle/oradata/orcl/users01.dbf (4)
Block: 1 Dba:0x01000001
------------------------------------------------------------
Data File Header
struct kcvfh, 860 bytes @0
struct kcvfhbfh, 20 bytes @0
struct kcvfhhdr, 76 bytes @20
ub4 kcvfhrdb @96
struct kcvfhcrs, 8 bytes @100
ub4 kcvfhcrt @108
ub4 kcvfhrlc @112
struct kcvfhrls, 8 bytes @116
ub4 kcvfhbti @124
struct kcvfhbsc, 8 bytes @128
ub2 kcvfhbth @136
ub2 kcvfhsta @138
struct kcvfhckp, 36 bytes @484
ub4 kcvfhcpc @140
ub4 kcvfhrts @144
ub4 kcvfhccc @148
struct kcvfhbcp, 36 bytes @152
ub4 kcvfhbhz @312
struct kcvfhxcd, 16 bytes @316
sword kcvfhtsn @332
ub2 kcvfhtln @336
text kcvfhtnm[30] @338
ub4 kcvfhrfn @368
struct kcvfhrfs, 8 bytes @372
ub4 kcvfhrft @380
struct kcvfhafs, 8 bytes @384
ub4 kcvfhbbc @392
ub4 kcvfhncb @396
ub4 kcvfhmcb @400
ub4 kcvfhlcb @404
ub4 kcvfhbcs @408
ub2 kcvfhofb @412
ub2 kcvfhnfb @414
ub4 kcvfhprc @416
struct kcvfhprs, 8 bytes @420
struct kcvfhprfs, 8 bytes @428
ub4 kcvfhtrt @444
ub4 tailchk @8188
说明:
struct kcvfhbfh, 20 bytes @0
struct kcvfhhdr, 76 bytes @20
ub4 kcvfhrdb @96
如以上三条:
struct kcvfhbfh, 20 bytes @0 表示:从0 bite到19bite
struct kcvfhhdr, 76 bytes @20 表示:从20到75bite
若想查询kcvfhhdr 这76 bite具体信息,使用命令:print kcvfhhdr
BBED> print kcvfhhdr
struct kcvfhhdr, 76 bytes @20
ub4 kccfhswv @20 0x00000000
ub4 kccfhcvn @24 0x0b200400
ub4 kccfhdbi @28 0x62dd1e14
text kccfhdbn[0] @32 O
text kccfhdbn[1] @33 R
text kccfhdbn[2] @34 C
text kccfhdbn[3] @35 L
text kccfhdbn[4] @36
text kccfhdbn[5] @37
text kccfhdbn[6] @38
text kccfhdbn[7] @39
ub4 kccfhcsq @40 0x0000054b
ub4 kccfhfsz @44 0x00000280
s_blkz kccfhbsz @48 0x00
ub2 kccfhfno @52 0x0004
ub2 kccfhtyp @54 0x0003
ub4 kccfhacid @56 0x00000000
ub4 kccfhcks @60 0x00000000
text kccfhtag[0] @64
text kccfhtag[1] @65
text kccfhtag[2] @66
text kccfhtag[3] @67
text kccfhtag[4] @68
text kccfhtag[5] @69
text kccfhtag[6] @70
text kccfhtag[7] @71
text kccfhtag[8] @72
text kccfhtag[9] @73
text kccfhtag[10] @74
text kccfhtag[11] @75
text kccfhtag[12] @76
text kccfhtag[13] @77
text kccfhtag[14] @78
text kccfhtag[15] @79
text kccfhtag[16] @80
text kccfhtag[17] @81
text kccfhtag[18] @82
text kccfhtag[19] @83
text kccfhtag[20] @84
text kccfhtag[21] @85
text kccfhtag[22] @86
text kccfhtag[23] @87
text kccfhtag[24] @88
text kccfhtag[25] @89
text kccfhtag[26] @90
text kccfhtag[27] @91
text kccfhtag[28] @92
text kccfhtag[29] @93
text kccfhtag[30] @94
text kccfhtag[31] @95
说明:如上所示,(ub4 kccfhcsq @40 0x0000054b)包含数据文件头部记录的控制文件seq信息,0x0000054b转换为10进制为1355.
3、x$kcvfh确认SEQ
--通过表x$kcvfh查询数据文件头部记录的控制文件seq信息
[oracle@leo-oracle-11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 8 23:52:00 2023
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@orcl> select hxfil,fhcsq,fhscn,fhrba_seq from x$kcvfh;
HXFIL FHCSQ FHSCN FHRBA_SEQ
---------- ---------- ---------------- ----------
1 1355 2050421 31
2 1707 2050421 31
3 1355 2050421 31
4 1355 2050421 31
说明:如上,4号文件的fhcsq为控制文件的seq号,数值是吻合的.