Installing the Oracle client in Linux to connect to a remote oracle host to complete data operations is a problem I will solve this time. Search for the Linux oracle keyword on google and find some articles, but it seems that the installation of oracle cient is a bit complicated. In addition, the main function is to connect to remote oracle to query data.
Some articles have mentioned that using instant client to implement functions is feasible based on the original experience, but an error occurs when using sqlplus/nolog in actual operations.
The following is a record of my installation process:
Program:
Wget http://download.oracle.com/otn/linux/instantclient/112020/oracle-instantclient11.2-basic-11.2.0.2.0.i386.rpm
Wget http://download.oracle.com/otn/linux/instantclient/112020/oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm
Only the two packages can be downloaded.
Note: To download these two packages, you can go to www.oracle.com to download them. However, you must have an account registered on the oracle website.
Step 1: view the content in the package:
Rpm-qpl oracle-instantclient11.2-basic-11.2.0.2.0.i386.rpm
/Usr/lib/oracle/11.2/client/bin/adrci
/Usr/lib/oracle/11.2/client/bin/genezi
/Usr/lib/oracle/11.2/client/lib/libclntsh. so.11.1
/Usr/lib/oracle/11.2/client/lib/libnnz11.so
/Usr/lib/oracle/11.2/client/lib/libocci. so.11.1
/Usr/lib/oracle/11.2/client/lib/libociei. so
/Usr/lib/oracle/11.2/client/lib/libocijdbc11.so
/Usr/lib/oracle/11.2/client/lib/ojdbc5.jar
/Usr/lib/oracle/11.2/client/lib/ojdbc6.jar
/Usr/lib/oracle/11.2/client/lib/xstreams. jar
Rpm-qpl oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm
/Usr/lib/oracle/11.2/client/bin/sqlplus
/Usr/lib/oracle/11.2/client/lib/glogin. SQL
/Usr/lib/oracle/11.2/client/lib/libsqlplus. so
/Usr/lib/oracle/11.2/client/lib/libsqlplusic. so
The time shown above is mainly in two directories:
/Usr/lib/oracle/11.2/client
/Usr/lib/oracle/11.2/client/lib/
Step 2: Install and modify configurations
Rpm-ivh oracle-instantclient11.2-basic-11.2.0.2.0.i386.rpm
Rpm-ivh oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm
Add the following environment variables to. bashrc (there is a hidden variable in the $ HOME folder of the logged-on user)
LD_LIBRARY_PATH =/usr/local/lib:/usr/lib/oracle/11.2/client64/lib
Error reported when SQL plus/nolog is enabled
Sqlplus: error while loading shared libraries: */libnnz *. so: cannot restore segment prot after reloc: Permission denied
At that time, I forgot to make an error and noted down the information provided above.
Step 3: modify the system configuration (root user is required)
# Vi/etc/ld. so. conf
/Usr/lib/oracle/11.2/client/lib/
#/Sbin/ldconfig
Run sqlplus/nolog
SQL * Plus: Release 11.2-Production on Wed May 10 17:44:34 2011
Copyright (c) 1982,201 0, Oracle. All rights reserved.
SQL & gt;
This error is reported and started successfully,
Step 4: Configure TNS to connect to a remote oracle database
To connect to a remote oracle database, you must create TNS.
Mkdir-p/usr/lib/oracle/11.2/network/admin/
Cd/usr/lib/oracle/11.2/network/admin/
Touch tnsnames. ora
Edit tnsnames. ora to add your own string
Example:
Orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.99) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
)
)
Note: You must modify the environment variable:
Add in. bashrc
Export ORACLE_HOME =/usr/lib/oracle/11.2
Export TNS_ADMIN =/usr/lib/oracle/11.2/network/admin
Use the source. bashrc command to restart the configuration.
Unregister the user.
Sqlplus username/userpass @ orcl
You can connect to the remote database,
I would like to thank the netizens who posted related articles on the Internet. I have sorted out my installation process here. Most of them have borrowed your experience and I would like to thank you here.