6

oracle 19c 测试bbed修复数据文件头 -m6米乐安卓版下载

原创 云和恩墨 2022-04-27
2543

报错

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
米乐app官网下载 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
米乐app官网下载 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
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

网站地图