system資料檔案頭損壞修復

老w愛db發表於2023-10-04

開啟資料庫讀取資料檔案頭

sys
@ORADB 
2023
-
10
-
04 
23
:
24
:
43
> startup mount

ORACLE instance started.

Total System Global Area 5016385624 bytes
Fixed Size                   8906840 bytes
Variable Size             905969664 bytes
Database Buffers         4093640704 bytes
Redo Buffers                 7868416 bytes
Database mounted.
sys
@ORADB 
04
-OCT
-
23
> 
alter 
session 
set 
events 
'10046 trace name context forever,level 8'
;

Session altered.
sys
@ORADB 
04
-OCT
-
23
> 
alter 
database 
open
;

Database altered.



sys @ORADB 04 -OCT - 23 > alter session set events '10046 trace name context off' ;
Session altered.
sys
@ORADB 
04
-OCT
-
23
> 
select 
value 
from v$diag_info 
where name
=
'Default Trace File'
;


VALUE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/oradb/oradb/trace/oradb_ora_69514 .trc



WAIT #140100028296592: nam='db file sequential read' ela= 4 file#=1 block#=1 blocks=1 obj#=-1 tim=62376426604

登入bbed:




[oracle@wy19c:~]$ bbed parfile=par.txt

info檢視:

BBED> info

File#  Name                                                        Size(blks)
-----  ----                                                        ----------
    1  /oradata/ORADB/system01.dbf                                     116480
    3  /oradata/ORADB/sysaux01.dbf                                      76800
    4  /oradata/ORADB/undotbs01.dbf                                     44800
    7  /oradata/ORADB/users01.dbf                                         640

破壞system檔案頭:

BBED
> copy file 
7 block 
10 
to file 
1 block 
1

File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :     0 to   511           Dba : 0x00400001
------------------------------------------------------------------------
1ea20000 0a00c001 6f800000 00000204 65010000 07000000 80403600 00000000
00000000 00f80000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BBED
> 
sum apply

Check value for File 1 , Block 1 :
current = 0x0165 , required = 0x0165
sys
@ORADB 
2023
-
10
-
04 
23
:
59
:
12
> shu immediate

ORA - 01122 : database file 1 failed verification check
ORA - 01110 : data file 1 : '/oradata/ORADB/system01.dbf'
ORA - 01210 : data file header is media corrupt
sys
@ORADB 
2023
-
10
-
04 
23
:
59
:
36
> 
shutdown abort

ORACLE instance shut down.
sys @ORADB 2023 - 10 - 04 23 : 59 : 48 > startup
ORACLE instance started.

Total System Global Area 5016385624 bytes
Fixed Size                   8906840 bytes
Variable Size             905969664 bytes
Database Buffers         4093640704 bytes
Redo Buffers                 7868416 bytes
Database mounted.
ORA - 01122 : database file 1 failed verification check
ORA - 01110 : data file 1 : '/oradata/ORADB/system01.dbf'
ORA - 01210 : data file header is media corrupt

無效塊型別:

BBED
> 
set file 
1 block 
1

       FILE #           1
       BLOCK #          1

BBED > map /v
File : /oradata/ORADB/system01 .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 : /oradata/ORADB/sysaux01 .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
> copy file 
3 block 
1 
to file 
1 block 
1

Warning : contents of previous BIFILE will be lost. Proceed ? (Y/N ) y
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :     0 to   511           Dba : 0x00400001
------------------------------------------------------------------------
0ba20000 0100c000 00000000 00000104 8a9c0000 00000000 00000013 c825ffac
4f524144 42000000 ca0b0000 003b0100 00200000 03000300 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000
00000000 00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 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 4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95

< 32 bytes per line >

BBED > sum apply
Check value for File 1 , Block 1 :
current = 0x9c8a , required = 0x9c8a

檢視檔案頭結構:

BBED
> 
set file 
1 block 
1

       FILE #           1
       BLOCK #          1

BBED > map /v
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                                     Dba : 0x00400001
------------------------------------------------------------
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

修復檔案頭需要調整部分:

 rdba_kcbh(offset 4) 檔案頭block的rdba地址

kccfhfsz (offset 44) 檔案大小
kccfhfno (offset 52) datafile檔案號
kcvfhrdb (offset 96) root dba
kscnbas (offset 100) v$datafile.creation_change#
kcvfhcrt (offset 108) v$datafile.creation_time
kcvfhsta (offset 138) 檔案狀態
kcvfhtsn (offset 332) 表空間號v$datafile.ts#
kcvfhtln (offset 336) 表空間名稱字元長度
kcvfhtnm (offset 338) 表空間名稱v$tablespace.name
kcvfhrfn (offset 368) 相對檔案號v$datafile.rfile#
kscnbas (offset 484) checkpoint scn
kcvcptim (offset 492) last checkpoint time
kcvfhcpc (offset 144) Datafile checkpoint count

rdba檔案轉換:

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       0x9c8a
  ub2 spare3_kcbh                           @18       0x0000

16進位制轉換成10進位制:


select dbms_utility
.data_block_address_file
(to_number
(
'c00001'
,
'XXXXXXXX'
)) file_id
,dbms_utility
.data_block_address_block
(to_number
(
'c00001'
,
'XXXXXXXX'
)) block_id 
from 
dual
;

3號檔案第1個塊

修復檔案頭塊的rdba:

BBED
> 
set file 
1 block 
1 
offset 
4

       FILE #           1
       BLOCK #          1
        OFFSET           4

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :     4 to   515           Dba : 0x00400001
------------------------------------------------------------------------
0100c000 00000000 00000104 8a9c0000 00000000 00000013 c825ffac 4f524144
42000000 ca0b0000 003b0100 00200000 03000300 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000
00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 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
4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95 02000000

< 32 bytes per line >

BBED > modify /x 0x00400001 offset 4
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :     4 to   515           Dba : 0x00400001
------------------------------------------------------------------------
00400001 00000000 00000104 8a9c0000 00000000 00000013 c825ffac 4f524144
42000000 ca0b0000 003b0100 00200000 03000300 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000
00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 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
4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95 02000000

< 32 bytes per line >

BBED > sum apply
Check value for File 1 , Block 1 :
current = 0xdd4b , required = 0xdd4b

修復檔案標頭檔案大小:

BBED
> p kcvfhhdr

struct kcvfhhdr , 76 bytes                   @20
  ub4 kccfhswv                             @20       0x00000000
  ub4 kccfhcvn                             @24       0x13000000
  ub4 kccfhdbi                             @28       0xacff25c8
  text kccfhdbn [ 0 ]                         @32      O
  text kccfhdbn [ 1 ]                         @33      R
  text kccfhdbn [ 2 ]                         @34      A
  text kccfhdbn [ 3 ]                         @35      D
  text kccfhdbn [ 4 ]                         @36      B
  text kccfhdbn [ 5 ]                         @37
  text kccfhdbn [ 6 ]                         @38
  text kccfhdbn [ 7 ]                         @39
  ub4 kccfhcsq                             @40       0x00000bca
  ub4 kccfhfsz                             @44       0x00013b00
  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

檢視檔案大小:

-rw-r-----. 1 oracle oinstall  954212352 Oct  5 04:48 system01.dbf

16進位制轉換:

 
select 
(
954212352
-
8192
)/8192

  2   from dual ;

( 954212352 - 8192 )/8192
---------------------
              116480
select to_char ( '116480' , 'xxxxxxxxxxxxxxxx' ) from dual ;

TO_CHAR ( '116480' ,
-----------------
            1c700

檔案大小調整:

BBED
> 
set file 
1 block 
1 
offset 
44

       FILE #           1
       BLOCK #          1
        OFFSET           44

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   44 to   555           Dba : 0x00400001
------------------------------------------------------------------------
003b0100 00200000 03000300 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 68150000 00800000
b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000 00000000 00000400
3c000000 3f278144 3b000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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 4c622400 00800000
27218244 01000000 03000000 d4cb0300 10004c95 02000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

BBED > modify /x 00c70100
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   44 to   555           Dba : 0x00400001
------------------------------------------------------------------------
00c70100 00200000 03000300 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 68150000 00800000
b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000 00000000 00000400
3c000000 3f278144 3b000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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 4c622400 00800000
27218244 01000000 03000000 d4cb0300 10004c95 02000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

BBED > sum apply
Check value for File 1 , Block 1 :
current = 0x214b , required = 0x214b

修改檔案頭的檔案號:

BBED
> p kcvfhhdr

struct kcvfhhdr , 76 bytes                   @20
  ub4 kccfhswv                             @20       0x00000000
  ub4 kccfhcvn                             @24       0x13000000
  ub4 kccfhdbi                             @28       0xacff25c8
  text kccfhdbn [ 0 ]                         @32      O
  text kccfhdbn [ 1 ]                         @33      R
  text kccfhdbn [ 2 ]                         @34      A
  text kccfhdbn [ 3 ]                         @35      D
  text kccfhdbn [ 4 ]                         @36      B
  text kccfhdbn [ 5 ]                         @37
  text kccfhdbn [ 6 ]                         @38
  text kccfhdbn [ 7 ]                         @39
  ub4 kccfhcsq                             @40       0x00000bca
  ub4 kccfhfsz                             @44       0x0001c700
  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
       FILE #           1
       BLOCK #          1

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :     0 to   511           Dba : 0x00400001
------------------------------------------------------------------------
0ba20000 00400001 00000000 00000104 4b210000 00000000 00000013 c825ffac
4f524144 42000000 ca0b0000 00c70100 00200000 03000300 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000
00000000 00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 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 4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95

< 32 bytes per line >

BBED > modify /x 01 offset 52
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   52 to   563           Dba : 0x00400001
------------------------------------------------------------------------
01000300 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 68150000 00800000 b512f33b 4a737e44
d14f1d00 00800000 00000000 00000000 00000000 00000400 3c000000 3f278144
3b000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 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 4c622400 00800000 27218244 01000000
03000000 d4cb0300 10004c95 02000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

BBED > sum apply
Check value for File 1 , Block 1 :
current = 0x2149 , required = 0x2149

修復檔案頭root資料塊號:

BBED
> p kcvfhrdb

ub4 kcvfhrdb                                 @96       0x00000000

BBED > set file 1 block 1 offset 96
       FILE #           1
       BLOCK #          1
        OFFSET           96

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   96 to   607           Dba : 0x00400001
------------------------------------------------------------------------
00000000 68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000
00000000 00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 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 4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95
02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

BBED > modify /x 08024000
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   96 to   607           Dba : 0x00400001
------------------------------------------------------------------------
08024000 68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000
00000000 00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 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 4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95
02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

BBED > sum apply
Check value for File 1 , Block 1 :
current = 0x2301 , required = 0x2301

修復檔案頭建立scn:

BBED> p kcvfhcrs

struct kcvfhcrs, 8 bytes                    @100
  ub4 kscnbas                              @100      0x00000007
  ub2 kscnwrp                              @104      0x8000
  ub2 kscnwrp2                             @106      0x0000

檢視scn,與檔案對比

 
select file
#,creation_change# from v$datafile;


    FILE # CREATION_CHANGE#
---------- ----------------
        1                 9
        3             5480
        4           1920446
        7             32876

idle 2023 - 10 - 05 05 : 17 : 45 > select to_char ( 5480 , 'xxxxxxxxxx' ) from dual ;

TO_CHAR ( 5480 )
-----------
      1568
     
BBED > set file 1 block 1 offset 100
       FILE #           1
       BLOCK #          1
        OFFSET           100

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   100 to   611           Dba : 0x00400001
------------------------------------------------------------------------
68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000
00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 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
4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95 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

修改scn

BBED
> 
set file 
1 block 
1 
offset 
100

       FILE #           1
       BLOCK #          1
        OFFSET           100

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   100 to   611           Dba : 0x00400001
------------------------------------------------------------------------
07000000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000
00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 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
4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95 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

< 32 bytes per line >

BBED > modify /x 09000000 offset 100
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   100 to   611           Dba : 0x00400001
------------------------------------------------------------------------
09000000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000
00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 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
4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95 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

< 32 bytes per line >

BBED > sum apply
Check value for File 1 , Block 1 :
current = 0x3660 , required = 0x3660

修復檔案頭的檔案建立時間:

BBED
> 
set file 
1 block 
1 
offset 
108

       FILE #           1
       BLOCK #          1
        OFFSET           108

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   108 to   619           Dba : 0x00400001
------------------------------------------------------------------------
b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000 00000000 00000400
3c000000 3f278144 3b000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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 4c622400 00800000
27218244 01000000 03000000 d4cb0300 10004c95 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

< 32 bytes per line >

select file
#,to_char(creation_time,'yyyy-mm-dd hh24:mi:ss') creation_time_file,

(to_char (creation_time , 'yyyy' ) - 1988 ) * 12 * 31 * 24 * 3600 +
  2     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
+to_char (creation_time , 'ss' ) creation_name_scn
  7     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
       
select to_char ( 1005785769 , 'xxxxxxxxxxxxxxxx' ) from dual ;

TO_CHAR ( 100578576
-----------------
        3bf312a9

BBED
> 
modify /x a9 
offset 
108

File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   108 to   619           Dba : 0x00400001
------------------------------------------------------------------------
a912f33b 4a737e44 d14f1d00 00800000 00000000 00000000 00000000 00000400
3c000000 3f278144 3b000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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 4c622400 00800000
27218244 01000000 03000000 d4cb0300 10004c95 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

< 32 bytes per line >

BBED > modify /x 12 offset 109
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   109 to   620           Dba : 0x00400001
------------------------------------------------------------------------
12f33b4a 737e44d1 4f1d0000 80000000 00000000 00000000 00000000 0004003c
0000003f 2781443b 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001
00000006 00535953 41555800 00000000 00000000 00000000 00000000 00000000
00000003 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 0000009f 12f33b01 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 0000004c 62240000 80000027
21824401 00000003 000000d4 cb030010 004c9502 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

BBED > modify /x f3 offset 110
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   110 to   621           Dba : 0x00400001
------------------------------------------------------------------------
f33b4a73 7e44d14f 1d000080 00000000 00000000 00000000 00000000 04003c00
00003f27 81443b00 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000100
00000600 53595341 55580000 00000000 00000000 00000000 00000000 00000000
00000300 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00009f12 f33b0100 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00004c62 24000080 00002721
82440100 00000300 0000d4cb 03001000 4c950200 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

BBED > modify /x 3b offset 111
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   111 to   622           Dba : 0x00400001
------------------------------------------------------------------------
3b4a737e 44d14f1d 00008000 00000000 00000000 00000000 00000004 003c0000
003f2781 443b0000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00010000
00060053 59534155 58000000 00000000 00000000 00000000 00000000 00000000
00030000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 009f12f3 3b010000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 004c6224 00008000 00272182
44010000 00030000 00d4cb03 0010004c 95020000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

修復檔案頭的檔案狀態:

BBED
> p 
offset 
138

kcvfh .kcvfhsta
--------------
ub2 kcvfhsta                                 @138       0x0004 (KCVFHOFZ )

BBED > set file 1 block 1 offset 138
       FILE #           1
       BLOCK #          1
        OFFSET           138

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   138 to   649           Dba : 0x00400001
------------------------------------------------------------------------
04003c00 00003f27 81443b00 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000100 00000600 53595341 55580000 00000000 00000000 00000000 00000000
00000000 00000300 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00009f12 f33b0100 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00004c62 24000080
00002721 82440100 00000300 0000d4cb 03001000 4c950200 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000d00 0d000d00

< 32 bytes per line >

修復檔案頭的表空間號:

BBED
> p kcvfhtsn

sword kcvfhtsn                               @332       1

BBED > set file 1 block 1 offset 332
       FILE #           1
       BLOCK #          1
        OFFSET           332

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   332 to   843           Dba : 0x00400001
------------------------------------------------------------------------
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 4c622400 00800000
27218244 01000000 03000000 d4cb0300 10004c95 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

< 32 bytes per line >

檢視1號檔案表空間號:


select file
#,ts# from v$datafile;


    FILE #        TS#
---------- ----------
        1           0
        3           1
        4           2
        7           4

調整表空間號:

BBED
> 
modify /x 
00 
offset 
332

File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   332 to   843           Dba : 0x00400001
------------------------------------------------------------------------
00000000 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 4c622400 00800000
27218244 01000000 03000000 d4cb0300 10004c95 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

< 32 bytes per line >

BBED > sum apply
Check value for File 1 , Block 1 :
current = 0x367d , required = 0x367d

檢視修復檔案頭表空間長度

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

修復檔案頭表空間名稱:

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

BBED > set file 1 block 1 offset 338
       FILE #           1
       BLOCK #          1
        OFFSET           338

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   338 to   849           Dba : 0x00400001
------------------------------------------------------------------------
53595341 55580000 00000000 00000000 00000000 00000000 00000000 00000300
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00009f12 f33b0100 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00004c62 24000080 00002721 82440100
00000300 0000d4cb 03001000 4c950200 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000d00 0d000d00 01000000 00000000
00000000 00000200 c000b24b 1d000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000291
68113cac 5680b693 75660fdd 2c967300 00000000 00000000 00000000 00000000
00000000 00000000 00000000 0000002c a567a3ff 484f36bf 9b7ad99d 4b58ec00

< 32 bytes per line >
 
select dump
(
'SYSTEM'
,
16
) 
from 
dual
;


DUMP ( 'SYSTEM' , 16 )
-------------------------------
Typ = 96 Len = 6 : 53 , 59 , 53 , 54 , 45 , 4d

修改後3個字母,偏移量為341

BBED
> 
set file 
1 block 
1 
offset 
341

       FILE #           1
       BLOCK #          1
        OFFSET           341

BBED > modify /x 54454d
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   341 to   852           Dba : 0x00400001
------------------------------------------------------------------------
54454d00 00000000 00000000 00000000 00000000 00000000 00000003 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 0000009f 12f33b01 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 0000004c 62240000 80000027 21824401 00000003
000000d4 cb030010 004c9502 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 0000000d 000d000d 00010000 00000000 00000000
00000002 00c000b2 4b1d0000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000002 9168113c
ac5680b6 9375660f dd2c9673 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 2ca567a3 ff484f36 bf9b7ad9 9d4b58ec 00060000

< 32 bytes per line >

BBED > sum apply
Check value for File 1 , Block 1 :
current = 0x366d , required = 0x366d

修復檔案頭的相對檔案號:

BBED
> p kcvfhrfn

ub4 kcvfhrfn                                 @368       0x00000003

BBED > set file 1 block 1 offset 368
       FILE #           1
       BLOCK #          1
        OFFSET           368

BBED > dump
File : /oradata/ORADB/system01 .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 4c622400 00800000 27218244
01000000 03000000 d4cb0300 10004c95 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

BBED > modify /x 01
File : /oradata/ORADB/system01 .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 4c622400 00800000 27218244
01000000 03000000 d4cb0300 10004c95 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 = 0x366f , required = 0x366f

檢視檔案頭檢查點的SCN:

BBED> p kcvfhckp

struct kcvfhckp, 36 bytes                   @484
  struct kcvcpscn, 8 bytes                 @484
     ub4 kscnbas                           @484      0x0024624c
 
select

file #,CREATION_CHANGE#,CHECKPOINT_CHANGE# ,UNRECOVERABLE_CHANGE#,LAST_CHANGE#,OFFLINE_CHANGE# from v$datafile order by 1;  2

    FILE # CREATION_CHANGE# CHECKPOINT_CHANGE# UNRECOVERABLE_CHANGE# LAST_CHANGE# OFFLINE_CHANGE#
---------- ---------------- ------------------ --------------------- ------------ ---------------
        1                 9             2384460                     0                       1920976
        3             5480             2384460                     0                       1920976
        4           1920446             2384460                     0                       1920976
        7             32876             2384460                     0                       1920976
 


select to_char ( 2384460 , 'xxxxxxxxxxxxxxxx' ) from dual ;


TO_CHAR ( 2384460 , '
-----------------
          24624c

檢視修復檔案頭的檢查點時間:

BBED
> 
set file 
1 block 
1 
offset 
492

       FILE #           1
       BLOCK #          1
        OFFSET           492

BBED > dump
File : /oradata/ORADB/system01 .dbf ( 1 )
Block : 1                Offsets :   492 to 1003           Dba : 0x00400001
------------------------------------------------------------------------
27218244 01000000 03000000 d4cb0300 10004c95 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 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

< 32 bytes per line >

select file
#,to_char(CHECKPOINT_TIME,'yyyy-mm-dd hh24:mi:ss')

CHECKPOINT_TIME_file ,
  2     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
+to_char (CHECKPOINT_TIME , 'ss' ) CHECKPOINT_TIME_scn
  8     9   from v$datafile order by 1 ;

    FILE # CHECKPOINT_TIME_FIL CHECKPOINT_TIME_SCN
---------- ------------------- -------------------
        1 2023 - 10 - 04 23 : 54 : 15           1149378855
        3 2023 - 10 - 04 23 : 54 : 15           1149378855
        4 2023 - 10 - 04 23 : 54 : 15           1149378855
        7 2023 - 10 - 04 23 : 54 : 15           1149378855
select
to_char ( 1149378855 , 'xxxxxxxxxxxxxxxxxxxxxxx' ) from dual ;   2

TO_CHAR ( 1149378855 , 'XXXX
------------------------
               44822127

使用dbv檢查檔案頭修改是否正確:

dbv file= /oradata/ORADB/system01.dbf start=1 end=2


DBVERIFY: Release 19.0.0.0.0 - Production on Thu Oct 5 06:15:11 2023

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/ORADB/system01.dbf
Page 1 is marked corrupt
Corrupt block relative dba: 0x00400001 (file 1, block 1)
Bad header found during dbv:
Data in bad block:
type: 11 format: 2 rdba: 0x01004000
last change scn: 0x0000.0000.00000000 seq: 0x1 flg: 0x04
spare3: 0x0
consistency value in tail: 0x00000b01
check value in block header: 0x366f
computed block checksum: 0x0



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): 1
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 0
Total Pages Marked Corrupt   : 1
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 2364120 (0.2364120)

出現錯誤,重新修改rdba部分

BBED> set file 1 block 1 offset 4

       FILE#           1
       BLOCK#          1
       OFFSET          4

BBED> dump
File: /oradata/ORADB/system01.dbf (1)
Block: 1                Offsets:    4 to  515           Dba:0x00400001
------------------------------------------------------------------------
0100c000 00000000 00000104 8a9c0000 00000000 00000013 c825ffac 4f524144
42000000 ca0b0000 003b0100 00200000 03000300 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000
00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 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
4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95 02000000

<32 bytes per line>
--修改此部分
BBED> modify /x 01004000 offset 4
File: /oradata/ORADB/system01.dbf (1)
Block: 1                Offsets:    4 to  515           Dba:0x00400001
------------------------------------------------------------------------
00400001 00000000 00000104 8a9c0000 00000000 00000013 c825ffac 4f524144
42000000 ca0b0000 003b0100 00200000 03000300 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
68150000 00800000 b512f33b 4a737e44 d14f1d00 00800000 00000000 00000000
00000000 00000400 3c000000 3f278144 3b000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 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
4c622400 00800000 27218244 01000000 03000000 d4cb0300 10004c95 02000000

<32 bytes per line>

BBED> sum apply
Check value for File 1, Block 1:
current = 0xdd4b, required = 0xdd4b

再次檢查檔案頭:


[oracle
@wy19c
:/oradata/ORADB
]$ dbv file
= /oradata/ORADB/system01
.dbf 
start
=
1 
end
=
2


DBVERIFY : Release 19.0.0.0.0 - Production on Thu Oct 5 06 : 20 : 04 2023

Copyright (c ) 1982 , 2019 , Oracle and/or its affiliates.   All rights reserved.

DBVERIFY - Verification starting : FILE = /oradata/ORADB/system01 .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             : 2364120 ( 0.2364120 )

重新開啟資料庫:


alter 
database 
open
;


Database altered.

select open_mode from v$database ;

OPEN_MODE
--------------------
READ WRITE



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70021989/viewspace-2986944/,如需轉載,請註明出處,否則將追究法律責任。

相關文章