0. Preface
Baidu above search information, are garbage information, and examples are mutual replication, there is no reference value, the most annoying is the need to install Oracle remote client, they are the idiots are mainly local, usually local if you have installed Oracle, will install the client, There's no need for a bunch of idiots to publish useless information and waste their time. This article refer to http://www.cnblogs.com/joeblackzqq/archive/2011/03/19/1988915.htmlhttp://wenku.baidu.com/view/ Bc8a311afad6195f312ba687.html
first, the matter1. Preparatory work
- To use Oracle remotely, download the following three files first, and note that the best version is the same.
Oracle-instantclient-basic-10.2.0.4-1.i386.zip oracle-instantclient-devel-10.2.0.4-1.i386.zip //This is the SDK , there is no description on the file name, it is hereby stated Oracle-instantclient-sqlplus-10.2.0.4-1.i386.zip
- Look at Oracle's SQL statements, but if you can't go up, you can only ask the administrator of the remote Oracle.
- Different versions, or different operating systems, please go to the official website to download, there are detailed instructions.
Http://www.oracle.com/technology/tech/oci/instantclient/index.html
2. Create the installation directory
- Create three client installation directories, these three directories can be customized, but when you configure environment variables, you need a consistent
Mkdir-p/opt/oracle/lib mkdir-p/opt/oracle/sdk mkdir-p/opt/oracle/network/admin
3. Deployment Environment
- Unzip the two files downloaded above
Unzip Oracle-instantclient-basic-10.2.0.4-1.i386.zip Unzip Oracle-instantclient-sqlplus-10.2.0.4-1.i386.zip where all two files are extracted to the same directory under the current directory: instantclient_10_2 CD instantclient_10_2 move all files in this directory to /opt/ Oracle/lib
- Decompression Oracle-instantclient-devel-10.2.0.4-1.i386.zip
4. Configure Environment Variables
Vi/etc/profile //Note that this is an environment variable for all users, and if you want to restrict a user, you can only configure the user's profile. Join Export oracle_home=/opt/oracle export Ld_library_path=/opt/oracle/lib Save and exit. [[email protected] tmp]# source/etc/profile //Make configuration file effective immediately [[email protected] tmp]# echo $ORACLE _home Check to see if the configured environment variable is successful /opt/oracle
5. Configure the network environment
- Because the Oracle database is not installed locally, you need to get a file from the directory where the Oracle database is installed (the original is to get three files, Is Listener.ora,sqlnet.ora,tnsnames.ora, the actual situation only needs a tnsnames.ora)
[Email protected] admin]# pwd
/opt/oracle/network/admin
[[email protected] admin]# ls
Tnsnames.ora//On this file, put it in this directory
6. Edit TNS File
VI Tnsnames.ora
analyse9_39 =
(DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.9.39) (PORT = 3173 )) (Connect_data = (service_name = analyse) ) )
7, completed, Test
cd/opt/oracl/lib [[email protected] lib]# Sqlplus sqlplus:error while loading shared libraries:libsqlplus.so:cannot op En shared object file:no such file or directory
If there is a problem above, it means that your environment variable is not set. Please refer to: 4th.
[Email protected] lib]# sqlplus System/[email protected]
Sql*plus:release 10.2.0.4.0-production on Sun 1 12:20:08 2010
Copyright (c) 1982, Oracle. All rights Reserved.
Connected to:oracle Database 10g Enterprise Edition Release 10.2.0.1.0-production with the partitioning, OLAP and Data Mining Options
Sql>
The connection database was successful and the test passed.
Ii. Preliminary discussion of OCI
After the deployment of the environment, in/opt/oracle/sdk/demo, there is the OCI demo program, the following to start the OCI trip, please see the next article ...
Install Oracle client separately under Linux