Table of Contents
问题原因
解决方案
Home Database Mysql Tutorial 不安装Oracle客户端使用PLSQL连接Oracle数据库的方法

不安装Oracle客户端使用PLSQL连接Oracle数据库的方法

Jun 07, 2016 pm 03:37 PM
oracle plsql use Install client database connect

http://wenku.baidu.com/link?url=0i6xJL1ZV7uAbyS4gc_RMqjma1MyytEsSESRqRZVe08c9tbsE7wqmrdGc-I0Goc9K4mAZ89RoFKN7Ey0VbvzJHtOQPVi3E02rSJFe2OWTpS 1.下载Oracle Client Package . 从 http://www.oracle.com/technology/software/tech/oci/instantclient/h

http://wenku.baidu.com/link?url=0i6xJL1ZV7uAbyS4gc_RMqjma1MyytEsSESRqRZVe08c9tbsE7wqmrdGc-I0Goc9K4mAZ89RoFKN7Ey0VbvzJHtOQPVi3E02rSJFe2OWTpS

1.下载Oracle Client Package .

从 http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html下载

Instant Client Package – Basic 包 ( 标注 :All files required to run OCI, OCCI, and JDBC-OCIapplications) 这里下载的是 Version 11.1.0.7

2.本地保存Oracle Client Package:

创建文件夹 , 比如 oracle_client, 将下载的文件加压缩到此文件夹里 .( 笔者目录 :D:\oracle_client\instantclient_10_2)

3. 在当前目录下 ,新建立两个文件,sqlnet.ora和tnsnames.ora然后再 手动配置 sqlnet.ora 和 tnsnames.ora

比如这里是 :

sqlnet.ora 文件内容 :

SQLNET.AUTHENTICATION_SERVICES=(NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)

 

tnsnames.ora 文件内容 ( 斜体表示需要替换的内容 ):

orcl =

(DESCRIPTION =

    (ADDRESS_LIST=

     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.103 )(PORT = 1521))

    )

    (CONNECT_DATA=

     (SERVICE_NAME = orcl )

    )

)

 

4. 配置环境变量

变量名 : TNS_ADMIN

变量值 : D:\oracle_client\instantclient_10_2

否则出现 :ORA-12154: TNS:could notresolve the connect identifier specified错误

 

 

如果之前 安装了 Oracle 又卸载 , 会遗留 NLS_LANG=NA 的键值 . 输入 RegEdit 打开注册表HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE. 在右面找到 NLS_LANG=NA 并删除掉

否则会报 ORA-12705: Cannot access NLS datafiles or invalid 错误 .

 

5. 安装 pl/sql软件(过程略)

6.配置pl/sql的Oracle连接参数:

选择 pl/sql 的工具 / 首选项 (too/ preference/ ) 里的连接 , 在右面设置 Oracle 主目录名 ( 即安装目录 ) 和 OCI 库 .

Oracle 主目录名 :D:\oracle_client\instantclient_10_2

OCI 库 :D:\oracle_client\instantclient_10_2\oci.dll

7. 登陆 pl/sql 测试成功


我遇到的问题是:

应该在64位系统上下载32位进行安装。

http://blog.csdn.net/hemingwang0902/article/details/7027543

今天在 x64 的 Win7 上重新安装了 Oralce 后,通过 PL/SQL 连接数据库时,提示如下错误信息

环境

windows7 64bit

Oracle win64 11gR2

PL/SQL v9.0

详细错误信息

[plain] view plaincopy

  1. Initialization error  
  2. Could not initialize "C:\oracle\product\11.2.0\dbhome_1\bin\oci.dll"  
  3. Make sure you have the 32 bits Oracle Client installed.  
  4.   
  5. OCIDLL forced to C:\oracle\product\11.2.0\dbhome_1\bin\oci.dll  
  6. LoadLibrary(C:\oracle\product\11.2.0\dbhome_1\bin\oci.dll) returned 0  

问题原因

安装完后Oracle的 oci.dll 是64位的,而32位应用程序 PLSQL Developer 无法加载。

解决方案

1. 从 http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html 下载Oracle Client Package。 我下载的是Instant Client for Microsoft Windows (32-bit) 【instantclient-basic-nt-11.2.0.2.0.zip】 

2. 将 instantclient-basic-nt-11.2.0.2.0.zip 解压至 c:\oracle, oci.dll 所在目录为:c:\oracle\instantclient_11_2\

3. 设置环境变量

    TNS_ADMIN=c:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN

    NLS_LANG=AMERICAN_AMERICA.ZHS16GBK (注:NLS_LANG前半部分必须是AMERICAN_AMERICA,因为instant client不支持其他语言;而后半部分可以根据你数据库的字符集调整,如果数据库采用AL32UTF8,则可以设置AL32UTF8)

4. 启动PL/SQL Developer ,点击“取消”不要登录,菜单 --> Tools --> Perferences --> Connection 修改 Oracle_Home 和 OCI Library 的配置:
    OracleHome: OraDb11g_home1
    OCI library: C:\oracle\instantclient_11_2\oci.dll


5. 重新启动 PL/SQL并登录对应的数据库,连接正常,问题成功解决!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How long will Oracle database logs be kept? How long will Oracle database logs be kept? May 10, 2024 am 03:27 AM

How long will Oracle database logs be kept?

Oracle database server hardware configuration requirements Oracle database server hardware configuration requirements May 10, 2024 am 04:00 AM

Oracle database server hardware configuration requirements

How much memory does oracle require? How much memory does oracle require? May 10, 2024 am 04:12 AM

How much memory does oracle require?

How much memory is needed to use oracle database How much memory is needed to use oracle database May 10, 2024 am 03:42 AM

How much memory is needed to use oracle database

Oracle scheduled tasks execute the creation step once a day Oracle scheduled tasks execute the creation step once a day May 10, 2024 am 03:03 AM

Oracle scheduled tasks execute the creation step once a day

How much memory does an oracle database require? How much memory does an oracle database require? May 10, 2024 am 02:09 AM

How much memory does an oracle database require?

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

Detailed tutorial on establishing a database connection using MySQLi in PHP

How to start the listening program in oracle How to start the listening program in oracle May 10, 2024 am 03:12 AM

How to start the listening program in oracle

See all articles