(一)不安装客户端的解决办法。
第一种方法:
1、在安装ORACLE服务器的机器上搜索下列文件,
oci.dll
ocijdbc10.dll
ociw32.dll
orannzsbb10.dll
oraocci10.dll
oraociei10.dll (可能服务器没有,如果没有则pl sql 随便@R_301_473@密码可以登陆)
sqlnet.ora
tnsnames.ora
classes12.jar
ojdbc14.jar
放到一个文件夹,如 oraclient
2、配置tnsnames.ora,如果本机上没有安装oracle,可以从安装了oracle的机上拷贝一个(tnsnames.ora文件在%ORACLE_HOME%\network\admin下)放在上面的目录D:\oraclient下。
oracledata =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.58)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oracledata)
)
)
3、添加一个环境变量,名为TNS_ADMIN,值为tnsnames.ora文件所在路径(如:D:\oraclient,特别是重装后或其它操作,忘了TNS_ADMIN变量,plsql登陆就会报无法解析指定的连接标识符),这是为了能够找到上面说的tnsnames.ora。如果本机上安装了ORACLE,并且设置了ORACLE_HOME环境变量,那么会自动在%ORACLE_HOME%/network/admin/位置查找tnsnames.ora文件。
4、设置ORACLE的语言,添加环境变量:
“NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK”,(AMERICAN_AMERICA.US7ASCII 是ASCII编码类型,其它类型可自己到服务器看一下或网上查找一下)
(本步骤暂时要做对,如果编码不对,会产生乱码)
5、下载并安装PL.sql.Developer配置应用
配置tools->preferences->connection
Oracle Home=D:\oracleclient
OCI library=D:\oracleclient\oci.dll
6、再次打开plsql则会在database中有oracledata 选项输入@R_301_473@密码就可以登陆。
第二种方法:
1。首先去oracle的官方下载客户端的压缩包,地址是:http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html,选择机器的操作系统后选择oracle对应的版本的base那个压缩包下载。
2。将下载后的压缩包解压到相应的目录,比如 D:\worksoftware\instantclient_10_2下;
3。在这个目录下建立NETWORD目录,再在NETWORK目录下建立ADMIN目录,如D:\worksoftware\instantclient_10_2\NETWORK\ADMIN;
4。在第二步所建立的目录下新建一个tnsnames.ora文件,当然也可以从服务器上copy这个文件,文件的内容如下
databasename =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip address)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = database name)
)
)
databasename =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip address)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = database name)
)
)
例如我的就是
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.113)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.113)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
5。打开PL sql DEVELOPER 工具,点击tools-》preferences在右侧的oracle home里填上客户端的home,如D:\worksoftware\instantclient_10_2;在OCI Library里填上oci.dll路径,如D:\worksoftware\instantclient_10_2\oci.dll;
6。配置环境变量nls_lang 变量值是:SIMPLIFIED CHINESE_CHINA.ZHS16GBK这个东西主要是解决中文问题的。
7。ok配置完毕,应该是可以的啦,最好在启动之前先ping下远程的服务器,通了就应该可以连接上了
我的配置,其中BOC_TEST_91等为连接字符串
BOC_TEST_91 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.29.91)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = bot)
)
)
BOC_TEST_68 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.19.68)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = bot)
)
)
BOC_PRO_56 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.11.56)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = bop)
)
)
(二)安装客户端的解决办法
一、配置oracle服务器的监听器listener
修改<安装目录>/network/admin/目录下的listener.ora和tnsnames.ora两个文件。其中
listener文件大致如下:
# listener.ora Network Configuration File: /oracle/app/product/10.1.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/product/10.1.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = demo1) #demo1为oracle实例名
(ORACLE_HOME = /oracle/app/product/10.1.0/db_1)
(SID_NAME = demo1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521)) #IP地址为oracle服务器
)
)
tnsnames.ora文件大致修改如下:
# tnsnames.ora Network Configuration File: /oracle/app/product/10.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
DEMO1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521)) #IP地址为oracle服务器
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DEMO1) #demo1为oracle实例名,或者服务名称此名称可通过netmgr或netca修改
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
以上修改也可通过图形界面的netmgr和netca进行配置。修改之后,重启监听器
二、下载安装oracle客户端。
在安装pl/sql developer的本地机器上必须安装oracle客户端(此处指针对oracle 10g版本,有说也可只安装相关驱动如oci驱动,具体不详。并且客户端不一定为10g版本,8i,9i皆可)。
1.从官网上下载绿色版本的客户端,地址如下(或有改变):
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html下载需要oracle用户,可免费注册2.绿色版无需安装,将此下载解压至某处,并在其下建立一network目录,目录下再建admin目录,结构如下<客户端目录>/network/admin,在admin目录中建立tnsnames.ora文件,内容大致如下:demo1 = #oracle服务名 (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521)) #oracle服务器地址与端口 ) (CONNECT_DATA = (SERVICE_NAME = demo1) ) )三、在PL/sql developer中配置客户端信息。打开PL/sql developer,暂不登录,选择菜单tools->preferences->connection,设置如下两项:Oracle Home: D:\Program Files\instantclient_11_1 #客户端解压目录OCI library: D:\Program Files\instantclient_11_1\oci.dll #oci库文件路径,oci.dll应该在客户端目录下。 保存,重启PL/sql developer,些时应可看到登录框中Database下拉选项里有你刚刚配置的远程服务器上的服务实例demo1了。