ORACLE_HOME迁移后需要设置LD_LIBRARY_PATH环境变量

在10g以后,一般情况下环境变量中没有必要设置LD_LIBRARY_PATH,但是一旦将ORACLE_HOME迁移到其他目录,则环境变量中还需要添加这个变量。
Linux和Unix支持TAR方式迁移ORACLE_HOME,如果有需要将ORACLE_HOME放到其他路径下,那么一般都会使用tar的方式将整个路径拷贝到目标目录。
但是迁移后,如果直接尝试sqlplus启动,可能报错:

[orat3@hpserver2 ~]$ sqlplus / AS sysdba
sqlplus: error while loading shared libraries: libsqlplus.so: cannot OPEN shared object file: No such file OR directory

而设置LD_LIBRARY_PATH后,问题解决:

[orat3@hpserver2 ~]$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib
[orat3@hpserver2 ~]$ sqlplus / AS sysdba
SQL*Plus: Release 10.2.0.4.0 - Production ON Sun Mar 18 16:10:57 2012
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
SQL>

还有一种类似的错误:

[orat0@hpserver2 ~]$ sqlplus / AS sysdba
SQL*Plus: Release 10.2.0.5.0 - Production ON Sun Mar 18 16:12:03 2012
Copyright (c) 1982, 2010, Oracle. ALL Rights Reserved.
oracleorcl10g: error while loading shared libraries: libskgxp10.so: cannot OPEN shared object file: No such file OR directory
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: 
oracleorcl10g: error while loading shared libraries: libskgxp10.so: cannot OPEN shared object file: No such file OR directory
ERROR:
ORA-12547: TNS:lost contact
Enter user-name: 
oracleorcl10g: error while loading shared libraries: libskgxp10.so: cannot OPEN shared object file: No such file OR directory
ERROR:
ORA-12547: TNS:lost contact
SP2-0157: unable TO CONNECT TO ORACLE after 3 attempts, exiting SQL*Plus
[orat0@hpserver2 ~]$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib
[orat0@hpserver2 ~]$ sqlplus / AS sysdba
SQL*Plus: Release 10.2.0.5.0 - Production ON Sun Mar 18 16:12:18 2012
Copyright (c) 1982, 2010, Oracle. ALL Rights Reserved.
Connected TO:
Oracle DATABASE 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options
SQL>

错误的表相虽然不同,但是解决方法是相同的。

This entry was posted in ORACLE and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *