1、安装解压缩到/data/oracleClient
mkdir /data/oracleClient 创建解压目录
unzip /data/oracleClient/instantclient-basic-linux.x64-11.2.0.4.0.zip
unzip /data/oracleClient/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip
2、创建tnsnames.ora监听文件
mkdir -p network/admin
cd network/admin
vim tnsnames.ora 新建tnsnames.ora文件
A_IPS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.192.78)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = A_IPS)
)
)
3、添加环境变量
家目录 cd ~ vi .bash_profile
export ORACLE_HOME=/software/instandclient_11_2 export ORACLE_SID=orcl export TNS_ADMIN=$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH #export NLS_LANG='simplified chinese_china'.ZHS16GBK export NLS_LANG='simplified chinese_china'.AL32UTF8 export PATH=$ORACLE_HOME:$PATH
4、使环境变量生效
source .bash_profile
5、测试连接Oracle数据库
方式一: sqlplus usernaem/password@主机字符串 example : sqlplus username/passwd@cm
方式二:sqlplus username/password@远端ip:端口号/服务名