控制文件dump内容解析,希望本文帮助大家解析Oracle 控制文件提供一个好的思路!
控制文件块内容分布
SQL> SELECT TYPE,
1 RECORD_SIZE,
2 RECORDS_TOTAL,
3 RECORD_SIZE*RECORDS_TOTAL,
4 ceil(record_size*records_total/((8*1024)-24))
5 FROM v$controlfile_record_section;
TYPE RECORD_SIZE RECORDS_TOTAL SIZE BLOCK# BLOCKS
---------------------------- ----------- ------------- ------- ------- ---------
TITLE 1 1 1 1
DATABASE 316 1 316 2 1
CKPT PROGRESS 8180 11 89980 3 12
REDO THREAD 256 8 2048 15 1
REDO LOG 72 16 1152 16 1
DATAFILE 520 1024 532480 17 66
FILENAME 524 4146 2172504 83 266
TABLESPACE 180 1024 184320 349 23
TEMPORARY FILENAME 56 1024 57344 372 8
RMAN CONFIGURATION 1108 50 55400 380 7
LOG HISTORY 56 292 16352 387 3
OFFLINE RANGE 200 1063 212600 390 27
ARCHIVED LOG 584 28 16352 417 3
BACKUP SET 96 1022 98112 420 13
BACKUP PIECE 780 1006 784680 433 97
BACKUP DATAFILE 200 1063 212600 530 27
BACKUP REDOLOG 76 215 16340 557 3
DATAFILE COPY 736 1000 736000 560 91
BACKUP CORRUPTION 44 1115 49060 651 7
COPY CORRUPTION 40 1227 49080 658 7
DELETED OBJECT 20 818 16360 665 3
PROXY COPY 928 1004 931712 668 115
BACKUP SPFILE 124 131 16244 783 2
DATABASE INCARNATION 56 292 16352 785 3
FLASHBACK LOG 84 2048 172032 788 22
RECOVERY DESTINATION 180 1 180 810 1
INSTANCE SPACE RESERVATION 28 1055 29540 811 4
REMOVABLE RECOVERY FILES 32 1000 32000 815 4
RMAN STATUS 116 141 16356 819 3
THREAD INSTANCE NAME MAPPING 80 8 640 822 1
MTTR 100 8 800 823 1
DATAFILE HISTORY 568 57 32376 824 4
STANDBY DATABASE MATRIX 400 128 51200 828 7
GUARANTEED RESTORE POINT 256 2048 524288 835 65
RESTORE POINT 256 2108 539648 900 67
DATABASE BLOCK CORRUPTION 80 8384 670720 967 83
ACM OPERATION 104 64 6656 1050 1
FOREIGN ARCHIVED LOG 604 1002 605208 1051 75
PDB RECORD 780 10 7800 1126 1
AUXILIARY DATAFILE COPY 584 128 74752 1127 10
MULTI INSTANCE REDO APPLY 556 1 556 1137 1
PDBINC RECORD 144 113 16272 1139 2
TABLESPACE KEY HISTORY 108 151 16308 1141 2
下面找几个块,进行解析,了解控制文件数据存储方式。
文件头块
BBED> set filename '/oradata/ORCL/control01.ctl'
FILENAME /oradata/ORCL/control01.ctl
BBED> set block 0
BLOCK# 0
BBED> dump
File: /oradata/ORCL/control01.ctl (0)
Block: 0 Offsets: 0 to 511 Dba:0x00000000
00c20000 0000c0ff 00000000 00000004 10fa0000 00400000 76040000 7d7c7b7a
a0810000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
- offset 1:c2,blocksize
- 82=4096
- a2=8192
- c2=16384
- e2=32768
- offset 6~7:c0ff
- offset 16~17:10fa,file related to growth(unit block)
- offset 20~21
- blocksize:0040–>4000(0100 0000 0000 0000)=16384,控制文件每个块的内容由两个8k块构成,其中一个为影子块
- offset 24~25:7604,块的数量
- offset 28~31:7d7c7b7a,magic number
- offset 32~33:a081
1 号块:文件头信息
BBED
BBED> set block 1
BLOCK# 1
BBED> dump
File: /oradata/ORCL/control01.ctl (0)
Block: 1 Offsets: 0 to 511 Dba:0x00000000
15c20000 01000000 00000000 00000104 dc0c0000 00000000 00000013 56e1dd5c
4f52434c 00000000 1e100000 76040000 00400000 00000100 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b05f355d d795683d bbe60b00 00800000 65cac03d 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
DUMP
DUMP OF CONTROL FILES, Seq # 4126 = 0x101e
V10 STYLE FILE HEADER:
Compatibility Vsn = 318767104=0x13000000
Db ID=1558045014=0x5cdde156, Db Name=’ORCL’
Activation ID=0=0x0
Control Seq=4126=0x101e, File size=1142=0x476
File Number=0, Blksiz=16384, File Type=1 CONTROL
分析
- offset 0~0:15,表示mask
- offset 1~1:c2,表示blocksize
- offset 4~4:01,表示No.1 block
-
offset 24~27:00000013(倒序),表示Version(13.0.0.0)
此处对应dump:Compatibility Vsn = 318767104=0x13000000
-
offset 28~31:56e1dd5c(倒序),表示DBID
此处对应dump:Db ID=1558045014=0x5cdde156
-
offset 32~39:4f52434c 00000000,表示DBNAME
此处对应dump:Db Name=’ORCL’
下面对比一下16进制转码和dump获取的值,即可得证
SQL> select dump('ORCL') from dual;
DUMP('ORCL')
--------------------------------------------------
Typ=96 Len=4: 79,82,67,76
SQL> select to_number('4f','xx'),
2 to_number('52','xx'),
3 to_number('43','xx'),
4 to_number('4c','xx')
5 from dual;
TO_NUMBER('4F','XX') TO_NUMBER('52','XX') TO_NUMBER('43','XX') TO_NUMBER('4C','XX')
-------------------- -------------------- -------------------- --------------------
79 82 67 76
-
offset 40~41:1e10,表示sequence
此处对应dump:Control Seq=4126=0x101e
-
offset 44~45:7604(倒序),表示file size(block Number)
此处对应dump:File size=1142=0x476
-
offset 49~50:0400(倒序),表示blocksize 16384
此处对应dump:Blksiz=16384
-
offset 53~54:0000,表示fileNo
此处对应dump:File Number=0
-
offset 55~56:0100,表示fileType
此处对应dump:File Type=1 CONTROL
-
offset 105~108:bbe60b00(倒序),表示控制文件SCN
Controlfile Checkpointed at scn: 0x00000000000be6bb
3 号块:CHECKPOINT PROGRESS RECORDS
BBED> set block 3
BLOCK# 3
BBED> dump
File: /oradata/ORCL/control01.ctl (0)
Block: 3 Offsets: 0 to 511 Dba:0x00000000
15c20000 03000000 00000000 00000104 4abb0000 01000000 00000000 00000000
ffffffff ffffffff ffff0000 13000000 c8790000 00000000 39eb0b00 00000000
90cac03d d695683d 01000000 00000000 24a9c03d b05f355d 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 13000000
01000000 0000d7cc 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
CHECKPOINT PROGRESS RECORDS
(size = 8180, compat size = 8180, section max = 11, section in-use = 0,
last-recid= 0, old-recno = 0, last-recno = 0)
(extent = 1, blkno = 2, numrecs = 11)
THREAD #1 - status:0x1 flags:0x0 dirty:0
low cache rba:(0xffffffff.ffffffff.ffff) on disk rba:(0x13.79c8.0)
on disk scn: 0x00000000000beb39 03/26/2020 06:15:44
resetlogs scn: 0x0000000000000001 01/21/2020 08:31:18
heartbeat: 1036034387 mount id: 1563778992
- offset 4~4:033,表示No. 3 block
- offset 15~16:各版本不发生变化
- offset 20~20:01,表示thread status
- 1 表示线程关闭
- 2 表示线程出于open状态
-
offset 32~41:ffffffff ffffffff ffff,表示low cache rba
此处对应dump:low cache rba:(0xffffffff.ffffffff.ffff)
-
offset 42~51:0000 13000000 c8790000,表示on disk rba
此处对应dump:on disk rba:(0x13.79c8.0)
-
offset 56~59:39eb0b00,表示on disk scn
此处对应dump:on disk scn: 0x00000000000beb39
-
offset 72~75:01000000,表示resetlogs scn
此处对应dump:resetlogs scn: 0x0000000000000001
其它
控制文件存储内容就不一一进行解析了,希望以上介绍会对解析Oracle 控制文件成为一个好的开始。