Purpose: Use bbed to change the scn information of datafile 5 that has been offline to the same as that of other datafiles ., Bbeddatafile
Standard Reference self: http://www.xifenfei.com/1527.html
Objective: to change the scn information of datafile 5 that has been offline to the same as that of other datafiles.
Db version 11.2.0.4
Background:
1. the file header of datafile is stored in the first block.
2. Oracle considers four attributes of this data structure when determining if a datafile is sync with the other data files of the database :( offset may vary with oracle versions)
(1) kscnbas (at offset 140)-SCN of last change to the datafile.
(2) kcvcptim (at offset 148)-Time of the last change to the datafile.
(3) kcvfhcpc (at offset 176)-Checkpoint count.
(4) kcvfhccc (at offset 184)-Unknown, but is always 1 less than thecheckpoint point count.
Oracle has four properties to determine whether datafile is consistent with other datafile, if consistent, can operate normally, if inconsistent, then the ORA-01113 error will be reported
Bbed password = blocedit blocksize = 8192 listfile =/home/oracle/bbed. file mode = edit/home/oracle/bbed. the file content is as follows: 1/u01/app/oracle/oradata/test/system01.dbf 8493465602/u01/app/oracle/oradata/test/sysaux01.dbf 34707865603/u01/app/oracle/oradata/test/undotbs01.dbf 2516582404 /u01/app/oracle/oradata/test/users01.dbf 3827302405/u01/app/oracle/oradata/test/ten01.dbf 524288006/u01/app/oracle/oradata/test/tb_test_01.dbf 52428807/ u01/app/oracle/oradata/test/ts1.dbf 5242880008/u01/app/oracle/oradata/test/ts2.dbf 5242880009/u01/app/oracle/oradata/test/test01.dbf 5242880010/u01 /app/oracle/oradata/test/test_uni_sz_2m_01.dbf 5242880011/u01/app/oracle/oradata/test/test_uni_sz_1m_01.dbf 20971520012/u01/app/oracle/oradata/test. dbf 10485760
The preceding content can be generated using the following statement:
select file#||' '||name||' '||bytes from v$datafile;
BBED> set dba 1,1 DBA 0x00400001 (4194305 1,1)BBED> p kcvfhckpstruct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x0036b5c8---> ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x344bc95d---> ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x00000001 ub4 kcrbabno @504 0x000021e7 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 0x00BBED> p kcvfhcpcub4 kcvfhcpc @140 0x00000168--->BBED> p kcvfhcccub4 kcvfhccc @148 0x00000167--->
BBED> set dba 5,1 DBA 0x01400001 (20971521 5,1)BBED> p kcvfhckpstruct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x00369818---> ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x344b98b3---> ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x00000098 ub4 kcrbabno @504 0x0000b62c 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 0x00BBED> p kcvfhcpcub4 kcvfhcpc @140 0x00000104--->BBED> p kcvfhcccub4 kcvfhccc @148 0x00000103--->
========================================================== ========================================================== ======
Modify the settings as follows:
BBED> set dba 5,1 DBA 0x01400001 (20971521 5,1)BBED> m /x c8b53600 offset 484BBED-00209: invalid number (c8b53600)BBED> m /x c8b5 File: /u01/app/oracle/oradata/test/ten01.dbf (5) Block: 1 Offsets: 484 to 487 Dba:0x01400001------------------------------------------------------------------------ c8b53600 <32 bytes per line>BBED> set offset +2 OFFSET 486BBED> m /x 3600 File: /u01/app/oracle/oradata/test/ten01.dbf (5) Block: 1 Offsets: 486 to 489 Dba:0x01400001------------------------------------------------------------------------ 36000000 <32 bytes per line>BBED> m /x 5dc94b34 offset 492 File: /u01/app/oracle/oradata/test/ten01.dbf (5) Block: 1 Offsets: 492 to 495 Dba:0x01400001------------------------------------------------------------------------ 5dc94b34 <32 bytes per line>BBED> m /x 68010000 offset 140 File: /u01/app/oracle/oradata/test/ten01.dbf (5) Block: 1 Offsets: 140 to 143 Dba:0x01400001------------------------------------------------------------------------ 68010000 <32 bytes per line>BBED> m /x 67010000 offset 148 File: /u01/app/oracle/oradata/test/ten01.dbf (5) Block: 1 Offsets: 148 to 151 Dba:0x01400001------------------------------------------------------------------------ 67010000 <32 bytes per line>BBED> p kcvfhckpstruct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x0036b5c8 ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x344bc95d ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x00000098 ub4 kcrbabno @504 0x0000b62c 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 0x00BBED> p kcvfhcpcub4 kcvfhcpc @140 0x00000168BBED> p kcvfhcccub4 kcvfhccc @148 0x00000167BBED> sumCheck value for File 5, Block 1:current = 0xc16c, required = 0xbd5aBBED> sum applyCheck value for File 5, Block 1:current = 0xbd5a, required = 0xbd5aBBED>
SQL> select file #, to_char (checkpoint_change #, '000000'), to_char (RESETLOGS_CHANGE #, '000000') from v $ datafile_header; 2 FILE # TO_CHAR (CHECK TO_CHAR (RESET ----- ------------- 1 3585483 3580553 2 3585483 3580553 3 3585483 4 3580553 3585483 5 3580553 3585480 ---> 995548 and 3585480 are still different. 6 3585483 3580553 7 3585483 3580553 8 3585483 9 3580553 3585483 10 3580553 11 3585483 3580553 12 3585483 3580553 rows selected. SQL> recover datafile 5; ---> recover is not dripping, because the datafile is a data file ORA-00283 that has been offline before resetlog: recovery session canceled due to errorsORA-19909: datafile 5 belongs to an orphan incarnationORA-01110: data file 5: '/u01/app/oracle/oradata/test/ten01.dbf'