René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

sqlplus options

-v

Prints sqlplus' version:
C:\>sqlplus -v

SQL*Plus: Release 10.1.0.2.0 - Production

-h

Prints sqlplus' version and a brief overview over its options:
C:\>sqlplus -h

SQL*Plus: Release 10.1.0.2.0 - Production

Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ]
where <option> ::= -H | -V | [ [-C <v>] [-L] [-M <o>] [-R <n>] [-S] ]
      <logon>  ::= <username>[/<password>][@<connect_identifier>] | / | /NOLOG
      <start>  ::= @<URL>|<filename>[.<ext>] [<parameter> ...]
        "-H" displays the SQL*Plus version banner and usage syntax
        "-V" displays the SQL*Plus version banner
        "-C" sets SQL*Plus compatibility version <v>
        "-L" attempts log on just once
        "-M <o>" uses HTML markup options <o>
        "-R <n>" uses restricted mode <n>
        "-S" uses silent mode

-c

Sets the compatibility of sqlplus.

-nolog

Starts SQL*Plus but does not log on (connect) a user/session.
A connection can then be made in SQL*Plus with connect.

-l

When a user tries to connect to the database with SQL*Plus and gives a wrong password, by default, SQL*Plus gives him two additional chances to try again. Giving the -l option will not ask anymore. Consider:
$ sqlplus rene/wrong_password

SQL*Plus: Release 10.1.0.2.0 - Production on Sun Apr 17 15:35:14 2005

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name: rene/wrong_again
ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name: rene/did_i_forget_it
ERROR:
ORA-01017: invalid username/password; logon denied


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
Now, with the -l option:
$ sqlplus -l rene/wrong_password

SQL*Plus: Release 10.1.0.2.0 - Production on Sun Apr 17 15:36:27 2005

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied


SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

-m

-r

sqlplus ... -r 1
sqlplus ... -r 2
sqlplus ... -r 3
Sets the restriction level which can either be 1, 2 or 3. The restriction level affects the following SQL*Plus commands:
  Restriction Level
Command 1 2 3
edit no no no
get no
host no no no
save no no
spool no no
start (also @ and @@) no
store no no
Additionally, the login.sql script won't be run if the restriction level is set to 3.

@

Executes the script following the @.

-s

The silent option: it suppreses the output of the SQL*Plus banner, the command prompt and the echoing of commands.