Instalar Cliente Oracle en un Servidor Linux
Cómo instalar el cliente Oracle en un servidor Linux. Aquí paso a paso:
Debemos descargar los archivos: oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm oracle-instantclient-devel-10.2.0.5-1.x86_64.rpm oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm
de la página de Oracle: https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
Una vez los tengamos descargados, procedemos a la instalación:
[root@Server ~]# yum localinstall oracle-instantclient* --nogpgcheck Loaded plugins: fastestmirror, langpacks Examining oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm: oracle-instantclient-basic-10.2.0.5-1.x86_64 Marking oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm to be installed Examining oracle-instantclient-devel-10.2.0.5-1.x86_64.rpm: oracle-instantclient-devel-10.2.0.5-1.x86_64 Marking oracle-instantclient-devel-10.2.0.5-1.x86_64.rpm to be installed Examining oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm: oracle-instantclient-sqlplus-10.2.0.5-1.x86_64 Marking oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package oracle-instantclient-basic.x86_64 0:10.2.0.5-1 will be installed ---> Package oracle-instantclient-devel.x86_64 0:10.2.0.5-1 will be installed ---> Package oracle-instantclient-sqlplus.x86_64 0:10.2.0.5-1 will be installed --> Finished Dependency Resolution base/7/x86_64 | 3.6 kB 00:00:00 epel/x86_64/metalink | 4.0 kB 00:00:00 epel/x86_64 | 3.2 kB 00:00:00 epel/x86_64/updateinfo | 930 kB 00:00:00 epel/x86_64/primary | 3.6 MB 00:00:02 extras/7/x86_64 | 3.4 kB 00:00:00 extras/7/x86_64/primary_db | 205 kB 00:00:00 pgdg11/7/x86_64 | 4.1 kB 00:00:00 pgdg11/7/x86_64/primary_db | 127 kB 00:00:00 updates/7/x86_64 | 3.4 kB 00:00:00 Dependencies Resolved =================================================================================================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================================================================================================== Installing: oracle-instantclient-basic x86_64 10.2.0.5-1 /oracle-instantclient-basic-10.2.0.5-1.x86_64 104 M oracle-instantclient-devel x86_64 10.2.0.5-1 /oracle-instantclient-devel-10.2.0.5-1.x86_64 1.4 M oracle-instantclient-sqlplus x86_64 10.2.0.5-1 /oracle-instantclient-sqlplus-10.2.0.5-1.x86_64 2.7 M Transaction Summary =================================================================================================================================================================================================================== Install 3 Packages Total size: 108 M Installed size: 108 M Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : oracle-instantclient-basic-10.2.0.5-1.x86_64 1/3 Installing : oracle-instantclient-sqlplus-10.2.0.5-1.x86_64 2/3 Installing : oracle-instantclient-devel-10.2.0.5-1.x86_64 3/3 Verifying : oracle-instantclient-sqlplus-10.2.0.5-1.x86_64 1/3 Verifying : oracle-instantclient-devel-10.2.0.5-1.x86_64 2/3 Verifying : oracle-instantclient-basic-10.2.0.5-1.x86_64 3/3 Installed: oracle-instantclient-basic.x86_64 0:10.2.0.5-1 oracle-instantclient-devel.x86_64 0:10.2.0.5-1 oracle-instantclient-sqlplus.x86_64 0:10.2.0.5-1 Complete!
Ahora necesitamos configurar los TNSNames.ora, para esto creamos los directorios network/admin
[root@Server ~]# mkdir /usr/lib/oracle/10.2.0.5/client64/network/admin -p
Aquí dentro configuramos nuestro TNSNames.ora.
Una vez hayamos terminado, procedemos a crear las variables de entorno. Esto lo debemos hacer en el final del .bash_profile del usuario con que se va a utilizar sqlplus.
export ORACLE_HOME=/usr/lib/oracle/10.2.0.5/client64 export PATH=$PATH:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib export TNS_ADMIN=$ORACLE_HOME/network/admin
Nos loggeamos con ese usuario y probamos la conexión con lo siguiente:
$ sqlplus <usuario>@sid_del_TNS_Names.ora
Con esto deberían poder loggearse perfectamente y tener todo funcionando. Si desean cambiar algún parámetro de conexión, deberán también settear el NLS_LANG en el entorno que se utilizará sqlplus.