[20210303]bbed使用小問題.txt

lfree發表於2021-03-04

[20210303]bbed使用小問題.txt

--//在11g下使用bbed存在一個小問題,其實也是不重要,僅僅看著不舒服。

BBED> verify dba 4,135
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/users01.dbf
BLOCK = 135
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--//注意看下劃線。似乎資訊檔案沒有531資訊。但是如果你在10g使用,不會出現如上資訊的。
--//bbed在11g上的安裝實際上兩個bbedus.msb,bbedus.msg是從10g安裝庫複製過來的。

$ md5sum $(locate bbedus)
164e226fb5191379b4246dcca40358fe  /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.msb
e55157e9702b0ec66343517c85c9402e  /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.msg

--//使用strace跟蹤:
$ strace -f -p 54750

read(3, "n\0\322\0001\1\222\1\374\1\350\3\364\3\374\3\6\4\20\4\25\4\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
lseek(3, 4096, SEEK_SET)                = 4096
read(3, "\16\0\375\1\2\0\\\0\376\1\2\0~\0\377\1\2\0\240\0\10\2\2\0\302\0\t\2\2\0\325\0"..., 512) = 512
write(1, "Message 531 not found;  product="..., 53) = 53
write(7, "Message 531 not found;  product="..., 53) = 53
write(1, "\n", 1)                       = 1
write(7, "\n", 1)                       = 1
write(1, "\n", 1)                       = 1
write(7, "\n", 1)                       = 1
write(1, "BBED> ", 6)                   = 6
--//造成這樣情況的原因,我估計11g下的編譯某一些選項與10g不同。

$ ls -l /proc/54750/fd/
total 0
lrwx------ 1 oracle oinstall 64 2021-03-03 16:37:55 0 -> /dev/pts/5
lrwx------ 1 oracle oinstall 64 2021-03-03 16:37:55 1 -> /dev/pts/5
lrwx------ 1 oracle oinstall 64 2021-03-03 16:36:10 2 -> /dev/pts/5
lr-x------ 1 oracle oinstall 64 2021-03-03 16:37:55 3 -> /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.msb
lr-x------ 1 oracle oinstall 64 2021-03-03 16:37:55 4 -> /u01/app/oracle/product/11.2.0.4/dbhome_1/oracore/mesg/lrmus.msb
lr-x------ 1 oracle oinstall 64 2021-03-03 16:37:55 5 -> /home/oracle/bbed/filelist.txt
l-wx------ 1 oracle oinstall 64 2021-03-03 16:37:55 7 -> /home/oracle/bbed/log.bbd
lr-x------ 1 oracle oinstall 64 2021-03-03 16:37:55 8 -> /home/oracle/bbed/cmd.par
lrwx------ 1 oracle oinstall 64 2021-03-03 16:37:55 9 -> /mnt/ramdisk/book/users01.dbf

$ cd /u01/app/oracle/product/11.2.0.4/dbhome_1/oracore/mesg/
$ grep 531 bbedus.msg

--//如果你開啟bbedus.msg檔案可以發現:
/
/ KUTV Log Messages:
/
500,    2, "DBVERIFY - Verification starting\nFILE = %s"
501,    2, "BLOCK = %u"
502,    2, "DBVERIFY - Verification complete"
503,    2, "Block %d failed with check code %u"
504,    2, "Total Blocks Examined         : %u"
505,    2, "Total Blocks Processed (Data) : %u"
506,    2, "Total Blocks Failing   (Data) : %u"
507,    2, "Total Blocks Processed (Index): %u"
508,    2, "Total Blocks Failing   (Index): %u"
509,    2, "Total Blocks Empty            : %u"
510,    2, "Total Blocks Marked Corrupt   : %u"
511,    2, "Total Blocks Influx           : %u"
520,    2, "Block %u is corrupt"
521,    2, "Block %u is influx - most likely media corrupt"
522,    2, " Version is illegal\n"
523,    2, " Type out of range\n"
524,    2, " Type is zero\n"
525,    2, " Block number mismatch\n"
526,    2, " Sequence is zero\n"
527,    2, " Incarnation is zero\n"
528,    2, " Checksum is incorrect\n"
/
/

--//就是沒有531編號的資訊。既然這樣可以手工加入:
528,    2, " Checksum is incorrect\n"
531,    2, "\n"

--//當然這樣不算完成,必須手工編譯msg檔案,oracle提供工具 lmsgen。
$ ls -l /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/*msg*
-rwxr-xr-x 1 oracle oinstall 1598817 2013-08-24 00:21:36 /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/lmsgen
*/

--//編譯前先做一個備份。
$ cd /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg
$ cp bbedus.msb bbedus.msb_ORG

$ lmsgen
NLS Binary Message File Generation Utility: Version 11.2.0.4.0 - Production
Copyright (c) Oracle 1979, 2004.  All rights reserved.
CORE    11.2.0.4.0      Production
Incorrect number of arguments specified!
Syntax:
LMSGEN <text file> <product> <facility> [language] [-i indir] [-o outdir]

Where <text file> is a message text file
      <product>   the name of the product
      <facility>  the name of the facility
      [language]  optional message language in
                  <language>_<territory>.<character set> format
                  This is required if message file is not tagged properly
                  with language
      [-i indir]  optional directory where to locate the text file
      [-o outdir] optional directory where to put the generated binary file.

$ lmsgen bbedus.msg bbed bbed american
NLS Binary Message File Generation Utility: Version 11.2.0.4.0 - Production
Copyright (c) Oracle 1979, 2004.  All rights reserved.
CORE    11.2.0.4.0      Production
Unable to create binary file /u01/app/oracle/product/11.2.0.4/dbhome_1/bbed/mesg/bbedus.msb
--//寫錯了。product,facility表示什麼? 噢看前面的提示可以猜測product=rdbms,facility=bbed.
--//Message 531 not found;  product=RDBMS; facility=BBED
--//實際上product=rdbms表示目錄。facility=bbed表示編譯檔案開頭,american 我猜測對應us。

$ lmsgen bbedus.msg rdbms bbed american
NLS Binary Message File Generation Utility: Version 11.2.0.4.0 - Production
Copyright (c) Oracle 1979, 2004.  All rights reserved.
CORE    11.2.0.4.0      Production

--//OK,編譯透過。
$ ls -l /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.ms*
-rw-r--r-- 1 oracle oinstall  8704 2021-03-03 17:10:03 /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.msb
-rw-r--r-- 1 oracle oinstall  8704 2021-03-03 17:01:26 /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.msb_ORG
-rwxr-xr-x 1 oracle oinstall 10286 2021-03-03 17:00:20 /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.msg

--//再次退出使用bbed:
BBED> verify dba 4,135
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/users01.dbf
BLOCK = 135
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0

--//現在就不報錯誤了。我嘗試修改如下:
531,    2, "Finish Verify\n"

BBED> verify dba 4,135
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/users01.dbf
BLOCK = 135
DBVERIFY - Verification complete
Total Blocks Examined         : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Finish Verify
~~~~~~~~~~~~~

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

相關文章