需要远程连接的oracle服务器的版本是:
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
Linux 系统:CentOS 5.5
PLSQL版本为:PL/SQL Developer Version 8.0.1.1502
注册信息如下
product code:kfqtle46lqzbbvlzuvsrutst66yn6m7kl8s2trrtsapr
password:xs374ca
serial number:1775341736
Oracle客户端需要的软件均可以从官方网站下载:
instantclient-basic-win32-11.2.0.1.0.zip
instantclient-jdbc-win32-11.2.0.1.0.zip
instantclient-sqlplus-win32-11.2.0.1.0.zip
将这三个文件直接解压即可,完成以后是所有文件都在一个文件夹下面,我这里解压之后的文件夹名称是:oracleinstantclient_11_2
第一步:将此文件夹放在d盘,其他盘也可以,现在路径是:D:\oracleinstantclient_11_2
第二步:配置环境变量,在系统环境变量里面加入:
Path D:\oracleinstantclient_11_2
TNS_ADMIN D:\oracleinstantclient_11_2
NLS_LANG AMERICAN_AMERICA.UTF8
第三步:创建配置文件:tnsnames.ora
内部内容如下:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =(PROTOCOL = TCP)(HOST = 159.226.2.207)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
其中orcl为服务器监听的服务名称,可使用命令查询:
[zhang@zhangshibo ~]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-OCT-2012 19:50:35
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=159.226.2.207)(PORT=1521
)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-OCT-2012 14:41:43
Uptime 0 days 5 hr. 8 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/zhang/app/zhang/product/11.2.0/dbhome_1/network/admi
n/listener.ora
Listener Log File /home/zhang/app/zhang/diag/tnslsnr/wn7-lcg/listener/alert/
log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=159.226.2.207)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[zhang@zhangshibo ~]$
服务器端监听文件只和listener.ora有关,只需配置好此文件即可,内容为:
# listener.ora Network Configuration File: /home/zhang/app/zhang/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 159.226.2.207)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /home/zhang/app/zhang/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
ADR_BASE_LISTENER = /home/zhang/app/zhang
第四步:配置PL/SQL,如下:
Tools-》Preferences-》Oracle下面的Connection变量设置为:
Oracle Home D:\oracleinstantclient_11_2
OCI library D:\oracleinstantclient_11_2\oci.dll
第五步:打开PL/SQL,登录即可!
需要注意的地方:服务器版本和客户端版本要一致!配置完环境变量以后,重启机器!