1.首先下载两个程序包:

Instant Client Package - Basic(或Instant Client Package - Basic Lite)包

Instant Client Package - SQL*Plus包

下载地址:

http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/index.html

2.将Instant Client Package – Basic和Instant Client Package - SQL*Plus解压,

例将其中的文件放在目录C:\Instantclient10_2

3.设置环境变量:

  1)在环境变量PATH中开头增加C:\Instantclient10_2;

  2)增加用户环境变量SQLPATH,值为C:\Instantclient10_2

  3)增加用户环境变量NLS_LANG,值为AMERICAN_AMERICA.UTF8(中文可能乱码,可改用AMERICAN_AMERICA.ZHS16GBK)

4.到此已经可以用SQL*Plus连接远程数据库,但书写方式必须如下例:

Sqlplus SYS/SYS@//192.168.0.2:1521/VMORCL

如果想要使用配置于TNSnames.ora中的连接字符串来连接,

增加环境变量TNS_ADMIN,

   值为tnsnames.ora所在的目录,例: C:\Instantclient10_2\network\admin(建立

C:\Instantclient10_2\network\admin目录,将TNSnames.ora放在此目录下),

并编辑TNSnames.ora

如:

LORCL=

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS =

(PROTOCOL = TCP)

(Host = 192.168.159.128)

(Port = 1521)

)

)

(CONNECT_DATA = (SID = LORCL)

)

)

此时连接数据库,例:

Sqlplus sys/sys@vmorcl as sysdba

或sqlplus sys@vmorcl as sysdba

另:使用PL/SQL Developer的话,直接在preference中将oracle home 设置为C:\instantclient10_2,oci library

       设为C:\instantclient\oci.dll

------------------------------------------------------------设置结束----------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------

附:

一个网友按照上面步骤做了之后说还是不可以用,报错,

Initialization error

Could not load “C:\Instantclient10_2\oci.dll”

OCIDLL forced to C:\Instantclient10_2\oci.dll

LoadLibrary(C:\Instantclient10_2\oci.dll) returned 0

折腾很久没找到原因,后来他告诉我说他的目录不是C:\Instantclient10_2,而是C:\Instantclient11_XX,无语..

把自己Developer的Oracle Home的目录改成一个不存在的目录,测试,果然出现他所说的错误,如下

 

而且登陆框是下面这个样子

明显没有应用到那个InstantClient中的组件…

正常的时候应该像如下:

---------------------------------------------------------------------------------------------------------------------------------------

附:SQL*Plus? User's Guide and Reference Release 10.2中详细说明

http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ape.htm#sthref3926

Oracle Call Interface Programmer's Guide for more information on the OCI Instant Client.

To Oracle Database Globalization Support Guide, and NLS_LANG Environment Variable for more information about NLS settings.

http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html

. Both packages must be from the same version such as 10.2.0.1.

2.     Use rpm -i for the initial install of the RPM packages, or rpm -u to upgrade to a newer version of the packages.

3.     Configure SQL*Plus Instant Client. See Configuring SQL*Plus Instant Client.

http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html

. Both packages must be from the same version such as 10.2.0.1.

2.     Create a new directory, for example, /home/instantclient10_2 on UNIX or c:\instantclient10_2 on Windows.

3.     Unzip the two packages into the new directory.

4.     Configure SQL*Plus Instant Client. See Configuring SQL*Plus Instant Client.

Installing SQL*Plus Instant Client on UNIX or Linux or Installing SQL*Plus Instant Client on Windows for a list of the files to copy.

4.     Configure SQL*Plus Instant Client. See Configuring SQL*Plus Instant Client.

Oracle Database Globalization Support Guide for more information.

For example:

NLS_LANG=AMERICAN_AMERICA.UTF8

export NLS_LANG

Oracle Database Globalization Support Guide for more information.

For example:

NLS_LANG=AMERICAN_AMERICA.UTF8

export NLS_LANG

Oracle Database Globalization Support Guide for more information. For example, to set NLS_LANG for a Japanese environment, create a user environment variable NLS_LANG set to JAPANESE_JAPAN.JA16EUC.

If you have installed the lightweight Instant Client, see Lightweight Instant Client for information about supported NLS_LANG settings.

Oracle Database Net Services Reference for more information.

If you want to use Net Service Names configured in a local Oracle Net tnsnames.ora file, then set the environment variable TNS_ADMIN to the directory containing the tnsnames.ora file. For example, on UNIX, if your tnsnames.ora file is in /home/user1 and it defines the Net Service Name MYDB2:

TNS_ADMIN=/home/user1

export TNS_ADMIN

sqlplus hr@MYDB2

If TNS_ADMIN is not set, then an operating system dependent set of directories is examined to find tnsnames.ora. This search path includes looking in the directory specified by the ORACLE_HOME environment variable for network/admin/tnsnames.ora. This is the only reason to set the ORACLE_HOME environment variable for SQL*Plus Instant Client. If ORACLE_HOME is set when running Instant Client applications, it must be set to a directory that exists.

This example assumes the ORACLE_HOME environment variable is set, and the $ORACLE_HOME/network/admin/tnsnames.ora or %ORACLE_HOME%\network\admin\tnsnames.ora file defines the Net Service Name MYDB3:

sqlplus hr@MYDB3

The TWO_TASK (on UNIX) or LOCAL (on Windows) environment variable can be set to a connection identifier. This removes the need to explicitly enter the connection identifier whenever a connection is made in SQL*Plus or SQL*Plus Instant Client. This UNIX example connects to the database known as MYDB4:

TNS_ADMIN=/home/user1

export TNS_ADMIN

TWO_TASK=MYDB4

export TWO_TASK

sqlplus hr

On Windows, TNS_ADMIN and LOCAL may be set in the System Properties. SeeConfiguring SQL*Plus Instant Client on Windows.

Oracle Database Administrator's Guide for information on Oracle password files.

Installing SQL*Plus Instant Client from the 10g Client Release Media for a list of the files you copied to the directory.

2.     Reset environment variables such as PATH, SQLPATH, LD_LIBRARY_PATH and TNS_ADMIN.

3.     Remove tnsnames.ora if necessary.

通过Instant Client包来使用SQL*PLUS的更多相关文章

  1. ORACLE Instant Client 配置

    http://www.oracle.com/technetwork/cn/database/features/instant-client/index-092699-zhs.html 在官网下载对应的 ...

  2. 使用Instant Client配置PL/SQL Developer

    之前使用PL/SQL Developer都是直接在本机安装完整版的Oracle Database,一是省事,二是可以在本机做一些demo测试:最近换了台电脑,感觉Instant Client更简单一些 ...

  3. 本机不安装Oracle客户端,使用PL/SQL Developer和 Instant Client 工具包连接oracle 11g远程数据库

    一.先到Oracle网站下载Instant Client 下载地址:http://www.oracle.com/technetwork/cn/database/features/instant-cli ...

  4. PL/SQL Developer 和 Instant Client客户端安装配置

    一. 准备工作 1. 点击此下载 PL/SQL Developer 2. 点击此下载 Instant Client 二. 配置Instant Client 1. 新建  %安装目录%\network\ ...

  5. Oracle instant client及pl sql developer的使用

    Oracle instant client的使用   最近重装了操作系统,使用的是Windows7 x64的版本,不准备安装Oracle,于是从官网上看到了Instant Client.   兴冲冲下 ...

  6. Oracle Instant Client的安装和使用

    转自:https://www.cnblogs.com/chinalantian/archive/2011/09/09/2172145.html 根据自己需求到Oracle网站(http://www.o ...

  7. Oracle Instant Client 安装配置

    一.下载 下载地址:http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html 这是Ora ...

  8. Oracle instant client免安装Oracle客户端配置

    不想安装几个G的完整版client,可以直接通过安装包安装的时候选择instant client,如果没有安装包,也可以直接去官网下载一个即时客户端,64位的windows包大小只有78MB左右 传送 ...

  9. 如何安装Oracle Instant Client

    Oracle Instant Client是Oracle发布的轻量级数据库客户端,下面我们来看看官方的定义: Instant Client allows you to run your applica ...

随机推荐

  1. Windows Server 2008下共享资源访问走捷径 (不用用户名 和 密码 访问共享)

    1. 启用来宾帐号2. 共享目录添加“Guest”帐号3. “gpedit.msc”,打开对应系统的组策略编辑窗口;在该编辑窗口的左侧显示区域,依次展开“本地计算机策略”/“计算机配置”/“Windo ...

  2. 【Entity Framework】 Entity Framework资料汇总

    Fluent API : http://social.msdn.microsoft.com/Search/zh-CN?query=Fluent%20API&Refinement=95& ...

  3. POJ 3080 Blue Jeans (多个字符串的最长公共序列,暴力比较)

    题意:给出m个字符串,找出其中的最长公共子序列,如果相同长度的有多个,输出按字母排序中的第一个. 思路:数据小,因此枚举第一个字符串的所有子字符串s,再一个个比较,是否为其它字符串的字串.判断是否为字 ...

  4. Java中LinkedList的remove方法真的耗时O(1)吗?

    这个问题其实来源于Leetcode的一道题目,也就是上一篇日志 LRU Cache.在使用LinkedList超时后,换成ArrayList居然AC了,而问题居然是在于List.remove(Obje ...

  5. jQuery从主页面存取控制 iframe 中的元素,参数及方法

    从主页面上获取iframe下的某个对象,或使用iframe下的方法,或是获取iframe下某个doc元素,要求兼容各类浏览器,不仅仅ie; $(function() { $('#abgne_ifram ...

  6. 小米2S 连接Ubuntu Android Studio

    1. 首先打开手机上的开发者选项,USB调试.拨号:*#*#717717#*#*  ,手机会以Toast形式出现“……enable”字样.再次拨号可disable. 2. Ubuntu安装mtpfs: ...

  7. CSS中nth-child和nth-of-type的简单使用

    ele:nth-child是查找父元素下的子元素,包括子元素类型非ele的,当子元素类型不是ele时,则不会进行任何操作: ele:nth-of-type是查找父元素下的子元素类型为ele的元素,其是 ...

  8. 使用Css截取字符串

    white-space:nowrap; /* 禁止自动换行 */ overflow:hidden; /* 隐藏溢出的内容 */ text-overflow:ellipsis; /* 溢出文本使用... ...

  9. 在sklearn上读取人脸数据集保存图片到本地

    程序如下: # -*- coding: utf-8 -*- """ Created on Sat Oct 31 17:36:56 2015 ""&qu ...

  10. *[codility]MaxDoubleSliceSum

    https://codility.com/demo/take-sample-test/max_double_slice_sum 两个最大子段和相拼接,从前和从后都扫一遍.注意其中一段可以为0.还有最后 ...