[20170302]fuzzy儲存在那裡.txt

lfree發表於2017-03-03

[20170302]fuzzy儲存在那裡.txt

--參考連結:http://blog.itpub.net/267265/viewspace-2134551/
--提到fuzzy表示某種狀態,正常關閉是NO.
--從訪問的檢視看v$datafile_header,應該這個資訊儲存在資料檔案頭,找找具體的位置在那裡.

1.環境:
SYS@book> @ &r/ver
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

--//從冷備份複製回來,我這個冷備份是異常關機的.利用異常恢復scn到那裡3介紹的方法:
--//連結:http://blog.itpub.net/267265/viewspace-2134595/

recover database until change 13276911100;
recover database ;

--//這樣2中恢復方式,fuzzy前者是yes,後者是no.透過對比是否可以確定問題.

2.測試1:
SYS@book> recover database until change 13276911100;
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/mnt/ramdisk/book/system01.dbf'


SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file#=1;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS     CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ---------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13276911100 2017-02-28 14:42:35                7            925702 ONLINE                  838 YES /mnt/ramdisk/book/system01.dbf                     SYSTEM

SYS@book> shutdown immediate ;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

$ cp /mnt/ramdisk/book/tea01.dbf /u01/backup/fuzzy/tea01.dbf_yes

3.測試2:
SYS@book> recover database ;
Media recovery complete.
SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header where file#=1;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS     CHECKPOINT_COUNT FUZ NAME                                               TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ---------- ---------------- --- -------------------------------------------------- ------------------------------
    1        13276931100 2017-02-28 14:42:35                7            925702 ONLINE                  839 NO  /mnt/ramdisk/book/system01.dbf                     SYSTEM
--//關閉資料庫分析.

$ cp /mnt/ramdisk/book/tea01.dbf /u01/backup/fuzzy/tea01.dbf_no

4.對比:
$ dd if=tea01.dbf_yes of=yes.dd bs=8192 skip=1 count=1
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000102445 seconds, 80.0 MB/s

$ dd if=tea01.dbf_no of=no.dd bs=8192 skip=1 count=1
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 9.2346e-05 seconds, 88.7 MB/s

$ xxd -c 16 yes.dd > yes.txt
$ xxd -c 16 no.dd > no.txt

$ diff  yes.txt no.txt
2c2
< 0000010: d5ce 0000 0000 0000 0004 200b 6e21 b74f  瘴........ .n!.O
---
> 0000010: 8693 0000 0000 0000 0004 200b 6e21 b74f  .......... .n!.O 
9,10c9,10
< 0000080: 0000 0000 0000 0000 0000 0400 d400 0000  ............?..
< 0000090: 4974 e237 d300 0000 0000 0000 0000 0000  It??..........
---
> 0000080: 0000 0000 0000 0000 0000 0000 d500 0000  ............?..
> 0000090: dc74 e237 d400 0000 0000 0000 0000 0000  躷??..........
24c24
< 0000170: 0600 0000 0000 0000 0000 0000 0000 0000  ................
---
> 0000170: 0600 0000 0000 0000 0000 0000 fe1b da37  ............??
31c31
< 00001e0: 0000 0000 fc95 5d17 0300 0000 dbbb db37  ....?].....??
---
> 00001e0: 0000 0000 1ce4 5d17 0300 0000 dbbb db37  .....鋆.....??

--透過bbed觀察:
--ub2 chkval_kcbh                          @16       0x9386 -->檢查和
--ub4 kcvfhcpc                             @140      0x000000d5 => d5 = 213 檢查記數
--ub4 kcvfhrts                             @144      0x37e274dc
--ub4 kcvfhrft                             @380      0x37da1bfe

--//猜測這個可能性最大:
BBED> p kcvfhsta
ub2 kcvfhsta                                @138      0x0000 (NONE)


BBED> assign kcvfhsta=0x0040
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub2 kcvfhsta                                @138      0x0040 (NONE)

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

SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE#  , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name  FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME     CREATION_CHANGE# RESETLOGS_CHANGE# STATUS     CHECKPOINT_COUNT FUZ NAME                             TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ---------- ---------------- --- -------------------------------- ---------------
    1        13276931100 2017-02-28 14:42:35                7            925702 ONLINE                  839 NO  /mnt/ramdisk/book/system01.dbf   SYSTEM
    2        13276931100 2017-02-28 14:42:35             1834            925702 ONLINE                  828 NO  /mnt/ramdisk/book/sysaux01.dbf   SYSAUX
    3        13276931100 2017-02-28 14:42:35           923328            925702 ONLINE                  749 NO  /mnt/ramdisk/book/undotbs01.dbf  UNDOTBS1
    4        13276931100 2017-02-28 14:42:35            16143            925702 ONLINE                  834 NO  /mnt/ramdisk/book/users01.dbf    USERS
    5        13276931100 2017-02-28 14:42:35           952916            925702 ONLINE                  745 NO  /mnt/ramdisk/book/example01.dbf  EXAMPLE
    6        13276931100 2017-02-28 14:42:35      13276257767            925702 ONLINE                  213 YES /mnt/ramdisk/book/tea01.dbf      TEA
6 rows selected.

--猜測正確. file#=6 FUZ=YES.

SYS@book> alter database open ;
alter database open
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [3648], [6], [64], [], [], [], [], [], [], [], [], []
--猜測一下[6]估計指資料檔案6.

--//修改回來.
BBED> set dba 6,1
        DBA             0x01800001 (25165825 6,1)

BBED> assign kcvfhsta=0x0
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub2 kcvfhsta                                @138      0x0000 (NONE)

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

SYS@book> select open_mode from v$database ;
OPEN_MODE
--------------------
MOUNTED

SYS@book> alter database open ;
Database altered.

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

相關文章