[oracle@redhat4 ~]$ sqlplus -H
SQL*Plus: Release 10.2.0.1.0 - Production
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Usage 1: sqlplus -H | -V
-H Displays the SQL*Plus version and the
usage help.
-V Displays the SQL*Plus version.
Usage 2: sqlplus [ [] [] [] ]
is: [-C ] [-L] [-M ""] [-R ] [-S]
-C Sets the compatibility of affected commands to the
version specified by . The version has
the form "x.y[.z]". For example, -C 10.2.0
-L Attempts to log on just once, instead of
reprompting on error.
-M "" Sets automatic HTML markup of output. The options
have the form:
HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
[ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
-R Sets restricted mode to disable SQL*Plus commands
that interact with the file system. The level can
be 1, 2 or 3. The most restrictive is -R 3 which
disables all user commands interacting with the
file system.
-S Sets silent mode which suppresses the display of
the SQL*Plus banner, prompts, and echoing of
commands.
[AS SYSDBA | AS SYSOPER] | /NOLOG
Specifies the database account username, password and connect
identifier for the database connection. Without a connect
identifier, SQL*Plus connects to the default database.
The AS SYSDBA and AS SYSOPER options are database administration
privileges.
The /NOLOG option starts SQL*Plus without connecting to a
database.
Runs the specified SQL*Plus script from a web server (URL) or the
local file system (filename.ext) with specified parameters that
will be assigned to substitution variables in the script.
When SQL*Plus starts, and after CONNECT commands , the site profile
(e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile
(e.g. login.sql in the working directory) are run . The files may
contain SQL*Plus commands.
Refer to the SQL*Plus User's Guide and Reference for more information.
[oracle@redhat4 ~]$
sqlplus [ [] [] [] ]
sqlplus的三种命令行选项,我们经常使用的是 和
start: @ 用来在sqlplus中执行某个脚本
比如:
表示在sqlplus中执行当前目录下的create_db.sql这个脚本
再比如
SQL> @?rdbms/admin/awrrpt.sql
表示执行 $ORACLE_HOME/rdbms/admin/create_db.sql 的脚本文件。?表示$ORACLE_HOME
glogin.sql和login.sl用来配置sqlplus的环境变量,比如设置自己的linesize, pagesize等等。glogin.sql是针对服务器上的通过sqlplus访问的所有用户,而login.sql是针对个人。
有点类似于 /etc/profile /etc/bashrc 与 .bashrc .bash_profile
glogin.sql相当于 /etc/profile 和 /etc/bashrc
login.sql相当于 .bashrc 和 .bash_profile
我们可以将自己的 login.sql 放在自己的home目录下,也可以修改 .bash_profile ,增加一个环境变量SQLPATH,来指向 login.sql所在的目录,假定我的login.sql放在了$ORACLE_HOME/sqlplus/admin/login.sql下面,那么我们应该在.bash_profile增加下面一行:
export SQLPATH=$ORACLE_HOME/sqlplus/admin/
set echo off --不显示当前正在执行的语句
set feed off set feedback off --不显示反馈信息
set head off --不显示标题
set pagesize 0 --页尺寸,0 表示不分页,如大于0,则分页,每页后都会有feedback或空行
set linesize 250 --行尺寸,不足长度后缀空格,与set trims on同时使用
set termout off --在终端上不显示结果,这样可以加快spool到文件的速度
set trims on --去掉spool中的尾部空格,否则每一行都会有linsize定义的长度
以上几个可能都会遇上
阅读(3982) | 评论(0) | 转发(0) |