将exp的脚本写在shell中,运行时出错,脚本很简单如下:
[client@NYS amrldvw]$ vi exp.sh
#!/bin/sh
cd /u01/dump/amrldvw
owner=amrldvw
year=2018
sid=c208
exp ${owner}/${owner}@${sid} file=${owner}_${year}.dmp log=${owner}_${year}.log tables=%${year}% direct=y statistics=none
gzip ${owner}_${year}.dmp
出错信息如下:
[client@NYS amrldvw]$ at now
at> /u01/dump/amrldvw/exp.sh > log.log 2>&1
at> <EOT>
job 215 at 2018-11-02 08:38
[client@NYS amrldvw]$ cat log.log
exp: error while loading shared libraries: libclntsh.so.10.1: cannot open shared object file: No such file or directory
gzip: amrldvw_2018.dmp: No such file or directory
不过这台机器直接运行exp是正常的,exp放在脚本中运行就出错了。
通过网上查找方法,解决如下:
确定当前的$ORACLE_HOME
[client@NYS amrldvw]$ cd $ORACLE_HOME/lib
[client@NYS lib]$ pwd
/home/client/app/oracle/product/10201/lib
确保$ORACLE_HOME/lib下面有libclntsh.so.10.1文件
[client@NYS lib]$ ll libclntsh.so.10.1
-rwxrwxrwx. 1 client client 19007643 Jun 24 2008 libclntsh.so.10.1
用root帐号修改/etc/ld.so.conf,将/home/client/app/oracle/product/10201/lib添加进去
[root@NYS ~]# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/home/client/app/oracle/product/10201/lib
运行ldconfig
[root@NYS ~]# ldconfig
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmuc.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmalk.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmefud.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmasf.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmefut.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmeoci.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmefsql.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmefos.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libordim10.soO is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmarl.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmevq.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmadm.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmadbg.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmefvr.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmemso.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmuk.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmastk.so.0 is empty, not checked.
ldconfig: File /home/client/app/oracle/product/10201/lib/libnmefw.so.0 is empty, not checked.
ldconfig: /home/client/app/oracle/product/10201/lib/libexpat.so.0 is not a symbolic link
重新试一下是否正常
[client@NYS amrldvw]$ at now
at> /u01/dump/amrldvw/exp.sh >log.log 2>&1
at> <EOT>
job 220 at 2018-11-02 08:45
[client@NYS amrldvw]$ cat log.log
Export: Release 10.2.0.4.0 - Production on Fri Nov 2 08:45:52 2018
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
About to export specified tables via Direct Path ...
. . exporting table CABLE_REF_2018 5170 rows exported
. . exporting table DAYPART_REF_2018 246 rows exported
. . exporting table DEMO_BB_CAT_REF_2018 1312 rows exported
. . exporting table HH_INFO_2018 0 rows exported
问题解决。
参考: