ITPub博客

首页 > 数据库 > Oracle > [20210311]如何建立bbed安装包.txt

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

原创 Oracle 作者:lfree 时间:2021-03-12 09:40:03 0 删除 编辑

[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博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2762464/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969582