名称很长,不过仍然不足以描述这个错误的背景。确切的描述应该是oracle用户下的ORACLE_HOME,迁移到其他位置,并将oracle属主改变为其他用户,但是oinstall组未变。随后其他oinstall组用户,无法以/ as sysdba登录数据库。
公司测试环境,ORACLE_HOME为/u01/app/oracle/product/10.2.0/db_1,将ORACLE_HOME切换到/t0/orat0/app/oracle/product/10.2.0/db_1目录下,并将ORACLE_HOME的属主从oracle改为orat0。
授权后,orat0用户直接登录就出现这个错误:
[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> |
在设置了LD_LIBRARY_PATH后,问题得以解决。但是对于除了ORACLE_HOME的OWNER外的其他oinstall用户,登录数据库就会出现同样的错误。即使设置LD_LIBRARY_PATH也不起作用。
检查后发现ORACLE_HOME/bin/oracle权限改变:
[tingkun.yang@hpserver2 bin]$ ls -l oracle -rwxr-x--x 1 tingkun.yang oinstall 125153012 Feb 7 18:37 oracle [tingkun.yang@hpserver2 bin]$ chmod 6751 oracle |
修改文件属性后,问题依旧。
[tingkun.yang@hpserver2 ~]$ sqlplus / AS sysdba SQL*Plus: Release 10.2.0.5.0 - Production ON Mon Mar 19 16:45:26 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 |
最终怀疑是ORACLE_HOME发生变化后,某些链接库的位置改变,导致Oracle运行过程中找不到一些库文件,于是以owner身份对ORACLE_HOME进行了relink all的操作:
[orat0@hpserver2 lib]$ relink ALL /t0/orat0/app/oracle/product/10.2.0/db_1/bin/genclntsh /t0/orat0/app/oracle/product/10.2.0/db_1/bin/genagtsh /t0/orat0/app/oracle/product/10.2.0/db_1/lib/libagtsh.so 1.0 make -f /t0/orat0/app/oracle/product/10.2.0/db_1/precomp/lib/ins_precomp.mk relink EXENAME=proc make[1]: Entering directory `/t0/orat0/app/oracle/product/10.2.0/db_1/lib32' Linking /t0/orat0/app/oracle/product/10.2.0/db_1/precomp/lib/proc rm -f /t0/orat0/app/oracle/product/10.2.0/db_1/bin/proc mv /t0/orat0/app/oracle/product/10.2.0/db_1/precomp/lib/proc /t0/orat0/app/oracle/product/10.2.0/db_1/bin/ make[1]: Leaving directory `/t0/orat0/app/oracle/product/10.2.0/db_1/lib32' rm -f ldapadd ldapbind ldapcompare ldapdelete ldapmodify ldapsearch ldapmoddn ldapaddmt ldapmodifymt dsml2ldif gcc -o ldapadd -L/t0/orat0/app/oracle/product/10.2.0/db_1/ldap/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/stubs/ -o ldapadd -L/t0/orat0/app/oracle/product/10.2.0/db_1/ldap/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/stubs/ /t0/orat0/app/oracle/product/10.2.0/db_1/ldap/lib/s0gslmod.o /t0/orat0/app/oracle/product/10.2.0/db_1/ldap/lib/gslmcu.o -lncrypt10 /t0/orat0/app/oracle/product/10.2.0/db_1/lib/libldapclnt10.a -lldapclnt10 -lncrypt10 -lclntsh `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/sysliblist` -ldl -lm -Wl,-rpath,/t0/orat0/app/oracle/product/10.2.0/db_1/lib gcc -o ldapbind -L/t0/orat0/app/oracle/product/10.2.0/db_1/ldap/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/stubs/ -o ldapbind -L/t0/orat0/app/oracle/product/10.2.0/db_1/ldap/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/stubs/ /t0/orat0/app/oracle/product/10.2.0/db_1/ldap/lib/s0gslbind.o /t0/orat0/app/oracle/product/10.2.0/db_1/ldap/lib/gslmcu.o -lncrypt10 /t0/orat0/app/oracle/product/10.2.0/db_1/lib/libldapclnt10.a -lldapclnt10 -lncrypt10 -lclntsh `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/ldflags` -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclient10 -lnnetd10 -lvsn10 -lcommon10 -lgeneric10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/sysliblist` -ldl -lm -Wl,-rpath,/t0/orat0/app/oracle/product/10.2.0/db_1/lib . . . - Linking OCR check utility tool gcc -o ocrcheck -L/t0/orat0/app/oracle/product/10.2.0/db_1//lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/stubs/ /t0/orat0/app/oracle/product/10.2.0/db_1/srvm/lib/sprotch.o /t0/orat0/app/oracle/product/10.2.0/db_1/srvm/lib/protchek.o /t0/orat0/app/oracle/product/10.2.0/db_1/srvm/lib/prot.o -locr10 -locrb10 -locrutl10 -lhasgen10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclntsh -lskgxn2 -lcore10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/sysliblist` -lclntsh `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/sysliblist` -Wl,-rpath,/t0/orat0/app/oracle/product/10.2.0/db_1/lib -lm `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/sysliblist` -lm -lm -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib mv -f /t0/orat0/app/oracle/product/10.2.0/db_1/bin/ocrcheck /t0/orat0/app/oracle/product/10.2.0/db_1/bin/ocrcheck0 mv ocrcheck /t0/orat0/app/oracle/product/10.2.0/db_1/bin/ocrcheck - Linking OIFCFG tool gcc -o oifcfg -L/t0/orat0/app/oracle/product/10.2.0/db_1//lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/ -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/stubs/ /t0/orat0/app/oracle/product/10.2.0/db_1/srvm/lib/prifcg.o /t0/orat0/app/oracle/product/10.2.0/db_1/srvm/lib/sprifcg.o /t0/orat0/app/oracle/product/10.2.0/db_1/srvm/lib/prifutl.o /t0/orat0/app/oracle/product/10.2.0/db_1/srvm/lib/prifcmn.o -lcore10 -lhasgen10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -locr10 -locrb10 -locrutl10 -lhasgen10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10 -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 -lclntsh -lskgxn2 -lcore10 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/sysliblist` -lclntsh -lclntsh -lskgxn2 `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/sysliblist` -lm `cat /t0/orat0/app/oracle/product/10.2.0/db_1/lib/sysliblist` -lm -lm -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib mv -f /t0/orat0/app/oracle/product/10.2.0/db_1/bin/oifcfg /t0/orat0/app/oracle/product/10.2.0/db_1/bin/oifcfg0 mv oifcfg /t0/orat0/app/oracle/product/10.2.0/db_1/bin/oifcfg chmod 755 /t0/orat0/app/oracle/product/10.2.0/db_1/bin make -f /t0/orat0/app/oracle/product/10.2.0/db_1/sysman/lib/ins_emdb.mk relink_exe EXENAME=nmccollector make[1]: Entering directory `/t0/orat0/app/oracle/product/10.2.0/db_1/sysman/lib' /usr/bin/gcc -trigraphs -fPIC -o /t0/orat0/app/oracle/product/10.2.0/db_1/sysman/lib/nmccollector -L/t0/orat0/app/oracle/product/10.2.0/db_1/sysman//lib -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib -L/t0/orat0/app/oracle/product/10.2.0/db_1/lib/stubs -Wl,-export-dynamic /t0/orat0/app/oracle/product/10.2.0/db_1/sysman//lib/snmccolm.o /t0/orat0/app/oracle/product/10.2.0/db_1/sysman//lib/libnmccol.a /t0/orat0/app/oracle/product/10.2.0/db_1/sysman//lib/libnmcbuf.a /t0/orat0/app/oracle/product/10.2.0/db_1/sysman//lib/libnmadbg.a /t0/orat0/app/oracle/product/10.2.0/db_1/rdbms//lib/libdsga10.a /t0/orat0/app/oracle/product/10.2.0/db_1/lib/libserver10.a /t0/orat0/app/oracle/product/10.2.0/db_1/lib/libclntsh.so mv -f /t0/orat0/app/oracle/product/10.2.0/db_1/bin/nmccollector /t0/orat0/app/oracle/product/10.2.0/db_1/bin/nmccollector0 mv /t0/orat0/app/oracle/product/10.2.0/db_1/sysman/lib/nmccollector /t0/orat0/app/oracle/product/10.2.0/db_1/bin/ make[1]: Leaving directory `/t0/orat0/app/oracle/product/10.2.0/db_1/sysman/lib' Enterprise Manager Direct Memory Access Collector relinked |
重新链接后问题解决:
[tingkun.yang@hpserver2 ~]$ sqlplus / AS sysdba SQL*Plus: Release 10.2.0.5.0 - Production ON Mon Mar 19 18:25:09 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> |