ORACLE_HOME遷移後需要設定LD_LIBRARY_PATH環境變數

yangtingkun發表於2012-03-16

10g以後,一般情況下環境變數中沒有必要設定LD_LIBRARY_PATH,但是一旦將ORACLE_HOME遷移到其他目錄,則環境變數中還需要新增這個變數。

 

 

LinuxUnix支援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>

錯誤的表相雖然不同,但是解決方法是相同的。

 

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

相關文章