1.首先需要配置oracle的环境变量,如下图,路径就是oracle客户端的安装位置
2.之后需要配置2个文件,分别是tnsnames.org和listener.org,位置在E:appAdministratorproduct11.2.0dbhome_1NETWORKADMIN(oracle客户端的安装路径)
tnsnames.org的配置如下
orcl = //orcl是连接的数据库名
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.253.6)(PORT = 1521)) //这里配置IP和端口
)
(CONNECT_DATA =
(SERVICE_NAME = orcl) //这里也是数据库名
)
)
listener.org的配置如下
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:appAdministratorproduct11.2.0dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = E:appAdministratorproduct11.2.0dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.253.6)(PORT = 1521))
)
)