[20210311]如何建立bbed安裝包.txt

lfree發表於2021-03-12

[20210311]如何建立bbed安裝包.txt

--//這個跟我的一次經歷有關,幫別人恢復一個壞塊裡資料,對方機器裡面沒有安裝bbed,而且bbed的安裝要從10g上複製一些檔案然後
--//編譯,網上有一些連結講解如何安裝編譯bbed在11g下。可以參考連結:
--//http://blog.itpub.net/267265/viewspace-745588/ => [20121004]11G下編譯bbed.txt

--//今天嘗試在11g做一個安裝包,以後直接解壓複製就可以使用,我僅僅介紹如何製作的方法。

1.環境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.確定需要檔案:
$ ldd $(which bbed)
        linux-vdso.so.1 =>  (0x00007fff0974c000)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        libclntsh.so.11.1 => /u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libclntsh.so.11.1 (0x00007f2b46c6e000)
        libnnz11.so => /u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnnz11.so (0x00007f2b468a0000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000003799800000)
        libm.so.6 => /lib64/libm.so.6 (0x00000032cac00000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x000000379a000000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x000000379c400000)
        libc.so.6 => /lib64/libc.so.6 (0x0000003799000000)
        libaio.so.1 => /usr/lib64/libaio.so.1 (0x00007f2b4669d000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003798c00000)
--//注下劃線檔案找不到,這個很特殊,大家可以網上檢索就知道了。
--//實際上只要複製/u01下的2個檔案。

$ mkdir -p bbedins
$ cd bbedins
--//複製上面看到的檔案到該目錄包括bbed執行檔案。
$ ll
total 63440
-rwxr-xr-x 1 oracle oinstall   255300 2021-03-10 17:19:53 bbed
-rwxr-xr-x 1 oracle oinstall   144776 2021-03-10 17:22:18 ld-linux-x86-64.so.2
-rwxr-xr-x 1 oracle oinstall     3768 2021-03-10 17:22:12 libaio.so.1
-rwxr-xr-x 1 oracle oinstall 53793394 2021-03-10 17:20:37 libclntsh.so.11.1
-rwxr-xr-x 1 oracle oinstall  1726320 2021-03-10 17:22:06 libc.so.6
-rwxr-xr-x 1 oracle oinstall    23360 2021-03-10 17:21:00 libdl.so.2
-rwxr-xr-x 1 oracle oinstall   614992 2021-03-10 17:21:13 libm.so.6
-rw-r--r-- 1 oracle oinstall  7996693 2021-03-10 17:20:46 libnnz11.so
-rwxr-xr-x 1 oracle oinstall   114352 2021-03-10 17:22:00 libnsl.so.1
-rwxr-xr-x 1 oracle oinstall   149968 2021-03-10 17:21:23 libpthread.so.0

3.啟動bbed,確定還有那些檔案需要:
$ ps -ef | grep bbe[d]
oracle   18754 18369  0 08:31 pts/2    00:00:00 /usr/local/bin/rlwrap -s 9999 -c -r -i -f /usr/local/share/rlwrap/bbed /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/bbed parfile=bbed.par cmdfile=cmd.par
oracle   18755 18754  0 08:31 pts/7    00:00:00 bbed app/oracle/product/11.2.0.4/dbhome_1/bin/bbed parfile=bbed.par cmdfile=cmd.par
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--//程式號 18755.

$ ls -l /proc/18755/fd
total 0
lrwx------ 1 oracle oinstall 64 2021-03-11 08:31:28 0 -> /dev/pts/7
lrwx------ 1 oracle oinstall 64 2021-03-11 08:31:28 1 -> /dev/pts/7
lrwx------ 1 oracle oinstall 64 2021-03-11 08:31:19 2 -> /dev/pts/7
lr-x------ 1 oracle oinstall 64 2021-03-11 08:31:28 3 -> /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.msb
lr-x------ 1 oracle oinstall 64 2021-03-11 08:31:28 4 -> /u01/app/oracle/product/11.2.0.4/dbhome_1/oracore/mesg/lrmus.msb
lr-x------ 1 oracle oinstall 64 2021-03-11 08:31:28 5 -> /home/oracle/bbed/filelist.txt
lrwx------ 1 oracle oinstall 64 2021-03-11 08:31:28 6 -> /mnt/ramdisk/book/system01.dbf
l-wx------ 1 oracle oinstall 64 2021-03-11 08:31:28 7 -> /home/oracle/bbed/log.bbd
lr-x------ 1 oracle oinstall 64 2021-03-11 08:31:28 8 -> /home/oracle/bbed/cmd.par
--//注意/u01目錄下幾個檔案。

$ cd bbedins
$ cp /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/mesg/bbedus.ms?  .
$ cp /u01/app/oracle/product/11.2.0.4/dbhome_1/oracore/mesg/lrmus.ms? .

--//$ find . -type f -exec ls -l {} \;
$ ll
total 63468
-rwxr-xr-x 1 oracle oinstall   255300 2021-03-10 17:19:53 bbed
-rw-r--r-- 1 oracle oinstall       75 2021-03-11 09:24:38 bbed.par
-rw-r--r-- 1 oracle oinstall     8704 2021-03-11 09:24:22 bbedus.msb
-rwxr-xr-x 1 oracle oinstall    10299 2021-03-11 09:24:22 bbedus.msg
-rw-r--r-- 1 oracle oinstall       27 2021-03-11 08:55:01 cmd.par
-rw-r--r-- 1 oracle oinstall     1352 2021-03-11 09:00:23 filelist.txt
-rwxr-xr-x 1 oracle oinstall   144776 2021-03-10 17:22:18 ld-linux-x86-64.so.2
-rwxr-xr-x 1 oracle oinstall     3768 2021-03-10 17:22:12 libaio.so.1
-rwxr-xr-x 1 oracle oinstall 53793394 2021-03-10 17:20:37 libclntsh.so.11.1
-rwxr-xr-x 1 oracle oinstall  1726320 2021-03-10 17:22:06 libc.so.6
-rwxr-xr-x 1 oracle oinstall    23360 2021-03-10 17:21:00 libdl.so.2
-rwxr-xr-x 1 oracle oinstall   614992 2021-03-10 17:21:13 libm.so.6
-rw-r--r-- 1 oracle oinstall  7996693 2021-03-10 17:20:46 libnnz11.so
-rwxr-xr-x 1 oracle oinstall   114352 2021-03-10 17:22:00 libnsl.so.1
-rwxr-xr-x 1 oracle oinstall   149968 2021-03-10 17:21:23 libpthread.so.0
-rw-r--r-- 1 oracle oinstall     4608 2021-03-11 09:26:20 lrmus.msb
-rw-r--r-- 1 oracle oinstall     4433 2021-03-11 09:26:20 lrmus.msg

--//使用tar命令打包。
$ cd /home/oracle/
$ tar czf bbedins.tgz bbedins

3.測試:
--//複製tar包到另外的伺服器,解壓:
# cd /home/oracle
# tar xzvf bbedins.tgz
bbedins/
bbedins/bbedus.msb
bbedins/bbed.par
bbedins/bbed
bbedins/lrmus.msg
bbedins/libnsl.so.1
bbedins/bbedus.msg
bbedins/libaio.so.1
bbedins/libm.so.6
bbedins/libclntsh.so.11.1
bbedins/ld-linux-x86-64.so.2
bbedins/libc.so.6
bbedins/libpthread.so.0
bbedins/libnnz11.so
bbedins/lrmus.msb
bbedins/libdl.so.2
bbedins/filelist.txt
bbedins/cmd.par

# chown -R oracle:oinstall bbedins
--//注好像現在的tar命令做了改進,自動完成,只要你伺服器有oracle使用者和oinstall組。也就是這步可能可以省略。
--//登入oracle使用者測試:

$ rlwrap ./bbed parfile=bbed.par cmdfile=cmd.par
./bbed: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/oracle/bbedins

$ rlwrap ./bbed parfile=bbed.par cmdfile=cmd.par
BBED: Release 2.0.0.0.0 - Limited Production on Thu Mar 11 09:43:49 2021
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************

BBED> set count 64
        COUNT           64

BBED> set width 160
        WIDTH           160

BBED> help verify
Message 1029 not found; No message file for product=RDBMS, facility=BBED

$ cp bbedus.ms? /u01/app/oracle/product/18.0.0/db_home/rdbms/mesg/
$ rlwrap ./bbed parfile=bbed.par cmdfile=cmd.par
BBED: Release 2.0.0.0.0 - Limited Production on Thu Mar 11 09:45:11 2021
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************

BBED> set count 64
        COUNT           64

BBED> set width 160
        WIDTH           160

BBED> help verify
VERIFY [ DBA | FILE | FILENAME | BLOCK ]

--//這樣基本能正常使用了。
4.補充說明:
$ ldd bbed
        linux-vdso.so.1 =>  (0x00007ffcde366000)
        libclntsh.so.11.1 => /home/oracle/bbedins/libclntsh.so.11.1 (0x00007f26fe18b000)
        libnnz11.so => /home/oracle/bbedins/libnnz11.so (0x00007f26fddbd000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f26fdbb9000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f26fd8b7000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f26fd69a000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f26fd480000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f26fd0b2000)
        libaio.so.1 => /lib64/libaio.so.1 (0x00007f26fceaf000)
        /lib64/ld-linux-x86-64.so.2 (0x000055e8185de000)
--//實際上僅僅需要2個oracle的庫檔案。另外我發現我們一些伺服器LD_LIBRARY_PATH環境變數並沒有定義。
--//需要自己人為定義例子:
$ export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/lib64:/usr/lib64:/usr/local/lib64:/home/oracle/bbedins

5.附上引數檔案配置:

$ cat cmd.par
set count 64
set width 160

$ cat bbed.par
blocksize=8192
#listfile=filelist.txt
mode=edit
PASSWORD=blockedit
SPOOL=Y
--//listfile那行我註解了。filelist.txt的生成可以執行select file#||' '||name c100 from v$dbfile order by 1;:例子如下:
SYS@book> select file#||' '||name c100 from v$dbfile order by 1;
C100
----------------------------------------
1 /mnt/ramdisk/book/system01.dbf
2 /mnt/ramdisk/book/sysaux01.dbf
3 /mnt/ramdisk/book/undotbs01.dbf
4 /mnt/ramdisk/book/users01.dbf
5 /mnt/ramdisk/book/example01.dbf
6 /mnt/ramdisk/book/tea01.dbf
7 /mnt/ramdisk/book/mssm01.dbf
8 /mnt/ramdisk/book/big.dbf
8 rows selected.

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

相關文章