目的:使用bbed將已經offline掉的datafile 5 的scn資訊改為與其他datafile一致。,bbeddatafile

來源:互聯網
上載者:User

目的:使用bbed將已經offline掉的datafile 5 的scn資訊改為與其他datafile一致。,bbeddatafile

本位參考自:http://www.xifenfei.com/1527.html

 

目的:將已經offline掉的datafile 5 的scn資訊改為與其他datafile一致。

db版本為11.2.0.4

背景知識:
1、datafile 的file header 儲存在第一個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:(不同oracle版本offset可能不同)
(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有4個屬性來判斷datafile 是否和其他的datafile 一致,如果都一致,可以正常操作,如果不一致,那麼會報ORA-01113錯誤

bbed password=blockedit blocksize=8192  listfile=/home/oracle/bbed.file mode=edit/home/oracle/bbed.file的內容如下: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/test.dbf 10485760


 

如上內容,可以用如下語句來產生:

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--->

 

======================================================================================

下面開始修改:
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#,'999999999999'),to_char(RESETLOGS_CHANGE#,'999999999999')from v$datafile_header;  2  FILE# TO_CHAR(CHECK TO_CHAR(RESET----- ------------- -------------    1       3585483       3580553    2       3585483       3580553    3       3585483       3580553    4       3585483       3580553    5       3585480        995548       --->3585480跟3585483還是不一樣。    6       3585483       3580553    7       3585483       3580553    8       3585483       3580553    9       3585483       3580553   10       3585483       3580553   11       3585483       3580553   12       3395372        99554812 rows selected.SQL> recover datafile 5;--->recover是不行滴,原因是該datafile是屬於在 resetlog之前就已經offline的資料檔案ORA-00283: 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'



 

 

相關文章

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.