libnjni11.so: libclntsh.so.11.1: cannot open shared object file: No such file or directory (Oracle 11.2.0.4 em Linux 7)

Problema

Após clonar um DB Home 11.2.0.4 para um outro servidor com Oracle Linux 7, tentativa de executar utilitários do Oracle falham com erro de libnjni11.so:

$ netca
UnsatisfiedLinkError exception loading native library: njni11
java.lang.UnsatisfiedLinkError: /u01/app/oracle/product/11.2.0.4/db_1/lib/libnjni11.so: libclntsh.so.11.1: cannot open shared object file: No such file or directory
java.lang.UnsatisfiedLinkError: jniGetOracleHome
        at oracle.net.common.NetGetEnv.jniGetOracleHome(Native Method)
        at oracle.net.common.NetGetEnv.getOracleHome(Unknown Source)
        at oracle.net.ca.NetCALogger.getOracleHome(NetCALogger.java:230)
        at oracle.net.ca.NetCALogger.initOracleParameters(NetCALogger.java:215)
        at oracle.net.ca.NetCALogger.initLogger(NetCALogger.java:130)
        at oracle.net.ca.NetCA.main(NetCA.java:427)

Error: jniGetOracleHome
Oracle Net Services configuration failed.  The exit code is 1

Solução

1) Instale os pacotes de pre-install do Oracle 11.2.0.4 no Linux:

[root@lab01 ~]# yum install oracle-rdbms-server-11gR2-preinstall
Loaded plugins: ulninfo
epel/x86_64/metalink                                                                                                                                |  53 kB  00:00:00
epel                                                                                                                                                | 4.7 kB  00:00:00
ol7_UEKR6                                                                                                                                           | 3.0 kB  00:00:00
ol7_latest                                                                                                                                          | 3.6 kB  00:00:00
(1/6): ol7_UEKR6/x86_64/updateinfo                                                                                                                  | 329 kB  00:00:01
(2/6): epel/x86_64/primary_db                                                                                                                       | 7.0 MB  00:00:01
(3/6): ol7_latest/x86_64/updateinfo                                                                                                                 | 3.3 MB  00:00:01
(4/6): epel/x86_64/updateinfo                                                                                                                       | 1.0 MB  00:00:03
(5/6): ol7_UEKR6/x86_64/primary_db                                                                                                                  |  23 MB  00:00:03
(6/6): ol7_latest/x86_64/primary_db                                                                                                                 |  36 MB  00:00:04
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-6.el7 will be installed
--> Processing Dependency: compat-libstdc++-33 for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el7.x86_64
--> Processing Dependency: gcc for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el7.x86_64
--> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-11gR2-preinstall-1.0-6.el7.x86_64
--> Running transaction check
---> Package compat-libstdc++-33.x86_64 0:3.2.3-72.el7 will be installed
---> Package gcc.x86_64 0:4.8.5-44.0.3.el7 will be installed
--> Processing Dependency: cpp = 4.8.5-44.0.3.el7 for package: gcc-4.8.5-44.0.3.el7.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-44.0.3.el7.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-44.0.3.el7.x86_64
---> Package gcc-c++.x86_64 0:4.8.5-44.0.3.el7 will be installed
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-44.0.3.el7 will be installed
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================
 Package                                                     Arch                          Version                                 Repository                         Size
===========================================================================================================================================================================
Installing:
 oracle-rdbms-server-11gR2-preinstall                        x86_64                        1.0-6.el7                               ol7_latest                         22 k
Installing for dependencies:
 compat-libstdc++-33                                         x86_64                        3.2.3-72.el7                            ol7_latest                        190 k
 cpp                                                         x86_64                        4.8.5-44.0.3.el7                        ol7_latest                        5.9 M
 gcc                                                         x86_64                        4.8.5-44.0.3.el7                        ol7_latest                         16 M
 gcc-c++                                                     x86_64                        4.8.5-44.0.3.el7                        ol7_latest                        7.2 M
 libmpc                                                      x86_64                        1.0.1-3.el7                             ol7_latest                         49 k
 mpfr                                                        x86_64                        3.1.1-4.el7                             ol7_latest                        198 k

Transaction Summary
===========================================================================================================================================================================
Install  1 Package (+6 Dependent packages)

Total download size: 30 M
Installed size: 70 M
Is this ok [y/d/N]: y
Downloading packages:
(1/7): compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm                                                                                                  | 190 kB  00:00:01
(2/7): cpp-4.8.5-44.0.3.el7.x86_64.rpm                                                                                                              | 5.9 MB  00:00:02
(3/7): gcc-c++-4.8.5-44.0.3.el7.x86_64.rpm                                                                                                          | 7.2 MB  00:00:01
(4/7): libmpc-1.0.1-3.el7.x86_64.rpm                                                                                                                |  49 kB  00:00:00
(5/7): mpfr-3.1.1-4.el7.x86_64.rpm                                                                                                                  | 198 kB  00:00:00
(6/7): gcc-4.8.5-44.0.3.el7.x86_64.rpm                                                                                                              |  16 MB  00:00:03
(7/7): oracle-rdbms-server-11gR2-preinstall-1.0-6.el7.x86_64.rpm                                                                                    |  22 kB  00:00:03
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                      4.1 MB/s |  30 MB  00:00:07
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mpfr-3.1.1-4.el7.x86_64                                                                                                                                 1/7
  Installing : libmpc-1.0.1-3.el7.x86_64                                                                                                                               2/7
  Installing : cpp-4.8.5-44.0.3.el7.x86_64                                                                                                                             3/7
  Installing : gcc-4.8.5-44.0.3.el7.x86_64                                                                                                                             4/7
  Installing : gcc-c++-4.8.5-44.0.3.el7.x86_64                                                                                                                         5/7
  Installing : compat-libstdc++-33-3.2.3-72.el7.x86_64                                                                                                                 6/7
  Installing : oracle-rdbms-server-11gR2-preinstall-1.0-6.el7.x86_64                                                                                                   7/7
  Verifying  : gcc-4.8.5-44.0.3.el7.x86_64                                                                                                                             1/7
  Verifying  : oracle-rdbms-server-11gR2-preinstall-1.0-6.el7.x86_64                                                                                                   2/7
  Verifying  : mpfr-3.1.1-4.el7.x86_64                                                                                                                                 3/7
  Verifying  : compat-libstdc++-33-3.2.3-72.el7.x86_64                                                                                                                 4/7
  Verifying  : gcc-c++-4.8.5-44.0.3.el7.x86_64                                                                                                                         5/7
  Verifying  : libmpc-1.0.1-3.el7.x86_64                                                                                                                               6/7
  Verifying  : cpp-4.8.5-44.0.3.el7.x86_64                                                                                                                             7/7

Installed:
  oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-6.el7

Dependency Installed:
  compat-libstdc++-33.x86_64 0:3.2.3-72.el7  cpp.x86_64 0:4.8.5-44.0.3.el7  gcc.x86_64 0:4.8.5-44.0.3.el7  gcc-c++.x86_64 0:4.8.5-44.0.3.el7  libmpc.x86_64 0:1.0.1-3.el7
  mpfr.x86_64 0:3.1.1-4.el7

Complete!

2) Edite o arquivo $ORACLE_HOME/rdbms/lib/env_rdbms.mk fazendo a seguinte substituição:

Original:

ORION_LINKLINE=$(LINK) $(OPT) $(ORIONMAI) $(LLIBORION) \
         $(LLIBGENERIC) $(LLIBCORE) $(LLIBCLNTSH) \
         $(LLIBSAGE) $(LLIBSKGXP) \
         $(LLIBNLSRTL) $(PL_AIOLIB) $(LLIBCOMMON) $(SUIDLINKLDLIBS)

Alterado a última linha, substituindo SUIDLINKLDLIBS por LINKLDLIBS:

ORION_LINKLINE=$(LINK) $(OPT) $(ORIONMAI) $(LLIBORION) \
         $(LLIBGENERIC) $(LLIBCORE) $(LLIBCLNTSH) \
         $(LLIBSAGE) $(LLIBSKGXP) \
         $(LLIBNLSRTL) $(PL_AIOLIB) $(LLIBCOMMON) $(LINKLDLIBS)

3) Faça o relink individual do componente “orion”:

cd $ORACLE_HOME/rdbms/lib
[oracle@lab01 lib]$ make -f ins_rdbms.mk iorion

 - Linking ORacle IO Numbers benchmark (orion)
rm -f /u01/app/oracle/product/11.2.0.4/db_1/rdbms/lib/orion
gcc -o /u01/app/oracle/product/11.2.0.4/db_1/rdbms/lib/orion -m64 -z noexecstack -L/u01/app/oracle/product/11.2.0.4/db_1/rdbms/lib/ -L/u01/app/oracle/product/11.2.0.4/db_1/lib/ -L/u01/app/oracle/product/11.2.0.4/db_1/lib/stubs/   /u01/app/oracle/product/11.2.0.4/db_1/rdbms/lib/orion.o -lorion11 -lgeneric11 -lcore11 -lclntsh -lnfsodm11 -lcell11 -lskgxp11 -lnls11 -laio -lcommon11   `cat /u01/app/oracle/product/11.2.0.4/db_1/lib/sysliblist` -Wl,-rpath,/u01/app/oracle/product/11.2.0.4/db_1/lib -lm    `cat /u01/app/oracle/product/11.2.0.4/db_1/lib/sysliblist` -ldl -lm   -L/u01/app/oracle/product/11.2.0.4/db_1/lib
test ! -f /u01/app/oracle/product/11.2.0.4/db_1/bin/orion ||\
   mv -f /u01/app/oracle/product/11.2.0.4/db_1/bin/orion /u01/app/oracle/product/11.2.0.4/db_1/bin/orionO
mv /u01/app/oracle/product/11.2.0.4/db_1/rdbms/lib/orion /u01/app/oracle/product/11.2.0.4/db_1/bin/orion
chmod 751 /u01/app/oracle/product/11.2.0.4/db_1/bin/orion

4) Faça relink geral do Oracle Home:

[oracle@lab01 lib]$ relink all
writing relink log to: /u01/app/oracle/product/11.2.0.4/db_1/install/relink.log

Utilitários funcionaram sem erros:

Leave a Reply

Scroll to Top

Discover more from Blog do Dibiei

Subscribe now to keep reading and get access to the full archive.

Continue reading