【kingsql分享】使用BBED修改Oracle資料檔案頭推進SCN

kingsql發表於2018-11-26

【kingsql分享】使用BBED修改Oracle資料檔案頭推進SCN


請看報大錯:

SQL> startup;

ORACLE instance started.


Total System Global Area 1603411968 bytes

Fixed Size                  2228784 bytes

Variable Size             989859280 bytes

Database Buffers          603979776 bytes

Redo Buffers                7344128 bytes

Database mounted.

ORA-01113: file 1 needs media recovery

ORA-01110: data file 1: '/u01/app/oracle/oradata/oggdb2/system01.dbf'


SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01113: file 1 needs media recovery

ORA-01110: data file 1: '/u01/app/oracle/oradata/oggdb2/system01.dbf'


現在開始修復資料吧!


SQL>  select name,checkpoint_change# from v$datafile;


NAME                                                         CHECKPOINT_CHANGE#

------------------------------------------------------------ ------------------

/u01/app/oracle/oradata/oggdb2/system01.dbf                          2147548266

/u01/app/oracle/oradata/oggdb2/sysaux01.dbf                          2147548266

/u01/app/oracle/oradata/oggdb2/undotbs01.dbf                         2147548266

/u01/app/oracle/oradata/oggdb2/users01.dbf                           2147548266

/u01/app/oracle/oradata/oggdb2/example01.dbf                         2147548266

/u01/app/oracle/oradata/oggdb2/gguser.dbf                            2147548266

/u01/app/oracle/oradata/oggdb2/p2pdata01.dbf                         2147548266


7 rows selected.


SQL> select name,checkpoint_change# from v$datafile_header;


NAME                                                         CHECKPOINT_CHANGE#

------------------------------------------------------------ ------------------

/u01/app/oracle/oradata/oggdb2/system01.dbf                          2147546874

/u01/app/oracle/oradata/oggdb2/sysaux01.dbf                          2147548266

/u01/app/oracle/oradata/oggdb2/undotbs01.dbf                         2147548266

/u01/app/oracle/oradata/oggdb2/users01.dbf                           2147548266

/u01/app/oracle/oradata/oggdb2/example01.dbf                         2147548266

/u01/app/oracle/oradata/oggdb2/gguser.dbf                            2147548266

/u01/app/oracle/oradata/oggdb2/p2pdata01.dbf                         2147548266


修復過程:


1.修改舊資料檔案頭scn的值


BBED> dump offset 484

 File: /u01/app/oracle/oradata/oggdb2/system01.dbf (1)

 Block: 1                Offsets:  484 to  983           Dba:0x00400001

------------------------------------------------------------------------

 8e4a0180 00000000 243e333b 01000000 94000000 02000000 10000000 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 02004000 32270f00 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 02ace702 c1770dd9 007b503c cfdee590 34000000 

 00000000 00000000 00000000 00012997 2a000000 38020000 00000000 c08c5ef2 

 05fe25a5 9d6b999e 14265f03 1ef30600 00000000 00000000 00000000 00000000 

 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> m /x 654f0180 offset 484

 File: /u01/app/oracle/oradata/oggdb2/system01.dbf (1)

 Block: 1                Offsets:  484 to  983           Dba:0x00400001

------------------------------------------------------------------------

 654f0180 00000000 243e333b 01000000 94000000 02000000 10000000 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 02004000 32270f00 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 02ace702 c1770dd9 007b503c cfdee590 34000000 

 00000000 00000000 00000000 00012997 2a000000 38020000 00000000 c08c5ef2 

 05fe25a5 9d6b999e 14265f03 1ef30600 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 



2.檢視並修正資料檔案頭chckpoint_time的值

本文固定連結 http://blog.itpub.net/28389881/viewspace-2221607/


BBED> dump offset 492

 File: /u01/app/oracle/oradata/oggdb2/system01.dbf (1)

 Block: 1                Offsets:  492 to  991           Dba:0x00400001

------------------------------------------------------------------------

 243e333b 01000000 94000000 02000000 10000000 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 02004000 32270f00 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 02ace702 c1770dd9 007b503c cfdee590 34000000 00000000 00000000 

 00000000 00012997 2a000000 38020000 00000000 c08c5ef2 05fe25a5 9d6b999e 

 14265f03 1ef30600 00000000 00000000 00000000 00000000 00000000 00000000 

 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> m /x be42333b offset 492

 File: /u01/app/oracle/oradata/oggdb2/system01.dbf (1)

 Block: 1                Offsets:  492 to  991           Dba:0x00400001

------------------------------------------------------------------------

 be42333b 01000000 94000000 02000000 10000000 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 02004000 32270f00 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 02ace702 c1770dd9 007b503c cfdee590 34000000 00000000 00000000 

 00000000 00012997 2a000000 38020000 00000000 c08c5ef2 05fe25a5 9d6b999e 

 14265f03 1ef30600 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 


3.修改舊資料檔案頭中檢查點計數器(kcvfhcpc)


BBED> dump offset 140 

 File: /u01/app/oracle/oradata/oggdb2/system01.dbf (1)

 Block: 1                Offsets:  140 to  639           Dba:0x00400001

------------------------------------------------------------------------

 28010000 223e333b 27010000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 06005359 5354454d 00000000 00000000 00000000 00000000 00000000 

 00000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 0a000a00 5c776c2d 01000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 654f0180 00000000 

 be42333b 01000000 94000000 02000000 10000000 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 


BBED> m /x 2a010000 offset 140

 File: /u01/app/oracle/oradata/oggdb2/system01.dbf (1)

 Block: 1                Offsets:  140 to  639           Dba:0x00400001

------------------------------------------------------------------------

 2a010000 223e333b 27010000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 06005359 5354454d 00000000 00000000 00000000 00000000 00000000 

 00000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 0a000a00 5c776c2d 01000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 654f0180 00000000 

 be42333b 01000000 94000000 02000000 10000000 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 



4.修改舊資料檔案頭中控制檔案備份的計數器(kcvfhccc)的值


BBED> dump offset 148 

File: /u01/app/oracle/oradata/oggdb2/system01.dbf (1)

 Block: 1                Offsets:  148 to  647           Dba:0x00400001

------------------------------------------------------------------------

 5c537c9d 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 06005359 

 5354454d 00000000 00000000 00000000 00000000 00000000 00000000 01000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 0a000a00 5c776c2d 01000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 654f0180 00000000 be42333b 01000000 

 94000000 02000000 10000000 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


BBED> m /x 29010000 offset 148

 File: /u01/app/oracle/oradata/oggdb2/system01.dbf (1)

 Block: 1                Offsets:  148 to  647           Dba:0x00400001

------------------------------------------------------------------------

 29010000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 06005359 

 5354454d 00000000 00000000 00000000 00000000 00000000 00000000 01000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 0a000a00 5c776c2d 01000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 00000000 00000000 00000000 00000000 654f0180 00000000 be42333b 01000000 

 94000000 02000000 10000000 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


5.重新生成sum

BBED> sum apply

Check value for File 1, Block 1:

current = 0xec9b, required = 0xec9b


6.查詢各個資料檔案頭scn

SQL> select file#,checkpoint_change#,name from v$datafile_header;


     FILE# CHECKPOINT_CHANGE# NAME

---------- ------------------ ------------------------------------------------------------

         1         2147548266 /u01/app/oracle/oradata/oggdb2/system01.dbf

         2         2147548266 /u01/app/oracle/oradata/oggdb2/sysaux01.dbf

         3         2147548266 /u01/app/oracle/oradata/oggdb2/undotbs01.dbf

         4         2147548266 /u01/app/oracle/oradata/oggdb2/users01.dbf

         5         2147548266 /u01/app/oracle/oradata/oggdb2/example01.dbf

         6         2147548266 /u01/app/oracle/oradata/oggdb2/gguser.dbf

         7         2147548266 /u01/app/oracle/oradata/oggdb2/p2pdata01.dbf


7 rows selected.


7 rows selected.


SQL> alter database open;


Database altered.


至此資料庫成功啟動咯~



轉載請註明出處

hongzhuohui@qq.com

本來好幾年沒有更新部落格了,最近我的學生們都在勤勞的寫部落格,所以帶動了我。。

--------------------------------------------------------------------------------------- ----------- ----------- -

我曾發現有寫網站直接複製貼上,連圖片都能複製,請把作者也加上謝謝O(∩_∩)O

---------------------------------------------------------------------------------------- ----------- -----------












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

相關文章