报错
SQL> shutdown immediate
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf'
ORA-01210: data file header is media corrupt
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1593831936 bytes
Fixed Size 8897024 bytes
Variable Size 922746880 bytes
Database Buffers 654311424 bytes
Redo Buffers 7876608 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1:
'/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf'
ORA-01210: data file header is media corrupt
一、修改文件号
BBED> set file 1 block 1;
FILE# 1
BLOCK# 1
BBED> map /v
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Dba:0x00400001
------------------------------------------------------------
BBED-00400: invalid blocktype (30)
BBED> set file 3 block 1
FILE# 3
BLOCK# 1
BBED> map /v
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_k6hqzb4m_.dbf (3)
Block: 1 Dba:0x00c00001
------------------------------------------------------------
Data File Header
struct kcvfh, 1272 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
报错
文件名或路径不对
BBED> set file 3 block 1
BBED-00303: unable to open file '/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_k6hqzb4m_.db'
BBED> copy file 3 block 1 to file 1 block 1;
BBED-00215: editing not allowed in BROWSE mode
BBED> set mode edit
MODE Edit
BBED> copy file 3 block 1 to file 1 block 1
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 0 to 511 Dba:0x00400001
------------------------------------------------------------------------
0ba20000 0100c000 00000000 00000104 9b420000 00000000 00000013 36933461
4f52434c 00000000 38040000 00090100 00200000 03000300 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 68150000 00800000 b512f33b ba47bf41 d14f1d00 00800000 00000000
00000000 00000000 00000400 34000000 7b47bf41 33000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 01000000 06005359 53415558 00000000 00000000
00000000 00000000 00000000 00000000 03000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9f12f33b 01000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 41fb1e00 00800000 5f4bbf41 01000000 05000000 0b2b0200 10003c6f
<32 bytes per line>
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> p kcvfhbfh
struct kcvfhbfh, 20 bytes @0
ub1 type_kcbh @0 0x0b
ub1 frmt_kcbh @1 0xa2
ub2 wrp2_kcbh @2 0x0000
ub4 rdba_kcbh @4 0x00c00001
ub4 bas_kcbh @8 0x00000000
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0x429b
ub2 spare3_kcbh @18 0x0000
BBED> set file 1 block 1 offset 4 count 32
FILE# 1
BLOCK# 1
OFFSET 4
COUNT 32
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 4 to 35 Dba:0x00400001
------------------------------------------------------------------------
0100c000 00000000 00000104 9b420000 00000000 00000013 36933461 4f52434c
<32 bytes per line>
select dbms_utility.data_block_address_file(TO_NUMBER('800001','XXXXXXXX')) file_id,dbms_utility.data_block_address_block(TO_NUMBER('800001','XXXXXXXX')) block_id from dual;
select dbms_utility.data_block_address_file(TO_NUMBER('0100c000','XXXXXXXX')) file_id,dbms_utility.data_block_address_block(TO_NUMBER('0100c000','XXXXXXXX')) block_id from dual;
BBED-00215: editing not allowed in BROWSE mode
BBED> set mode edit
MODE Edit
BBED> modify /x 01008000
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) n
BBED-00311: unable to edit without a BIFILE
BBED> modify /x 01004000
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 4 to 35 Dba:0x00400001
------------------------------------------------------------------------
01004000 00000000 00000104 9b420000 00000000 00000013 36933461 4f52434c
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x421b, required = 0x421b
0x00800001 32bit
0x 00 80 00 01
00000000 10000000 00000000 00000001 00000000 10000000 00000000 00000001
取前十位 0000000010-->2号文件 00000000 01--00800001-01008000
0000 0000 0100 0000 0000 0000 0000 0001->00400001->01004000
00000000 0100->4 ->0x00400001->
机器写法
0x00800001 -> 01 00 80 00
二、修改文件大小
[oracle@19c03:/u01/app/oracle/oradata/ORCL]$ll
total 5673772
drwxr-x--- 2 oracle oinstall 33 Apr 26 20:06 controlfile
drwxr-x--- 2 oracle oinstall 175 Apr 26 20:06 datafile
drwxr-x--- 2 oracle oinstall 93 Apr 26 20:06 onlinelog
-rw-r----- 1 oracle oinstall 209715712 Apr 11 22:14 redo01.log
-rw-r----- 1 oracle oinstall 209715712 Apr 11 22:14 redo02.log
-rw-r----- 1 oracle oinstall 209715712 Apr 11 22:14 redo03.log
-rw-r----- 1 oracle oinstall 692068352 Apr 11 22:22 sysaux01.dbf
-rw-r----- 1 oracle oinstall 1142956032 Apr 11 22:24 system01.dbf
-rw-r----- 1 oracle oinstall 135274496 Apr 11 22:14 temp01.dbf
-rw-r----- 1 oracle oinstall 356524032 Apr 11 22:22 undotbs01.dbf
-rw-r----- 1 oracle oinstall 2987139072 Apr 11 22:22 users01.dbf
sys@orcl> select (1142956032-8192)/8192 from dual;
(1142956032-8192)/8192
----------------------
139520
sys@orcl> select to_char(139520,'xxxxxxxxxx') from dual;
TO_CHAR(139520,'XXXXXX
----------------------
22100
BBED> p kcvfhhdr
struct kcvfhhdr, 76 bytes @20
ub4 kccfhswv @20 0x00000000
ub4 kccfhcvn @24 0x13000000
ub4 kccfhdbi @28 0x61349336
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 0x00000438
ub4 kccfhfsz @44 0x00010900
s_blkz kccfhbsz @48 0x00
ub2 kccfhfno @52 0x0003
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
BBED> set file 1 block 1 offset 44 count 32
FILE# 1
BLOCK# 1
OFFSET 44
COUNT 32
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 44 to 75 Dba:0x00400001
------------------------------------------------------------------------
00090100 00200000 03000300 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> p offset 44
kcvfh.kcvfhhdr.kccfhfsz
-----------------------
ub4 kccfhfsz @44 0x00010900
22100->00 02 21 00->00210200
BBED> modify /x 00210200 offset 44
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 44 to 75 Dba:0x00400001
------------------------------------------------------------------------
00210200 00200000 03000300 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x6a18, required = 0x6a18
三、修改文件号
BBED> p offset 52
kcvfh.kcvfhhdr.kccfhfno
-----------------------
ub2 kccfhfno @52 0x0003
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 52 to 83 Dba:0x00400001
------------------------------------------------------------------------
03000300 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> modify /x 01
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 52 to 83 Dba:0x00400001
------------------------------------------------------------------------
01000300 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x6a1a, required = 0x6a1a
四、修改root数据块号
sys@orcl> select fhrdb,FHFNO from x$kcvfh order by 2;
FHRDB FHFNO
4194824 1
0 3
0 4
0 7
sys@orcl> select to_char(4194824,'xxxxxxxxx') from dual;
TO_CHAR(4194824,'XXX
--------------------
400208
sys@orcl> select dbms_utility.data_block_address_file(TO_NUMBER('400208','XXXXXXXX')) file_id,dbms_utility.data_block_address_block(TO_NUMBER('400208', 'XXXXXXXX'))
2 block_id from dual;
FILE_ID BLOCK_ID
---------- ----------
1 520
sys@orcl> select to_char(520,'xxxxxxxxxxxxxxxxxxx') from dual;
TO_CHAR(520,'XXXXXXXXXXXXXXXXXXX')
----------------------------------------
208
00000000->0000 0000 0000 0000 0000 0000 0000 0000
(0000 0000 0100) (0000 0000 0000 0000 0000)
0 0 4 0 0 2 0 8
->00400208 ->08024000
BBED> p kcvfhrdb
ub4 kcvfhrdb @96 0x00000000
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 96 to 127 Dba:0x00400001
------------------------------------------------------------------------
00000000 68150000 00800000 b512f33b ba47bf41 d14f1d00 00800000 00000000
<32 bytes per line>
BBED> modify /x 08024000 offset 96
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 96 to 127 Dba:0x00400001
------------------------------------------------------------------------
08024000 68150000 00800000 b512f33b ba47bf41 d14f1d00 00800000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x6852, required = 0x6852
五、创建SCN
SQL> select file#,creation_change# from v$datafile;
FILE# CREATION_CHANGE#
---------- ----------------
1 9
3 5480
4 1920446
7 32876
BBED> p kcvfhcrs
struct kcvfhcrs, 8 bytes @100
ub4 kscnbas @100 0x00001568
ub2 kscnwrp @104 0x8000
ub2 kscnwrp2 @106 0x0000
BBED> p offset 100
kcvfh.kcvfhcrs.kscnbas
----------------------
ub4 kscnbas @100 0x00001568
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 100 to 131 Dba:0x00400001
------------------------------------------------------------------------
68150000 00800000 b512f33b ba47bf41 d14f1d00 00800000 00000000 00000000
<32 bytes per line>
BBED> modify /x 0900 offset 100
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 100 to 131 Dba:0x00400001
------------------------------------------------------------------------
09000000 00800000 b512f33b ba47bf41 d14f1d00 00800000 00000000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x7d33, required = 0x7d33
0009->0900
六、创建时间
SQL> select file#,to_char(creation_time,'yyyy-mm-dd hh24:mi:ss') creation_time_file,
2 (to_char(creation_time,'yyyy')-1988)*12*31*24*3600+
3 (to_char(creation_time,'mm')-1)*31*24*3600
4 +(to_char(creation_time,'dd')-1)*24*3600
5 +to_char(creation_time,'hh24')*3600
6 +to_char(creation_time,'mi')*60
7 +to_char(creation_time,'ss') creation_name_scn
8 from v$datafile order by 1;
FILE# CREATION_TIME_FILE CREATION_NAME_SCN
---------- -------------------------------------- -----------------
1 2019-04-17 00:56:09 1005785769
3 2019-04-17 00:56:21 1005785781
4 2019-04-17 02:11:02 1005790262
7 2019-04-17 00:57:08 1005785828
SQL> select file#,to_char(creation_time,'yyyy-mm-dd hh24:mi:ss') creation_time_file,
2 (to_char(creation_time,'yyyy')-1988)*12*31*24*3600+
3 (to_char(creation_time,'mm')-1)*31*24*3600
4 +(to_char(creation_time,'dd')-1)*24*3600
5 +to_char(creation_time,'hh24')*3600
6 +to_char(creation_time,'mi')*60
7 +to_char(creation_time,'ss') creation_name_scn,to_char((to_char(creation_time,'yyyy')-1988)*12*31*24*3600+
8 (to_char(creation_time,'mm')-1)*31*24*3600
9 +(to_char(creation_time,'dd')-1)*24*3600
10 +to_char(creation_time,'hh24')*3600
11 +to_char(creation_time,'mi')*60
12 +to_char(creation_time,'ss'),'xxxxxxxxxxxxxxxx')
13 from v$datafile order by 1;
FILE# CREATION_TIME_FILE CREATION_NAME_SCN TO_CHAR((TO_CHAR(CREATION_TIME,'YY
---------- -------------------------------------- ----------------- ----------------------------------
1 2019-04-17 00:56:09 1005785769 3bf312a9
3 2019-04-17 00:56:21 1005785781 3bf312b5
4 2019-04-17 02:11:02 1005790262 3bf32436
7 2019-04-17 00:57:08 1005785828 3bf312e4
BBED> p kcvfhcrt
ub4 kcvfhcrt @108 0x3bf312b5
BBED> p offset 108
kcvfh.kcvfhcrt
--------------
ub4 kcvfhcrt @108 0x3bf312b5
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 108 to 139 Dba:0x00400001
------------------------------------------------------------------------
b512f33b ba47bf41 d14f1d00 00800000 00000000 00000000 00000000 00000400
<32 bytes per line>
modify /x a912f33b
BBED> modify /x a912f33b
BBED-00209: invalid number (a912f33b)
BBED> modify /x a9 offset 108
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 108 to 139 Dba:0x00400001
------------------------------------------------------------------------
a912f33b ba47bf41 d14f1d00 00800000 00000000 00000000 00000000 00000400
<32 bytes per line>
BBED> modify /x 12 offset 109
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 109 to 140 Dba:0x00400001
------------------------------------------------------------------------
12f33bba 47bf41d1 4f1d0000 80000000 00000000 00000000 00000000 00040034
<32 bytes per line>
BBED> modify /x f3 offset 110
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 110 to 141 Dba:0x00400001
------------------------------------------------------------------------
f33bba47 bf41d14f 1d000080 00000000 00000000 00000000 00000000 04003400
<32 bytes per line>
BBED> modify /x 3b offset 111
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 111 to 142 Dba:0x00400001
------------------------------------------------------------------------
3bba47bf 41d14f1d 00008000 00000000 00000000 00000000 00000004 00340000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x7d2f, required = 0x7d2f
七、文件状态
BBED> p kcvfhsta
ub2 kcvfhsta @138 0x0004 (KCVFHOFZ)
BBED> p offset 138
kcvfh.kcvfhsta
--------------
ub2 kcvfhsta @138 0x0004 (KCVFHOFZ)
01 热备
04 在线
10 介质恢复
40 失效
八、表空间号
SQL> select file#,ts# from v$datafile;
FILE# TS#
---------- ----------
1 0
3 1
4 2
7 4
BBED> p kcvfhtsn
sword kcvfhtsn @332 1
BBED> p offset 332
pad
---
ub1 pad @332 0x01
BBED> set file 1 block 1 offset 332 count 32
FILE# 1
BLOCK# 1
OFFSET 332
COUNT 32
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 332 to 363 Dba:0x00400001
------------------------------------------------------------------------
01000000 06005359 53415558 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> modify /x 00 offset 332
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 332 to 363 Dba:0x00400001
------------------------------------------------------------------------
00000000 06005359 53415558 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x7d2e, required = 0x7d2e
九、修改表空间长度
BBED> p kcvfhtln
ub2 kcvfhtln @336 0x0006
BBED> p kcvfhtnm
text kcvfhtnm[0] @338 S
text kcvfhtnm[1] @339 Y
text kcvfhtnm[2] @340 S
text kcvfhtnm[3] @341 A
text kcvfhtnm[4] @342 U
text kcvfhtnm[5] @343 X
text kcvfhtnm[6] @344
text kcvfhtnm[7] @345
text kcvfhtnm[8] @346
text kcvfhtnm[9] @347
text kcvfhtnm[10] @348
text kcvfhtnm[11] @349
text kcvfhtnm[12] @350
text kcvfhtnm[13] @351
text kcvfhtnm[14] @352
text kcvfhtnm[15] @353
text kcvfhtnm[16] @354
text kcvfhtnm[17] @355
text kcvfhtnm[18] @356
text kcvfhtnm[19] @357
text kcvfhtnm[20] @358
text kcvfhtnm[21] @359
text kcvfhtnm[22] @360
text kcvfhtnm[23] @361
text kcvfhtnm[24] @362
text kcvfhtnm[25] @363
text kcvfhtnm[26] @364
text kcvfhtnm[27] @365
text kcvfhtnm[28] @366
text kcvfhtnm[29] @367
SQL> select dump('SYSTEM',16) from dual;
DUMP('SYSTEM',16)
--------------------------------------------------------------
Typ=96 Len=6: 53,59,53,54,45,4d
BBED> dump offset 338 count 32
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 338 to 369 Dba:0x00400001
------------------------------------------------------------------------
53595341 55580000 00000000 00000000 00000000 00000000 00000000 00000300
<32 bytes per line>
BBED> modify /x 53595354454d offset 338
BBED-00209: invalid number (53595354454d)
BBED> modify /x 53 offset 338
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 338 to 369 Dba:0x00400001
------------------------------------------------------------------------
53595341 55580000 00000000 00000000 00000000 00000000 00000000 00000300
<32 bytes per line>
BBED> modify /x 59 offset 339
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 339 to 370 Dba:0x00400001
------------------------------------------------------------------------
59534155 58000000 00000000 00000000 00000000 00000000 00000000 00030000
<32 bytes per line>
BBED> modify /x 53 offset 340
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 340 to 371 Dba:0x00400001
------------------------------------------------------------------------
53415558 00000000 00000000 00000000 00000000 00000000 00000000 03000000
<32 bytes per line>
BBED> modify /x 54 offset 341
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 341 to 372 Dba:0x00400001
------------------------------------------------------------------------
54555800 00000000 00000000 00000000 00000000 00000000 00000003 00000000
<32 bytes per line>
BBED> modify /x 45 offset 342
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 342 to 373 Dba:0x00400001
------------------------------------------------------------------------
45580000 00000000 00000000 00000000 00000000 00000000 00000300 00000000
<32 bytes per line>
BBED> modify /x 4d offset 343
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 343 to 374 Dba:0x00400001
------------------------------------------------------------------------
4d000000 00000000 00000000 00000000 00000000 00000000 00030000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x7d3e, required = 0x7d3e
BBED> p kcvfhtnm
text kcvfhtnm[0] @338 S
text kcvfhtnm[1] @339 Y
text kcvfhtnm[2] @340 S
text kcvfhtnm[3] @341 T
text kcvfhtnm[4] @342 E
text kcvfhtnm[5] @343 M
text kcvfhtnm[6] @344
text kcvfhtnm[7] @345
text kcvfhtnm[8] @346
text kcvfhtnm[9] @347
text kcvfhtnm[10] @348
text kcvfhtnm[11] @349
text kcvfhtnm[12] @350
text kcvfhtnm[13] @351
text kcvfhtnm[14] @352
text kcvfhtnm[15] @353
text kcvfhtnm[16] @354
text kcvfhtnm[17] @355
text kcvfhtnm[18] @356
text kcvfhtnm[19] @357
text kcvfhtnm[20] @358
text kcvfhtnm[21] @359
text kcvfhtnm[22] @360
text kcvfhtnm[23] @361
text kcvfhtnm[24] @362
text kcvfhtnm[25] @363
text kcvfhtnm[26] @364
text kcvfhtnm[27] @365
text kcvfhtnm[28] @366
text kcvfhtnm[29] @367
十、相对文件号
SQL> select file#,rfile# from v$datafile;
FILE# RFILE#
---------- ----------
1 1
3 3
4 4
7 7
BBED> p kcvfhrfn
ub4 kcvfhrfn @368 0x00000003
BBED> p kcvfhrfn
ub4 kcvfhrfn @368 0x00000003
BBED> p offset 368
pad
---
ub1 pad @368 0x03
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 368 to 879 Dba:0x00400001
------------------------------------------------------------------------
03000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 9f12f33b 01000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 41fb1e00 00800000 5f4bbf41
01000000 05000000 0b2b0200 10003c6f 02000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100 00000000
00000000 00000000 0200c000 b24b1d00 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
02916811 3cac5680 b6937566 0fdd2c96 73000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 002ca567 a3ff484f 36bf9b7a d99d4b58
ec000600 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> modify /x 01 offset 368
BBED-00215: editing not allowed in BROWSE mode
BBED> set mode edit
MODE Edit
BBED> modify /x 01 offset 368
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 368 to 879 Dba:0x00400001
------------------------------------------------------------------------
01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 9f12f33b 01000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 41fb1e00 00800000 5f4bbf41
01000000 05000000 0b2b0200 10003c6f 02000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100 00000000
00000000 00000000 0200c000 b24b1d00 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
02916811 3cac5680 b6937566 0fdd2c96 73000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 002ca567 a3ff484f 36bf9b7a d99d4b58
ec000600 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x7d3c, required = 0x7d3c
十一、文件头检查点SCN
SQL> select file#,CREATION_CHANGE#,CHECKPOINT_CHANGE# ,UNRECOVERABLE_CHANGE#,LAST_CHANGE#,OFFLINE_CHANGE# from v$datafile order by 1;
FILE# CREATION_CHANGE# CHECKPOINT_CHANGE# UNRECOVERABLE_CHANGE# LAST_CHANGE# OFFLINE_CHANGE#
---------- ---------------- ------------------ --------------------- ------------ ---------------
1 9 2030401 0 1920976
3 5480 2030401 0 1920976
4 1920446 2030401 0 1920976
7 32876 2030401 0 1920976
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x001efb41
ub2 kscnwrp @488 0x8000
ub2 kscnwrp2 @490 0x0000
ub4 kcvcptim @492 0x41bf4b5f
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x00000005
ub4 kcrbabno @504 0x00022b0b
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
BBED> p offset 484
pad
---
ub1 pad @484 0x41
SQL> select to_char(2030401,'xxxxxxxxxxxxxxxx') from dual;
TO_CHAR(2030401,'XXXXXXXXXXXXXXXX'
----------------------------------
1efb41
十二、检查点时间
省去介质恢复
SQL> select file#,to_char(CHECKPOINT_TIME,'yyyy-mm-dd hh24:mi:ss')
2 CHECKPOINT_TIME_file,
3 (to_char(CHECKPOINT_TIME,'yyyy')-1988)*12*31*24*3600
4 +(to_char(CHECKPOINT_TIME,'mm')-1)*31*24*3600
5 +(to_char(CHECKPOINT_TIME,'dd')-1)*24*3600
6 +to_char(CHECKPOINT_TIME,'hh24')*3600
7 +to_char(CHECKPOINT_TIME,'mi')*60
8 +to_char(CHECKPOINT_TIME,'ss') CHECKPOINT_TIME_scn
9 from v$datafile order by 1;
FILE# CHECKPOINT_TIME_FILE CHECKPOINT_TIME_SCN
---------- -------------------------------------- -------------------
1 2022-04-26 20:21:51 1103055711
3 2022-04-26 20:21:51 1103055711
4 2022-04-26 20:21:51 1103055711
select file#,to_char(CHECKPOINT_TIME,'yyyy-mm-dd hh24:mi:ss')
CHECKPOINT_TIME_file,
to_char((to_char(CHECKPOINT_TIME,'yyyy')-1988)*12*31*24*3600
+(to_char(CHECKPOINT_TIME,'mm')-1)*31*24*3600
+(to_char(CHECKPOINT_TIME,'dd')-1)*24*3600
+to_char(CHECKPOINT_TIME,'hh24')*3600
+to_char(CHECKPOINT_TIME,'mi')*60
+to_char(CHECKPOINT_TIME,'ss'),'xxxxxxxxxxxxxxxx') CHECKPOINT_TIME_scn
from v$datafile order by 1;
SQL> select file#,to_char(CHECKPOINT_TIME,'yyyy-mm-dd hh24:mi:ss')
2 CHECKPOINT_TIME_file,
3 to_char((to_char(CHECKPOINT_TIME,'yyyy')-1988)*12*31*24*3600
4 +(to_char(CHECKPOINT_TIME,'mm')-1)*31*24*3600
5 +(to_char(CHECKPOINT_TIME,'dd')-1)*24*3600
6 +to_char(CHECKPOINT_TIME,'hh24')*3600
7 +to_char(CHECKPOINT_TIME,'mi')*60
8 +to_char(CHECKPOINT_TIME,'ss'),'xxxxxxxxxxxxxxxx') CHECKPOINT_TIME_scn
9 from v$datafile order by 1;
FILE# CHECKPOINT_TIME_FILE CHECKPOINT_TIME_SCN
---------- -------------------------------------- ----------------------------------
1 2022-04-26 20:21:51 41bf4b5f
3 2022-04-26 20:21:51 41bf4b5f
4 2022-04-26 20:21:51 41bf4b5f
7 2022-04-26 20:21:51 41bf4b5f
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x001efb41
ub2 kscnwrp @488 0x8000
ub2 kscnwrp2 @490 0x0000
ub4 kcvcptim @492 0x41bf4b5f
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x00000005
ub4 kcrbabno @504 0x00022b0b
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
十三、dbv检查文件头修改是否正确
[oracle@19c03:/u01/app/oracle/oradata/ORCL/datafile]$dbv file= /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf
DBVERIFY: Release 19.0.0.0.0 - Production on Wed Apr 27 23:10:59 2022
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf
DBVERIFY - Verification complete
Total Pages Examined : 115200
Total Pages Processed (Data) : 79341
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 12688
Total Pages Failing (Index): 0
Total Pages Processed (Other): 5149
Total Pages Processed (Seg) : 1
Total Pages Failing (Seg) : 0
Total Pages Empty : 18022
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2043696 (0.2043696)
[oracle@19c03:/u01/app/oracle/oradata/ORCL/datafile]$dbv file= /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf start=1 end=2
DBVERIFY: Release 19.0.0.0.0 - Production on Wed Apr 27 23:12:26 2022
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf
DBVERIFY - Verification complete
Total Pages Examined : 2
Total Pages Processed (Data) : 0
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 2
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 0
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2029091 (0.2029091)
十四、启动
SQL> alter database open
2 ;
alter database open
*
ERROR at line 1:
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1:
'/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf'
ORA-01200: actual file size of 115200 is smaller than correct size of 139520
blocks
前面文件的大小没修改对
[oracle@19c03:/u01/app/oracle/oradata/ORCL/datafile]$ll
total 1929380
-rw-r----- 1 oracle oinstall 555753472 Apr 27 00:12 o1_mf_sysaux_k6hqzb4m_.dbf
-rw-r----- 1 oracle oinstall 943726592 Apr 27 22:56 o1_mf_system_k6hqxwt3_.dbf
-rw-r----- 1 oracle oinstall 135274496 Apr 26 23:11 o1_mf_temp_k6hr251g_.tmp
-rw-r----- 1 oracle oinstall 346038272 Apr 27 00:12 o1_mf_undotbs1_k6hr03cr_.dbf
-rw-r----- 1 oracle oinstall 5251072 Apr 26 20:21 o1_mf_users_k6hr04h7_.dbf
SQL> select (943726592-8192)/8192 from dual;
(943726592-8192)/8192
---------------------
115200
SQL> select to_char(115200,'xxxxxxxxxxxx') from dual;
TO_CHAR(115200,'XXXXXXXXXX
--------------------------
1c200
BBED> set file 1 block 1 offset 44 count 32
FILE# 1
BLOCK# 1
OFFSET 44
COUNT 32
BBED> p offset 44
kcvfh.kcvfhhdr.kccfhfsz
-----------------------
ub4 kccfhfsz @44 0x00022100
BBED> dump
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 44 to 75 Dba:0x00400001
------------------------------------------------------------------------
00210200 00200000 01000300 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
1c200->0001c200->00c20100
BBED> modify /x 00c20100 offset 44
File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k6hqxwt3_.dbf (1)
Block: 1 Offsets: 44 to 75 Dba:0x00400001
------------------------------------------------------------------------
00c20100 00200000 01000300 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x9e3f, required = 0x9e3f
SQL> alter database open;
Database altered.
SQL>
最后修改时间:2022-04-28 10:02:08
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。