要连接远程数据库,传统的一定可行的方法是在本地装一个oracle,然后使用“Network Configuration Assistant”配置,之后用PL/SQL Dev连接,因为需要在本地安装数据库,所以不是很方便
下面介绍另外一种方法
1、首先去oracle官网下载三个需要的压缩包
具体地址是:http://www.oracle.com/technetwork/topics/winsoft-085727.html
需要的包:
instantclient-basic-nt-12.1.0.1.0.zip
instantclient-odbc-nt-12.1.0.1.0.zip
instantclient-sqlplus-nt-12.1.0.1.0.zip
下载PLSQL Developer
将下载的安装包全部解压,放在同一个目录下,比如在D:\oracle
2、“控制面板”-”系统”-”高级”-”环境变量”-”系统变量”添加几个环境变量:
NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK(或AMERICAN_AMERICA.ZHS16GBK)
TNS_ADMIN = D:\oracle
LD_LIBRARY_PATH = D:\oracle
SQLPATH = D:\oracle
Path变量结尾添加D:\oracle
3、在D:\oracle下创建tnsnames.ora文件,在该文件中平配置如下代码,自己写容易出错,建议到装了oracle数据库的目录下去拷贝,如果你的电脑上安装了oracle,那么该文件的目录在D:\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN下,这是我的目录
# tnsnames.ora Network Configuration File: D:\Oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora # Generated by Oracle configuration tools. LISTENER_ORCL = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ORACLR_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (CONNECT_DATA = (SID = CLRExtProc) (PRESENTATION = RO) ) )
ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
以上文件中,ORCL是个连接标示符,可以自己修改,HOST是远程Oracle服务器的地址,PORT是Oracle的服务端口,没有修改过的话,默认是1521。Service_name是远程实例名称。可以直接在上面修改,也可以新添加一段代码,如下:
zyback= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.88)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = zyback) ) )
4、运行D:\oracle目录下的odbc_install.exe,安装ODBC驱动
5、配置PLSQL Developer客户端,如图:
来源:oschina
链接:https://my.oschina.net/u/2897093/blog/786407