[20170406]关于文件头转储.txt
--//oracle 数据库文件头转储使用如下命令alter session set events 'immediate trace name file_hdrs level 12' ;
--//实际上里面有一部分信息来自控制文件,在分析时注意,通过例子来说明:
1.环境:
SYS@book> @ &r/ver
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SYS@book> @ &r/spid
SID SERIAL# SPID PID P_SERIAL# C50
---------- ---------- ------ ------- ---------- --------------------------------------------------
56 49 16397 29 17 alter system kill session '56,49' immediate;
$ ls -l /proc/16397/fd
total 0
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 0 -> /dev/null
l-wx------ 1 oracle oinstall 64 2017-04-06 15:28:32 1 -> /dev/null
l-wx------ 1 oracle oinstall 64 2017-04-06 15:28:32 12 -> pipe:[25896412]
l-wx------ 1 oracle oinstall 64 2017-04-06 15:28:32 2 -> /dev/null
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 3 -> /dev/null
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 4 -> /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/oraus.msb
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 5 -> /proc/16397/fd
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 6 -> /dev/zero
lrwx------ 1 oracle oinstall 64 2017-04-06 15:28:32 7 -> /u01/app/oracle/admin/book/adump/book_ora_16397_20170406152806864944143795.aud
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 9 -> pipe:[25896411]
--//没有控制文件.打开跟踪:
$ strace -f -p 16397 -trace=pread -o /tmp/aa.txt
2.转储:
SYS@book> alter session set events 'immediate trace name file_hdrs level 12' ;
Session altered.
$ ls -l /proc/16397/fd
total 0
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 0 -> /dev/null
l-wx------ 1 oracle oinstall 64 2017-04-06 15:28:32 1 -> /dev/null
l-wx------ 1 oracle oinstall 64 2017-04-06 15:30:44 10 -> /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_16397.trc
l-wx------ 1 oracle oinstall 64 2017-04-06 15:30:44 11 -> /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_16397.trm
l-wx------ 1 oracle oinstall 64 2017-04-06 15:28:32 12 -> pipe:[25896412]
l-wx------ 1 oracle oinstall 64 2017-04-06 15:28:32 2 -> /dev/null
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 256 -> /mnt/ramdisk/book/control01.ctl
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 257 -> /mnt/ramdisk/book/control02.ctl
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 258 -> /mnt/ramdisk/book/system01.dbf
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 259 -> /mnt/ramdisk/book/sysaux01.dbf
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 260 -> /mnt/ramdisk/book/undotbs01.dbf
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 261 -> /mnt/ramdisk/book/users01.dbf
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 262 -> /mnt/ramdisk/book/example01.dbf
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 263 -> /mnt/ramdisk/book/tea01.dbf
lrwx------ 1 oracle oinstall 64 2017-04-06 15:30:44 264 -> /mnt/ramdisk/book/temp01.dbf
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 3 -> /dev/null
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 4 -> /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/oraus.msb
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 5 -> /proc/16397/fd
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 6 -> /dev/zero
lrwx------ 1 oracle oinstall 64 2017-04-06 15:28:32 7 -> /u01/app/oracle/admin/book/adump/book_ora_16397_20170406152806864944143795.aud
lr-x------ 1 oracle oinstall 64 2017-04-06 15:28:32 9 -> pipe:[25896411]
--//你可以发现执行完成后打开了控制文件以及数据文件.
$ grep "pread" /tmp/aa.txt
16397 0.000133 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000166 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000117 pread(256, "\25\302\0\0\17\0\0\0\302\222\0\0\377\377\1\4(!\0\0\0C\0\0\0\0\0\0\0\0\0\4"..., 16384, 245760) = 16384
16397 0.000107 pread(256, "\25\302\0\0\21\0\0\0\302\222\0\0\377\377\1\4\311n\0\0\0\0\0\0\0\0\0\0\256\36q5"..., 16384, 278528) = 16384
16397 0.000106 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000108 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000115 pread(256, "\25\302\0\0\17\0\0\0\302\222\0\0\377\377\1\4(!\0\0\0C\0\0\0\0\0\0\0\0\0\4"..., 16384, 245760) = 16384
16397 0.000104 pread(256, "\25\302\0\0\21\0\0\0\302\222\0\0\377\377\1\4\311n\0\0\0\0\0\0\0\0\0\0\256\36q5"..., 16384, 278528) = 16384
16397 0.000102 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000107 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000101 pread(256, "\25\302\0\0\17\0\0\0\302\222\0\0\377\377\1\4(!\0\0\0C\0\0\0\0\0\0\0\0\0\4"..., 16384, 245760) = 16384
16397 0.000104 pread(256, "\25\302\0\0\21\0\0\0\302\222\0\0\377\377\1\4\311n\0\0\0\0\0\0\0\0\0\0\256\36q5"..., 16384, 278528) = 16384
16397 0.000110 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000107 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000101 pread(256, "\25\302\0\0\17\0\0\0\302\222\0\0\377\377\1\4(!\0\0\0C\0\0\0\0\0\0\0\0\0\4"..., 16384, 245760) = 16384
16397 0.000105 pread(256, "\25\302\0\0\21\0\0\0\302\222\0\0\377\377\1\4\311n\0\0\0\0\0\0\0\0\0\0\256\36q5"..., 16384, 278528) = 16384
16397 0.000146 pread(256, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000109 pread(257, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4$\346\0\0\0\0\0\0\0\4 \vn!\267O"..., 16384, 16384) = 16384
16397 0.000102 pread(256, "\25\302\0\0\17\0\0\0\302\222\0\0\377\377\1\4(!\0\0\0C\0\0\0\0\0\0\0\0\0\4"..., 16384, 245760) = 16384
16397 0.000110 pread(256, "\25\302\0\0\21\0\0\0\302\222\0\0\377\377\1\4\311n\0\0\0\0\0\0\0\0\0\0\256\36q5"..., 16384, 278528) = 16384
16397 0.000098 pread(256, "\25\302\0\0\27\0\0\0:\222\0\0\377\377\1\4w'\0\0\0\0\0\0\0 \0\0\16\0\0\0"..., 16384, 376832) = 16384
16397 0.000113 pread(256, "\25\302\0\0 \0\0\0/\222\0\0\377\377\1\4\267\7\0\0\3\0\3\0\0\0\0\0\0\0/m"..., 16384, 524288) = 16384
16397 0.000111 pread(258, "\v\242\0\0\1\0@\0\0\0\0\0\0\0\1\4=\r\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192
16397 0.000103 pread(259, "\v\242\0\0\1\0\200\0\0\0\0\0\0\0\1\4\364\342\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192
16397 0.000105 pread(260, "\v\242\0\0\1\0\300\0\0\0\0\0\0\0\1\4\325\240\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192
16397 0.000103 pread(261, "\v\242\0\0\1\0\0\1\0\0\0\0\0\0\1\0043\23\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192
16397 0.000128 pread(262, "\v\242\0\0\1\0@\1\0\0\0\0\0\0\1\4\273N\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192
16397 0.000103 pread(263, "\v\242\0\0\1\0\200\1\0\0\0\0\0\0\1\4\32\215\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192
16397 0.000089 pread(256, "\25\302\0\0\265\0\0\0|\2\0\0\377\377\1\4z\362\0\0\0\n\0\0\0 \0\0\36\0\10\0"..., 16384, 2965504) = 16384
16397 0.000102 pread(264, "\v\242\0\0\1\0@\0\0\0\0\0\0\0\1\4\312\6\0\0\0\0\0\0\0\4 \vn!\267O"..., 8192, 8192) = 8192
--//可以发现转储时也读取了控制文件后,在依次读取数据文件句柄258,259,.... ,然后在读取控制文件,在读取临时文件.句柄264.
3.通过bbed改写文件头确认里面的信息:
SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@book> startup mount
ORACLE instance started.
Total System Global Area 634732544 bytes
Fixed Size 2255792 bytes
Variable Size 197133392 bytes
Database Buffers 427819008 bytes
Redo Buffers 7524352 bytes
Database mounted.
SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ NAME TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------- ----------------
1 13277116630 2017-04-06 15:40:05 7 925702 ONLINE 937 NO /mnt/ramdisk/book/system01.dbf SYSTEM
2 13277116630 2017-04-06 15:40:05 1834 925702 ONLINE 926 NO /mnt/ramdisk/book/sysaux01.dbf SYSAUX
3 13277116630 2017-04-06 15:40:05 923328 925702 ONLINE 847 NO /mnt/ramdisk/book/undotbs01.dbf UNDOTBS1
4 13277116630 2017-04-06 15:40:05 16143 925702 ONLINE 932 NO /mnt/ramdisk/book/users01.dbf USERS
5 13277116630 2017-04-06 15:40:05 952916 925702 ONLINE 843 NO /mnt/ramdisk/book/example01.dbf EXAMPLE
6 13277116630 2017-04-06 15:40:05 13276257767 925702 ONLINE 316 NO /mnt/ramdisk/book/tea01.dbf TEA
6 rows selected.
--//数据文件6 CHECKPOINT_COUNT=316,我增加到416看看.
BBED> p /d dba 6,1 kcvfh.kcvfhcpc
ub4 kcvfhcpc @140 316
BBED> p /d dba 6,1 kcvfh.kcvfhccc
ub4 kcvfhccc @148 315
--//我这两个数值增加100看看.
BBED> assign dba 6,1 kcvfh.kcvfhcpc=416
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub4 kcvfhcpc @140 0x000001a0
BBED> assign dba 6,1 kcvfh.kcvfhccc=415
ub4 kcvfhccc @148 0x0000019f
BBED> sum apply dba 6,1
Check value for File 6, Block 1:
current = 0x3d1b, required = 0x3d1b
SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ NAME TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------------------------- ------------------------------
1 13277116630 2017-04-06 15:40:05 7 925702 ONLINE 937 NO /mnt/ramdisk/book/system01.dbf SYSTEM
2 13277116630 2017-04-06 15:40:05 1834 925702 ONLINE 926 NO /mnt/ramdisk/book/sysaux01.dbf SYSAUX
3 13277116630 2017-04-06 15:40:05 923328 925702 ONLINE 847 NO /mnt/ramdisk/book/undotbs01.dbf UNDOTBS1
4 13277116630 2017-04-06 15:40:05 16143 925702 ONLINE 932 NO /mnt/ramdisk/book/users01.dbf USERS
5 13277116630 2017-04-06 15:40:05 952916 925702 ONLINE 843 NO /mnt/ramdisk/book/example01.dbf EXAMPLE
6 13277116630 2017-04-06 15:40:05 13276257767 925702 ONLINE 416 NO /mnt/ramdisk/book/tea01.dbf TEA
6 rows selected.
--//数据文件6的CHECKPOINT_COUNT=416.
4.再继续执行转储看看:
SYS@book> alter session set events 'immediate trace name file_hdrs level 12' ;
Session altered.
--//检查转储内容:
DATA FILE #6:
name #10: /mnt/ramdisk/book/tea01.dbf
creation size=5120 block size=8192 status=0xe head=10 tail=10 dup=1
tablespace 7, index=7 krfil=6 prev_file=0
unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:316 scn: 0x0003.1760b8d6 04/06/2017 15:40:05
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stop scn: 0x0003.1760b8d6 04/06/2017 15:40:05
Creation Checkpointed at scn: 0x0003.17539de7 02/13/2017 15:09:58
thread:1 rba:(0x1d6.48.10)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
Offline scn: 0x0003.175f8300 prev_range: 0
Online Checkpointed at scn: 0x0003.175f8324 04/05/2017 11:10:42
thread:1 rba:(0x2f9.195e.10)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
Hot Backup end marker scn: 0x0000.00000000
aux_file is NOT DEFINED
Plugged readony: NO
Plugin scnscn: 0x0000.00000000
Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
Online move state: 0
V10 STYLE FILE HEADER:
Compatibility Vsn = 186647552=0xb200400
Db ID=1337401710=0x4fb7216e, Db Name='BOOK'
Activation ID=0=0x0
Control Seq=37574=0x92c6, File size=5120=0x1400
File Number=6, Blksiz=8192, File Type=3 DATA
Tablespace #7 - TEA rel_fn:6
Creation at scn: 0x0003.17539de7 02/13/2017 15:09:58
Backup taken at scn: 0x0003.175f8350 04/05/2017 11:11:14 thread:1
reset logs count:0x35711eb0 scn: 0x0000.000e2006
prev reset logs count:0x3121c97a scn: 0x0000.00000001
recovered at 04/05/2017 11:15:13
status:0x0 root dba:0x00000000 chkpt cnt: 416 ctl cnt:415
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
begin-hot-backup file size: 5120
Checkpointed at scn: 0x0003.1760b8d6 04/06/2017 15:40:05
thread:1 rba:(0x30f.f5fb.10)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
Backup Checkpointed at scn: 0x0003.175f8350 04/05/2017 11:11:14
thread:1 rba:(0x2f9.1987.10)
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
External cache id: 0x0 0x0 0x0 0x0
Absolute fuzzy scn: 0x0000.00000000
Recovery fuzzy scn: 0x0000.00000000 01/01/1988 00:00:00
Terminal Recovery Stamp 01/01/1988 00:00:00
Platform Information: Creation Platform ID: 13
Current Platform ID: 13 Last Platform ID: 13
DUMP OF TEMP FILES: 1 files in database
--//注意看下划线部分
Checkpoint cnt:316 scn: 0x0003.1760b8d6 04/06/2017 15:40:05
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
status:0x0 root dba:0x00000000 chkpt cnt: 416 ctl cnt:415
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--//很明显前面部分来自控制文件.
DATA FILE #6:来自控制文件.
V10 STYLE FILE HEADER:的内容才来自数据文件头.
--//在工作中分析注意,实际上我觉得oracle应该在转储时说明 仅仅加入一段信息DATA FILE #6 from controlfile就ok了.
5.看看这样能open吗?
SYS@book> alter database open ;
alter database open
*
ERROR at line 1:
ORA-01122: database file 6 failed verification check
ORA-01110: data file 6: '/mnt/ramdisk/book/tea01.dbf'
ORA-01207: file is more recent than control file - old control file
--//改小看看是否可行.
BBED> assign dba 6,1 kcvfh.kcvfhcpc=306
ub4 kcvfhcpc @140 0x00000132
BBED> assign dba 6,1 kcvfh.kcvfhccc=305
ub4 kcvfhccc @148 0x00000131
BBED> sum apply dba 6,1
Check value for File 6, Block 1:
current = 0x3d27, required = 0x3d27
SYS@book> alter database open ;
alter database open
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/mnt/ramdisk/book/tea01.dbf'
SYS@book> recover datafile 6
Media recovery complete.
SYS@book> alter database open ;
Database altered.
SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ NAME TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------- ----------------
1 13277116634 2017-04-06 15:54:45 7 925702 ONLINE 938 YES /mnt/ramdisk/book/system01.dbf SYSTEM
2 13277116634 2017-04-06 15:54:45 1834 925702 ONLINE 927 YES /mnt/ramdisk/book/sysaux01.dbf SYSAUX
3 13277116634 2017-04-06 15:54:45 923328 925702 ONLINE 848 YES /mnt/ramdisk/book/undotbs01.dbf UNDOTBS1
4 13277116634 2017-04-06 15:54:45 16143 925702 ONLINE 933 YES /mnt/ramdisk/book/users01.dbf USERS
5 13277116634 2017-04-06 15:54:45 952916 925702 ONLINE 844 YES /mnt/ramdisk/book/example01.dbf EXAMPLE
6 13277116634 2017-04-06 15:54:45 13276257767 925702 ONLINE 318 YES /mnt/ramdisk/book/tea01.dbf TEA
6 rows selected.
--//open后CHECKPOINT_COUNT增加2.
--//实际上我自己有补充测试1次,recover datafile 6后在控制文件的基础上+1.open后有增加1.
总之一点注意转储数据文件头时,有部分信息来自控制文件,切记!!