Google 了下 ORA-600 [unable to load XDB library],大部分结果是要正确设置 LD_LIBRARY_PATH 和 LIBPATH 环境变量,metalink 文档号 351650.1 中提到(225897.1 中也有环境变量的设置方法):
Cause
These errors may be the result if the database was started and the environment variable LD_LIBRARY_PATH was not set, or was set to an incorrect version of $ORACLE_HOME/lib (e.g. to a different $ORACLE_HOME). If during the user level or full database export we are unable to locate the correct version of the libxdb.so / libxdb.sl library, the internal errors may occur.
Solution
1. Stop the database and stop the listener.
2. Set LD_LIBRARY_PATH so the first directory referenced is $ORACLE_HOME/lib
Example (replace $ORACLE_HOME with the full path of the Oracle home directory):
csh:$ setenv LD_LIBRARY_PATH=$ORACLE_HOME/lib$ setenv LIBPATH=$ORACLE_HOME/lib
ksh:$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib$ export LIBPATH=$ORACLE_HOME/lib
For Oracle9i and Oracle10g on AIX: set environment variable LIBPATH and afterwards, run /usr/sbin/slibclean as root
For Oracle9i and Oracle10g on HP-UX, Linux, Solaris, and Tru64: set environment variable LD_LIBRARY_PATH
3. Re-start the database and the listener.
询问了下他的环境变量设置为:
/home/oracle/app/oracle/product/920/lib32:/home/oracle/app/oracle/product/920/lib:/home/oracle/app/oracle/product/920/network/lib
貌似设置没有问题,而且前面的错误提示也表明路径已经识别出来了:
Dynamic link error: 0509-022 Cannot load module /home/oracle/app/oracle/product/920/lib32/libxdb.so.
0509-103 The module has an invalid magic number.
只是这个 0509-13 错误是什么意思呢?继续 google,在 itpub 上找到下文:
http://www.itpub.net/546629,2.html
其中提到 32 位和 64 位数据库上环境变量应指向不同的 lib 文件夹(全文在 metalink 上,文档号:109621.1):
5. WHICH VARIABLE SHOULD BE SET FOR 64 BIT ORACLE?
-----------------------------------------------
A 64 bit install of Oracle includes both 32 bit executables (such as svrmgrl
and sqlplus) and 64 bit executables (such as oracle).
The installation contains two 'lib' areas:
Prior to 9i:
$ORACLE_HOME/lib - 32 bit libs
$ORACLE_HOME/lib64 - 64 bit libs
9i onwards:
$ORACLE_HOME/lib32 - 32 bit libs
$ORACLE_HOME/lib - 64 bit libs
Both of these directories contain libraries of the same name. To ensure
that 32 bit executables search the 32 bit dir, and 64 bit executables
search the 64 bit dir, set the following:
Prior to 9i:
$LD_LIBRARY_PATH - includes $ORACLE_HOME/lib64, but not $ORACLE_HOME/lib
$SHLIB_PATH - includes $ORACLE_HOME/lib, but not $ORACLE_HOME/lib64
9i onwards:
$LD_LIBRARY_PATH - includes $ORACLE_HOME/lib, but not $ORACLE_HOME/lib32
$SHLIB_PATH - includes $ORACLE_HOME/lib32, but not $ORACLE_HOME/lib
再看了下 trc 文件中提到的版本信息:
Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
果然是 64 位的,而 LD_LIBRARY_PATH 中第一个路径指向 lib32,在 9i 之后,64 位的应该使用 lib 下的文件,因此造成 0509-103 The module has an invalid magic number 的错误。将 lib 路径放在环境变量最前面,应该可以解决问题了。