一,sqlplus 环境变量

sqlplus的环境变量(来自SQL*Plus® User's Guide and Reference Release 11.2

Parameter or Variable Description

LD_LIBRARY_PATH

Environment variable to specify the path used to search for libraries on UNIX and Linux. The environment variable may have a different name on some operating systems, such as DYLD_LIBRARY_PATH on Apple Mac OSLIBPATH on IBM/AIX-5L, and SHLIB_PATH on HP-UX. Not applicable to Windows operating systems.

Example

  1. $ORACLE_HOME/lib

LOCAL

Windows environment variable to specify a connection string. Performs the same function as TWO_TASK on UNIX.Windows平台下的环境变量。类似于Unix中的TWO_TASK

NLS_LANG

Environment variable to specify globalization behavior.

Example

  1. american_america.utf8

ORACLE_HOME

Environment variable to specify where SQL*Plus is installed. It is also used by SQL*Plus to specify where message files are located.

Examples:

  1. d:\oracle\10g
  2. /u01/app/oracle/product/v10g
ORA_EDITION
指定版本

Environment variable to specify the database edition to use. If you specify the edition with the CONNECT or SQLPLUS command option, edition=value, it is used instead of ORA_EDITION. If no edition is specified in either the CONNECT or SQLPLUS command option, or in ORA_EDITION, SQL*Plus connects to the default edition.

ORA_NLS10

Environment variable to specify the locations of the NLS data and the user boot file in SQL*Plus 10.2. The default location is $ORACLE_HOME/nls/data. In a system with both Oracle9i and 10g, or a system under version upgrade, you should set ORA_NLS10 for Oracle 10g and set ORA_NLS33 for 9i. The default NLS location in 9i was $ORACLE_HOME/common/nls/admin/data.

ORACLE_PATH
 
在sqlplus执行@sql时也从这个目录中找
 
和下面的SQLPATH类似,SQLPATH多一个登陆加载的功能

Environment variable to specify the location of SQL scripts. If SQL*Plus cannot find the file in ORACLE_PATH, or if ORACLE_PATH is not set, it searches for the file in the current working directory.

Not applicable to Windows
 
指定执行sql脚本的目录,如果不指定默认为当前工作目录

ORACLE_SID

Environment variable to specify the database instance, optional

PATH

Environment variable to specify the path to search for executables, and DLLs in Windows. Typically includes ORACLE_HOME/bin

SQLPATH
 
设置在sqlplus启动是加载login.sql文件的位置,如表格后面
 
在sqlplus执行@sql时也从这个目录中找

Environment variable or Windows registry entry to specify the location of SQL scripts. SQL*Plus searches for SQL scripts, including login.sql, in the current directory and then in the directories specified by SQLPATH, and in the subdirectories of SQLPATH directories. SQLPATH is a colon separated list of directories. There is no default value set in UNIX installations.

In Windows, SQLPATH is defined in a registry entry during installation. For more information about the SQLPATH registry entry, see SQLPATH Registry Entry.

TNS_ADMIN
指定tnsnames.ora的路径,如果不指定默认使用$ORACLE_HOME/network/admin

Environment variable to specify the location of the tnsnames.ora file. If not specified, $ORACLE_HOME/network/admin is used

Example

  1. h:\network
  2. /var/opt/oracle

TWO_TASK

UNIX environment variable to specify a connection string. Connections that do not specify a database will connect to the database specified in TWO_TASK.
指定默认连接的数据库,后面没有加相应的字符串的话,就去连接TWO_TASK指定的字符串

Example

  1. TWO_TASK=MYDB
  2. export TWO_TASK
  3. sqlplus hr

is the same as:

  1. sqlplus hr@MYDB
  1. 取消环境变量
  1. export TWO_TASK=''

SQLPATH变量;
设置SQLPATH变量路径 找到用户概要文件login.sql
export SQLPATH=/dsg/sql
vi login.sql
set long 80
set newpage 0
set feedback on
set define on
set serveroutput on
set termout on
set time off
set timing on
set verify on     
set linesize 80
set pagesize 30
set sqlprompt "_USER'@'_CONNECT_IDENTIFIER _DATE>"
alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';
 
当启动sqlplus的时候会自动加载SQLPATH目录下的login.sql文件
 
二,保存环境变量
 
  1. STORE SET file_name
  1. START file_name
  1. 或者@file_name
 
三,安装sqlplus帮助
 

Running the hlpbld.sql Script to Install Command-line Help

Run the provided SQL script, HLPBLD.SQL, to load command-line help.

  1. Log in to SQL*Plus as the SYSTEM user with:

    1. SQLPLUS SYSTEM

    You are prompted to enter the password you have defined for the SYSTEM user.

  2. In UNIX run the SQL script, HLPBLD.SQL, from SQL*Plus with:

    1. @$ORACLE_HOME/sqlplus/admin/help/helpus.sql unix小写

    In Windows run the SQL script, HLPBLD.SQL, from SQL*Plus with:

    1. @ORACLE_HOME\SQLPLUS\ADMIN\HELP\HLPBLD.SQL HELPUS.SQL

    The HLPBLD.SQL script creates and loads the help tables.

Running the helpdrop.sql Script to Remove Command-line Help

Run the provided SQL script, HELPDROP.SQL, to remove the command-line help.

  1. Log in to SQL*Plus as the SYSTEM user with:

    1. SQLPLUS SYSTEM

    You are prompted to enter the password you have defined for the SYSTEM user.

  2. In UNIX run the SQL script, HELPDROP.SQL, from SQL*Plus with:

    1. @$ORACLE_HOME/sqlplus/admin/help/helpdrop.sql

    In Windows run the SQL script, HELPDROP.SQL, from SQL*Plus with:

    1. @ORACLE_HOME\SQLPLUS\ADMIN\HELP\HELPDROP.SQL

    The HELPDROP.SQL script drops the help tables, and then disconnects.

脚本说明:
 
  • HLPBLD.SQL -删除并创建新的帮助表

  • HELPDROP.SQL - 删除存在的帮助表

  • HELPUS.SQL -向帮助表中插入数据

sqlplus使用(一)的更多相关文章

  1. oracle日常——sqlplus客户端登录

    1.进入cmd 2.命令--sqlplus--提示输入帐号与密码 3.进入后,就可以直接键入sql命令 ps.sql命令后面需要添加分号后才可以回车执行

  2. SqlPlus中退格键和方向键的设置

    参见:http://www.cnblogs.com/wjx515/p/3717986.html   http://blog.csdn.net/jacky0922/article/details/765 ...

  3. sqlplus运行sql文件

    当sql文件的数据比较多的时候,pl/sql运行比较慢,可以通过oracle的sqlplus进行导入: sqlplus user/password@tnsname@sqlfile.sql; 注意如果文 ...

  4. sqlplus连接oracle失败分析和解决

    背景: 多台Linux服务器需要安装Oracle客户端,实现和Oracle数据库连接做业务处理. 安装完第一台后,直接将安装的目录压缩并复制到其他几台机器上,启动sqlplus连接数据库时,一直提示输 ...

  5. 在Oracle SQLplus下建用户 建表

    在建表之前最好新建一个用户,因为在sys用户下的表格不允许删除列, 所以最好不要在sys用户下建表. 一.在Oracle SQLplus下建用户: 1.以dba身份登陆SQLplus: [oracle ...

  6. oracle sqlplus 格式化输出

    1- show pagesize      ###显示页行数 set pagesize 300 ###显示页行数为300 2- show linesize        ###显示行宽度 set li ...

  7. win2012,oracle11g,sqlplus切换实例的方法

    问题环境:windows 2012 r2 64位  ,oracle 11.2.0.4,多个实例. 在这种情况下, sqlplus "/as sysdba" 默认登录的是系统后面安装 ...

  8. (转)sqlplus中文显示乱码的问题

    sqlplus中文显示乱码的问题 2010-07-19 11:33:26 分类: LINUX 在windows下sqlplus完全正常,可是到linux下,sqlplus中文显示就出问题了,总是显示“ ...

  9. SQLPlus 在连接时通常有四种方式

    1. sqlplus / as sysdba    操作系统认证,不需要数据库服务器启动listener,也不需要数据库服务器处于可用状态.比如我们想要启动数据库就可以用这种方式进入    sqlpl ...

  10. oracle使用sqlplus创建表空间

    一.打开命令行窗口,输入以下命令:sqlplus /nolog 回车后,将出现提示符 SQL>, 这时输入conn / as sysdba 一般即可登录,如果失败的话,可以试一下用conn sy ...

随机推荐

  1. BZOJ 2124: 等差子序列

    Sol 线段树+Hash. 首先暴力 等差子序列至少3项就可以了,就枚举中项,枚举公差就可以了,只需要一个数在中项前出现,另一个数在中项前没出现过就可以了.复杂度 \(O(n^2)\) 然后我想了一个 ...

  2. 11 AlarmHandler定时处理类——Live555源码阅读(一)基本组件类

    这是Live555源码阅读的第一部分,包括了时间类,延时队列类,处理程序描述类,哈希表类这四个大类. 本文由乌合之众 lym瞎编,欢迎转载 http://www.cnblogs.com/oloroso ...

  3. 解决html5 video不能播放 能播放声音不能播放视频

    <video id="playVideo" style="width:90%; height:auto;" controls poster=". ...

  4. 火狐浏览器,关闭ssl v3防护

    某些网站,没有及时更新,导致火狐觉得有安全隐患,不给访问. --------------- Hello bcasey9090, go to about:config, copy the next bo ...

  5. 【leetcode】Unique Paths II

    Unique Paths II Total Accepted: 22828 Total Submissions: 81414My Submissions Follow up for "Uni ...

  6. 华为 MATE7 调试 LOCAT 日志不输出问题

    [转]华为 MATE7 调试 LOCAT 日志不输出问题 http://www.cnblogs.com/glaivelee/p/4593221.html 用手机进行调试,在电脑上不显示logcat信息 ...

  7. 在VS中MFC、ATL与WIN32有什么联系或区别?

    有时候遇到一些初学者问我这个问题:在VS中使用MFC和ATL与使用WIN32有什么联系或区别?通俗来说,win32是通过调用windows api去实现需要的功能.而MFC和ATL是封装好的类库,包含 ...

  8. glib-2.49.4-msys-x86-staticLib.7z

    glib-2.49.4 MSYS 静态库 编译 export LIBFFI_CFLAGS=" -I/usr/local/lib/libffi-3.2.1/include " \ e ...

  9. 允许FTP用户登录并禁止Shell登录的方法

    最近安装了vsftpd做FTP服务,发现系统用户的登录shell设置为/sbin/nologin,就无法使用FTP服务.网上资料说,vsftpd会为每个FTP登录用户去在/etc/shells中检查对 ...

  10. nyoj412_bitset_

    Same binary weight 时间限制:300 ms  |  内存限制:65535 KB 难度:3   描述 The binary weight of a positive  integer ...