要连接远程数据库,传统的一定可行的方法是在本地装一个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) ) )
zyback= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.88)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = zyback) ) )
5、配置PLSQL Developer客户端,如图:
关闭重启PLSQL Developer,输入用户、密码、数据库,如图:
这样就可以远程访问其他地方的oracle数据库了
原文地址:http://blog.csdn.net/u011109042/article/details/38013391