标签:mes connected 实例名 测试 定义 path glob add 变量
rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
#默认安装在/usr/lib/oracle/这个路径下。
(注:下载前需要注册账号,免费的,可以放心注册)
vim ~/.bash_profile
#oracle客户端连接工具
PATH=$PATH:$HOME/bin
export ORACLE_HOME=/usr/lib/oracle/11.2/client64/
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_BASE=/usr/lib/oracle/11.2/
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH
退出并保存
source ~/.bash_profile
cd /usr/lib/oracle/11.2/client64/ 或 #cd $ORACLE_HOME
mkdir -p /network/admin(创建这两个目录)
vim /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora
1 orcl =
2 (DESCRIPTION =
3 (ADDRESS_LIST =
4 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.198.182)(PORT = 1521))
5 )
6 (CONNECT_DATA =
7 (SERVER = DEDICATED)
8 (SERVICE_NAME = orcl)
9 )
10 )
注:
1:自己定义的连接描述符名。
4:HOST要远程连接的数据库的IP,PORT端口默认1521。
8:数据库的实例名。
(注:查看实例名# ps -ef |grep pmon
oracle 3894 1 0 08:30 ? 00:00:00 ora_pmon_orcl
root 5154 4546 0 09:56 pts/1 00:00:00 grep pmon
orcl就是实例名)
cd /opt/oracle/product/11.2.0/dbhome_1/network/admin/
vim listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /opt/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.198.182)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/oracle
cd /opt/oracle/product/11.2.0/dbhome_1/network/admin/
vim tnsnames.ora
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.198.182)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.198.182)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
sqlplus zabbix/123456@orcl
SQL*Plus: Release 11.2.0.3.0 Production on Tue Dec 27 11:05:09 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
连接成功!!
标签:mes connected 实例名 测试 定义 path glob add 变量
原文地址:https://www.cnblogs.com/A121/p/10559376.html