从Oracle官方网站下载Oracle客户端instance client:
http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/index.html
这里选择instantclient-basic-win32-11.1.0.6.0.zip,instantclient-sqlplus-win32-11.1.0.6.0.zip
需要注册为Oracle网站用户才能下载。将下载的zip文件解压,并将所有文件及目录复制到f:/oracle/instanclient目录下,
将Oracle服务器安装目录下product/10.2.0/db_1/network/admin/tnsnames.ora文件复制到f:/instancelient根目录下。
编辑该文件:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = OraServer)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
将HOST修改为Oracle远程服务器名称或IP地址。
在命令行测试:
sqlplus system/oracle@orcl
使用PL/SQL Developer远程登录Oracle时,必须要它找到instant client,进入软件,选择Tools->Preferences,在Oracle Home和OCI Library两栏中分别填入Oracle客户端的路径和OCI文件的路径:f:/instantclient和f:/instantclient/oci.dll。然后再次新登录就可以了。
如果客户机也安装了Oracle,则会设置环境变量:ORACLE_HOME,PL/SQL Developer优先使用该变量做为Oracle客户端库目录,即使在PL/SQL Developer中设置了f:/instantclient及f:/instantclient/oci.dll也不会起作用。如果要使PL/SQL Developer能够同时访问本机Oracle和远程Oracle,则需要配置本机Oracle的tnsnames.ora,本人的Oracle根目录为f:/oracle,则该文件位于:
F:/oracle/product/10.2.0/db_1/NETWORK/ADMIN/tnsnames.ora,在该文件中添加RemoteORCL ,内容如下:
# tnsnames.ora Network Configuration File: F:/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = JOSHUA)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
RemoteORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Ryan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
Ryan为远程Oracle服务器名称。
使用PL/SQL Developer登录时,用户名/密码:sys/orcl,数据库:RemoteORCL。如果用户名使用system则不能登录,这与sqlplus恰好相反,不知原因为何?
若客户端对中文支持不好,可设置环境变量:
ORACLE_HOME=f:/instantclient
TNS_ADMIN=f:/instantclient
NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
Path=f:/instantclient