Modify fileheader (test)

Source: Internet
Author: User
Tags ibase
-- Modify fileheader --------------------------------------------------------------------------- cd $ response

-- Modify file header --------------------------------------------------------------------------- cd $ ORACLE_H0ME/rdbms/lib. /bbed blockedit set filename/u01/app/oracle/product/10.2.0/db_1/dbs/test01.dbf show map/v p kcvfhckp BBED modify/x 005

-- Modify file header
-------------------------------------------------------------------------
Cd $ ORACLE_H0ME/rdbms/lib
./Bbed blockedit
Set filename '/u01/app/oracle/product/10.2.0/db_1/dbs/test01.dbf'
Show
Map/v
P kcvfhckp
BBED> modify/x 005a

-- The copy file should be tested and recognized.

BBED> showv
FILE #1
BLOCK #1
OFFSET 0
DBA 0x00400001 (4194305)
FILENAME/u01/app/oracle/oradata/test/block. dbf
BIFILE bifile. bbd
LISTFILE list
Blocsize 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 1, 512
LOGFILE log. bbd
SPOOL No


BBED> map/v
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Dba: 0x00400001
------------------------------------------------------------
Data File Header


Struct kcvfh, 676 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 // some data says this also needs to be modified when the database is forcibly opened

Image Source (oracle Practice Guide)

Struct kcvfhckp, 36 bytes @ 484 modified in three sections! 9i 140

Ub4 kcvfhcpc @ 140
Ub4 kcvfhrts @ 144
Ub4 kcvfhccc@ 148
Struct kcvfhbcp, 36 bytes @ 152
Ub4 kcvfhbhz@ 312
Struct kcvfhxcd, 16 bytes @ 316
Word 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> p kcvfhckp
Struct kcvfhckp, 36 bytes @ 484
Struct kcvcpscn, 8 bytes @ 484
Ub4 kscnbas @ 484 0x000ddc27 --
Ub2 kscnwrp @ 488 0x0000
Ub4 kcvcptim@ 492 0x2d2fe78a --
Ub2 kcvcpthr @ 496 0x0001
Union u, 12 bytes @ 500
Struct kcvcprba, 12 bytes @ 500
Ub4 kcrbaseq @ 500 0x00000011
Ub4 kcrbabno @ 504 0x00000002
Ub2 kcrbabof @ 508 0x0010
Ub1 kcvcpetb [0] @ 512 0x02
Ub1 kcvcpetb [1] @ 513 0x00
Ub1 kcvcpetb [2] @ 514 0x00
Ub1 kcvcpetb [2] @ 515 0x00
Ub1 kcvcpetb [4] @ 516 0x00
Ub1 kcvcpetb [5] @ 517 0x00
Ub1 kcvcpetb [6] @ 518 0x00
Ub1 kcvcpetb [7] @ 519 0x00
BBED> p kcvfhcpc
Ub4 kcvfhcpc @ 140 0x00000032 --


BBED> p kcvfhccc
Ub4 kcvfhccc @ 148 0x00000031 --
-- Modify the preceding data.
BBED> set offset 484 count 16
OFFSET 484
COUNT 16


BBED> dump/v
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 484 to 499 Dba: 0x00400001
-------------------------------------------------------
27dc0d00 rj5a00 8ae72f2d 01000000 l '?... Z ..? -....


<16 bytes per line>'
-- The following is the specific experiment step.
-- Shutdown database and reopen to mount
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.


Total System Global Area 184549376 bytes
Fixed Size 1218412 bytes
Variable Size 92276884 bytes
Database Buffers 88080384 bytes
Redo Buffers 2973696 bytes
Database mounted.
-- Update datafile header
BBED> show
FILE #1
BLOCK #1
OFFSET 0
DBA 0x00400001 (4194305)
FILENAME/u01/app/oracle/oradata/test/block. dbf
BIFILE bifile. bbd
LISTFILE list
Blocsize 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 1, 512
LOGFILE log. bbd
SPOOL No


BBED> p kcvfhckp
Struct kcvfhckp, 36 bytes @ 484
Struct kcvcpscn, 8 bytes @ 484
Ub4 kscnbas @ 484 0x000df330
Ub2 kscnwrp @ 488 0x0000
Ub4 kcvcptim@ 492 0x2d3006c5
Ub2 kcvcpthr @ 496 0x0001
Union u, 12 bytes @ 500
Struct kcvcprba, 12 bytes @ 500
Ub4 kcrbaseq @ 500 0x00000011
Ub4 kcrbabno @ 504 0x00002da7
Ub2 kcrbabof @ 508 0x0010
Ub1 kcvcpetb [0] @ 512 0x02
Ub1 kcvcpetb [1] @ 513 0x00
Ub1 kcvcpetb [2] @ 514 0x00
Ub1 kcvcpetb [2] @ 515 0x00
Ub1 kcvcpetb [4] @ 516 0x00
Ub1 kcvcpetb [5] @ 517 0x00
Ub1 kcvcpetb [6] @ 518 0x00
Ub1 kcvcpetb [7] @ 519 0x00


BBED> p kcvfhcpc
Ub4 kcvfhcpc @ 140 0x00000033


BBED> p kcvfhccc
Ub4 kcvfhccc@ 148 0x00000032


BBED> set offset 484 count 16
OFFSET 484
COUNT 16


BBED> dump/v
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 484 to 499 Dba: 0x00400001
-------------------------------------------------------
30f30d00 00000000 c506302d 01000a00 l 0 ?.....? 0 -....


<16 bytes per line>


BBED> modify/x 20
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 484 to 499 Dba: 0x00400001
------------------------------------------------------------------------
20f30d00 00000000 c506302d 01000a00


<32 bytes per line>


BBED> set offset 492
OFFSET 492


BBED> dump
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 492 to 507 Dba: 0x00400001
------------------------------------------------------------------------
C506302d 01000a00 11000000 a72d0000


<32 bytes per line>


BBED> modify/x c0
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 492 to 507 Dba: 0x00400001
------------------------------------------------------------------------
C006302d 01000a00 11000000 a72d0000


<32 bytes per line>


BBED> set offset 140
OFFSET 140


BBED> dump
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 140 to 155 Dba: 0x00400001
------------------------------------------------------------------------
33000000 ea63292d 32000000 00000000


<32 bytes per line>


BBED> modify/x 31
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 140 to 155 Dba: 0x00400001
------------------------------------------------------------------------
31000000 ea63292d 32000000 00000000


<32 bytes per line>


BBED> set offset 148
OFFSET 148


BBED> modify
BBED-00203: incomplete/malformed command




BBED> modify/x 30
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 148 to 163 Dba: 0x00400001
------------------------------------------------------------------------
30000000 00000000 00000000 00000000


<32 bytes per line>


BBED> sum apply values -------------------------------------------------------------------------------------
Check value for File 1, Block 1:
Current = 0xa51f, required = 0xa51f
-- Alter database open
SQL> alter database open;
Alter database open
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '/u01/app/oracle/oradata/test/block. dbf'
-- Modify the file header from system
BBED> set offset 484 count 16
OFFSET 484
COUNT 16


BBED> dump/v
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 484 to 499 Dba: 0x00400001
-------------------------------------------------------
30f30d00 00000000 c506302d 01000a00 l 0 ?.....? 0 -....


<16 bytes per line>


BBED> modify/x 20
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 484 to 499 Dba: 0x00400001
------------------------------------------------------------------------
20f30d00 00000000 c506302d 01000a00


<32 bytes per line>


BBED> set offset 492
OFFSET 492


BBED> dump
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 492 to 507 Dba: 0x00400001
------------------------------------------------------------------------
C506302d 01000a00 11000000 a72d0000


<32 bytes per line>


BBED> modify/x c0
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 492 to 507 Dba: 0x00400001
------------------------------------------------------------------------
C006302d 01000a00 11000000 a72d0000


<32 bytes per line>


BBED> set offset 140
OFFSET 140


BBED> dump
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 140 to 155 Dba: 0x00400001
------------------------------------------------------------------------
33000000 ea63292d 32000000 00000000


<32 bytes per line>


BBED> modify/x 31
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 140 to 155 Dba: 0x00400001
------------------------------------------------------------------------
31000000 ea63292d 32000000 00000000


<32 bytes per line>


BBED> set offset 148
OFFSET 148


BBED> modify
BBED-00203: incomplete/malformed command




BBED> modify/x 30
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 148 to 163 Dba: 0x00400001
------------------------------------------------------------------------
30000000 00000000 00000000 00000000


<32 bytes per line>


BBED> sum apply
Check value for File 1, Block 1:
Current = 0xa51f, required = 0xa51f


BBED> set offset 484
OFFSET 484


BBED> dump/v count 16
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 484 to 499 Dba: 0x00400001
-------------------------------------------------------
20f30d00 00000000 c006302d 01000a00 l ?.....? 0 -....


<16 bytes per line>


BBED> modify/x 30
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 484 to 499 Dba: 0x00400001
------------------------------------------------------------------------
30f30d00 00000000 c006302d 01000a00


<32 bytes per line>


BBED> set offset 492
OFFSET 492


BBED> dump/v
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 492 to 507 Dba: 0x00400001
-------------------------------------------------------
C006302d 01000a00 11000000 a72d0000 l? 0 -........?..


<16 bytes per line>


BBED> modify/c5
BBED-00201: invalid switch)




BBED> modify/x c5
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 492 to 507 Dba: 0x00400001
------------------------------------------------------------------------
C506302d 01000a00 11000000 a72d0000


<32 bytes per line>


BBED> set offset 140
OFFSET 140


BBED> dump/v
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 140 to 155 Dba: 0x00400001
-------------------------------------------------------
31000000 ea63292d 30000000 00000000 l 1 ...... success)-0 .......


<16 bytes per line>


BBED> modify/x 33
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 140 to 155 Dba: 0x00400001
------------------------------------------------------------------------
33000000 ea63292d 30000000 00000000


<32 bytes per line>


BBED> set offset 148
OFFSET 148


BBED> dump/v
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 148 to 163 Dba: 0x00400001
-------------------------------------------------------
30000000 00000000 00000000 00000000 l 0 ...............


<16 bytes per line>


BBED> modify/x 32
File:/u01/app/oracle/oradata/test/block. dbf (1)
Block: 1 Offsets: 148 to 163 Dba: 0x00400001
------------------------------------------------------------------------
32000000 00000000 00000000 00000000


<32 bytes per line>


BBED> sum apply
Check value for File 1, Block 1:
Current = 0xa50a, required = 0xa50a
-- Open the database
SQL> alter database open;


Database altered.


SQL>
--------------------------------------------------------------------
-- Whether or not startup is affected when there are bad data blocks
-- Upt the block
BBED> p kcbh
Struct kcbh, 20 bytes @ 0
Ub1 type_kcbh @ 0 0x06
Ub1 frmt_kcbh @ 1 0xa2
Ub1 sparejavaskcbh @ 2 0x00
Ub1 spare2_kcbh @ 3 0x00
Ub4 rdba_kcbh @ 4 0x01420.c
Ub4 bas_kcbh @ 8 0x000de97d
Ub2 wrp_kcbh @ 12 0x0000
Ub1 seq_kcbh @ 14 0x02
Ub1 flg_kcbh @ 15 0x04 (KCBHFCKV)
Ub2 chkval_kcbh @ 16 0x1c9c
Ub2 spare3_kcbh @ 18 0x0000


BBED> upt
Block marked media upt.


BBED> v
DBVERIFY-Verification starting
FILE =/u01/app/oracle/oradata/test/block. dbf
BLOCK = 12


Block Checking: DBA = 4194316, Block Type = KTB-managed data block
Found block already marked specified upted


DBVERIFY-Verification complete


Total Blocks Examined: 1
Total Blocks Processed (Data): 1
Total Blocks Failing (Data): 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty: 0
Total Blocks Marked Blocks upt: 0
Total Blocks Influx: 0


BBED> p kcbh
Struct kcbh, 20 bytes @ 0
Ub1 type_kcbh @ 0 0x06
Ub1 frmt_kcbh @ 1 0xa2
Ub1 sparejavaskcbh @ 2 0x00
Ub1 spare2_kcbh @ 3 0x00
Ub4 rdba_kcbh @ 4 0x0040000c
Ub4 bas_kcbh @ 8 0x00000000
Ub2 wrp_kcbh @ 12 0x0000
Ub1 seq_kcbh @ 14 0xff -- originally 02
Ub1 flg_kcbh @ 15 0x04 (KCBHFCKV)
Ub2 chkval_kcbh @ 16 0x1d91
Ub2 spare3_kcbh @ 18 0x0000


BBED> sum apply
Check value for File 1, Block 12:
Current = 0x1d91, required = 0x1d91
-- Reopen the database
SQL> alter database open;


Database altered.


SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.


Total System Global Area 184549376 bytes
Fixed Size 1218412 bytes
Variable Size 92276884 bytes
Database Buffers 88080384 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL>
-- Bad blocks do not affect database startup.
-- If you use corropt to modify it, don't you come to Grandma, or simply change ff. revert can be noted, Grandma.
-- Trace errors in files
Bad header found during buffer read
Data in bad block:
Type: 6 format: 2 rdba: 0x0040000c
Last change scn: 0x0000.00000000 seq: 0x2 flg: 0x04
Spare1: 0x0 spare2: 0x0 spare3: 0x0
Consistency value in tail: 0x00000602
Check value in block header: 0x1d91
Computed block checksum: 0x0
Reread of rdba: 0x01420.c (file 5, block 12) found same specified upted data
-----------------------------------------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.