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 AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

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)

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

What to do if the oracle can't be opened What to do if the oracle can't be opened Apr 11, 2025 pm 10:06 PM

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

How to solve the problem of closing oracle cursor How to solve the problem of closing oracle cursor Apr 11, 2025 pm 10:18 PM

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

How to create cursors in oracle loop How to create cursors in oracle loop Apr 12, 2025 am 06:18 AM

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

How to stop oracle database How to stop oracle database Apr 12, 2025 am 06:12 AM

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

How to create oracle dynamic sql How to create oracle dynamic sql Apr 12, 2025 am 06:06 AM

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values ​​to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

How to open a database in oracle How to open a database in oracle Apr 11, 2025 pm 10:51 PM

The steps to open an Oracle database are as follows: Open the Oracle database client and connect to the database server: connect username/password@servername Use the SQLPLUS command to open the database: SQLPLUS

See all articles