[20161006]windows下bbed使用注意.txt

lfree發表於2016-10-08

[20161006]windows下bbed使用注意.txt

--我已經多次提到windows下 的bbed 存在一個偏移看10g以上的資料檔案,主要問題在於windows的bbed來自9i,以後不在出現。
--而這個版本無法識別10g以上的資料檔案的第1塊OS塊,導致出現偏差:

http://blog.itpub.net/267265/viewspace-2109019/
http://blog.itpub.net/267265/viewspace-2116311/

--而實際上更嚴重的問題是這個版本識別第1塊存在問題。透過例子來說明:

1.環境:
SYS@test> select * from v$version ;
BANNER                                                                                 CON_ID
-------------------------------------------------------------------------------- ------------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production                0
PL/SQL Release 12.1.0.1.0 - Production                                                      0
CORE    12.1.0.1.0      Production                                                          0
TNS for 64-bit Windows: Version 12.1.0.1.0 - Production                                     0
NLSRTL Version 12.1.0.1.0 - Production                                                      0

BBED> info
File#  Name                                                          Size(blks)
-----  ----                                                          ----------
     1  D:\APP\ORACLE\ORADATA\TEST\SYSTEM01.DBF                                0
     2  D:\APP\ORACLE\ORADATA\TEST\PDBSEED\SYSTEM01.DBF                        0
     3  D:\APP\ORACLE\ORADATA\TEST\SYSAUX01.DBF                                0
     4  D:\APP\ORACLE\ORADATA\TEST\PDBSEED\SYSAUX01.DBF                        0
     5  D:\APP\ORACLE\ORADATA\TEST\UNDOTBS01.DBF                               0
     6  D:\APP\ORACLE\ORADATA\TEST\USERS01.DBF                                 0
     7  D:\APP\ORACLE\ORADATA\TEST\TEST01P\SYSTEM01.DBF                        0
     8  D:\APP\ORACLE\ORADATA\TEST\TEST01P\SYSAUX01.DBF                        0
     9  D:\APP\ORACLE\ORADATA\TEST\TEST01P\SAMPLE_SCHEMA_USERS01.DBF           0
    10  D:\APP\ORACLE\ORADATA\TEST\TEST01P\EXAMPLE01.DBF                       0
    15  D:\APP\ORACLE\ORADATA\TEST\TEST01P\LFREE01.DBF                         0

2.測試:
BBED> set dba 1,2
        DBA             0x00400002 (4194306 1,2)

--//注實際上訪問的是dba 1,1

BBED> p kcvfhtnm
text kcvfhtnm[0]                            @250
text kcvfhtnm[1]                            @251
text kcvfhtnm[2]                            @252
text kcvfhtnm[3]                            @253
text kcvfhtnm[4]                            @254
text kcvfhtnm[5]                            @255
text kcvfhtnm[6]                            @256
text kcvfhtnm[7]                            @257
text kcvfhtnm[8]                            @258
...

BBED> p kcvfh.kcvfhtnm
text kcvfhtnm[0]                            @250
text kcvfhtnm[1]                            @251
text kcvfhtnm[2]                            @252
text kcvfhtnm[3]                            @253
text kcvfhtnm[4]                            @254
text kcvfhtnm[5]                            @255
text kcvfhtnm[6]                            @256
text kcvfhtnm[7]                            @257
text kcvfhtnm[8]                            @258
text kcvfhtnm[9]                            @259

--很奇怪吧,這個版本無法看到資料檔案的表空間名字。
BBED> p kcvfhtln
ub2 kcvfhtln                                @248      0x0000

--表空間的長度也是0,明顯不對。

3.而實際上表空間的名字在偏移offset=338

BBED> dump /v count 30 offset 336
File: D:\APP\ORACLE\ORADATA\TEST\SYSTEM01.DBF (1)
Block: 2                                 Offsets:  336 to  365                            Dba:0x00400002
-----------------------------------------------------------------------------------------------------------
06005359 5354454d 00000000 00000000 00000000 00000000 00000000 0000     l ..SYSTEM......................

<32 bytes per line>

--前面的0x06 表示表空間的長度,是6對上的。

--也就是說這個版本無法識別10g以上的檔案頭,至少存在錯誤,在使用中要特別注意。在選擇修復時要特別注意,切記!!
--或者講這個版本僅僅能看9i或者以下的資料檔案。

4.我們可以複製1個9i的資料檔案來驗證我的判斷:

BBED> set width 150
        WIDTH           150

BBED> info
File#  Name                                   Size(blks)
-----  ----                                   ----------
     1  D:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF             0
     2  D:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF            0
     3  D:\ORACLE\ORADATA\ORCL\CWMLITE01.DBF            0
     4  D:\ORACLE\ORADATA\ORCL\DRSYS01.DBF              0
     5  D:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF            0
     6  D:\ORACLE\ORADATA\ORCL\INDX01.DBF               0
     7  D:\ORACLE\ORADATA\ORCL\ODM01.DBF                0
     8  D:\ORACLE\ORADATA\ORCL\TOOLS01.DBF              0
     9  D:\ORACLE\ORADATA\ORCL\USERS01.DBF              0
    10  D:\ORACLE\ORADATA\ORCL\XDB01.DBF                0

BBED> set dba 6,1
        DBA             0x01800001 (25165825 6,1)

BBED> p kcvfhtnm
text kcvfhtnm[0]                            @250     I
text kcvfhtnm[1]                            @251     N
text kcvfhtnm[2]                            @252     D
text kcvfhtnm[3]                            @253     X
text kcvfhtnm[4]                            @254
...

BBED> p kcvfhtln
ub2 kcvfhtln                                @248      0x0004
--//表空間名長度也正確。
--//可以看到使用windows的bbed看9i的資料檔案是正常的,而且偏移250.也就是9版本的bbed看10g以上的資料檔案頭是存在問題的。
--//我檢視使用的版本是for windows的版本。

5.再將這個INDX01.DBF複製到linux看看:

BBED> info
File#  Name                                 Size(blks)
-----  ----                                 ----------
     1  /mnt/ramdisk/book/system01.dbf                0
     2  /mnt/ramdisk/book/sysaux01.dbf                0
     3  /mnt/ramdisk/book/undotbs01.dbf               0
     4  /mnt/ramdisk/book/users01.dbf                 0
     5  /mnt/ramdisk/book/example01.dbf               0
     6  /mnt/ramdisk/book/tea01.dbf                   0
    14  /home/oracle/backup/users01.dbf               0
    20  /home/oracle/bbed/icare_asm_header            0
    21  /home/oracle/emp.aaa                          0
    22  /home/oracle/emp.aab                          0
   201  /mnt/ramdisk/book/temp01.dbf                  0
   306  /mnt/ramdisk/book/INDX01.DBF                  0

BBED> p kcvfhtnm
text kcvfhtnm[0]                            @338
text kcvfhtnm[1]                            @339
text kcvfhtnm[2]                            @340
text kcvfhtnm[3]                            @341
text kcvfhtnm[4]                            @342
text kcvfhtnm[5]                            @343
text kcvfhtnm[6]                            @344
text kcvfhtnm[7]                            @345
text kcvfhtnm[8]                            @346

BBED> p kcvfhtln
ub2 kcvfhtln                                @336      0x0000

--看system表空間資料檔案:

BBED> set dba 1,1
        DBA             0x00400001 (4194305 1,1)

BBED> p kcvfhtnm
text kcvfhtnm[0]                            @338     S
text kcvfhtnm[1]                            @339     Y
text kcvfhtnm[2]                            @340     S
text kcvfhtnm[3]                            @341     T
text kcvfhtnm[4]                            @342     E
text kcvfhtnm[5]                            @343     M
text kcvfhtnm[6]                            @344
text kcvfhtnm[7]                            @345
text kcvfhtnm[8]                            @346
text kcvfhtnm[9]                            @347

BBED> p kcvfhtln
ub2 kcvfhtln                                @336      0x0006

--//可見11g下的linux版本也不能看9i的資料檔案頭。

--//但是看普通的資料塊應該沒有問題,至少我沒有遇到這個問題或者現象。這個應該在工作中引起注意。

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

相關文章