Section A.1. The Command to Invoke SQL*Plus
A 1 The Command to Invoke SQL*Plus
The sqlplus command is used from the operating system prompt to start SQL*Plus. Chapter 2 shows various examples of the command being used. The syntax is:
sqlplus [ options ] [ logon ] [ start ] options ::= option [ option . . . ] option ::= {-H[ELP] -V[ERSION] -C[OMPATIBILITY] x . y [. z ] -L[OGON] -M[ARKUP] markup -R[ESTRICT] {1 2 3} -S[ILENT]} markup ::= HTML [ON OFF] [HEAD text ] [BODY text ] [TABLE text ] [ENTMAP {ON OFF}] [PREFORMAT {ON OFF}] logon ::= { typical os_authenticated administrative /NOLOG} typical ::= username [/ password ][@ net_service_name ] os_authenticated ::= / administrative ::= typical AS {SYSDBA SYSOPER} start ::= @{ url file_path } [ param [ param . . . ]]
Command-line options are case-insensitive. The command itself may or may not be case-sensitive, depending on the underlying operating system. Parameters of a textual nature that include spaces or other non-alpha characters should be enclosed within double-quotation marks, as in HEAD "
My Page
".
The parameters are as follows :
text
text >.
-H[HELP]
Displays the syntax for the sqlplus command and then exits.
-V[ERSION]
Displays the current SQL*Plus version number and related information and then exits.
-C[OMPATIBILITY]x.y[.z]
Specifies a prior version ( x ), a release ( y ), and optionally an update ( z ) of SQL*Plus with which you wish to be compatible.
-L[OGON]
Inhibits reprompting for a username and password should the initial login credentials prove invalid. Use this option when invoking SQL*Plus from, say, a cron job, where reprompting makes no sense because there is no interactive user to see and respond to the prompt.
-M[ARKUP] markup
Controls whether SQL*Plus output is given in plain text or HTML, and, if in HTML, further specifies various options.
-R[ESTRICT] {1 2 3}
Disables commands that interact with the operating system. You may choose from one of three restriction levels:
- Disable the EDIT and HOST commands
- Disable EDIT, HOST, SAVE, SPOOL, and STORE
- Disable EDIT, GET, HOST, SAVE, SPOOL, START, @, @@, and STORE
In addition, level 3 prevents the execution of the user profile script in login.sql .
-S[ILENT]
Tells SQL*Plus to run in silent mode. No startup messages, such as the copyright message, are displayed. No command prompt is displayed, and no commands are echoed to the screen. This is useful if you are invoking SQL*Plus from within some other program and you want to do it transparently . Normally, you would use this option in conjunction with invoking a script file.
HTML [ON OFF]
Enables or disables HTML output. The default is HTML OFF.
[HEAD text]
Specifies content for the HEAD tag, which ends up as
.
[BODY text]
Specifies attributes for the BODY tag, which ends up as
[TABLE text]
Specifies attributes for the TABLE tag used to define tables holding query output, which ends up as
. Tables used to hold page headers and footers aren't affected by this parameter.
[ENTMAP {ON OFF}]
Specifies whether SQL*Plus replaces special characters such as "<" and ">" with their corresponding HTML entities (e.g., "<" and ">"). The default is ENTMAP ON.
[PREFORMAT {ON OFF}]
Matters only when HTML output is enabled and specifies whether SQL*Plus writes query output as an HTML table or as a preformatted text block (using
...
). The default is PREFORMAT OFF.
/NOLOG
Starts SQL*Plus without a database connection.
typical ::= username[/password][@net_service_name]
Authenticates you using the given username, password, and net service name . Net service names are often defined in a file known as tnsnames.ora .
os_authenticated ::= /
Authenticates you by virtue of the fact that you have logged into the operating system. Your Oracle username must be specifically configured to support this type of authentication.
administrative ::= typical AS {SYSDBA SYSOPER}
Authenticates you as a system database administrator (SYSDBA) or system operator (SYSOPER).
@{url file_path}
Invokes a SQL*Plus script via a URL or a path and filename. URLs may be either http:// or ftp:// . filenames may include paths and extensions. The default file extension is .sql .
[param [param...]]
Are one or more parameters to pass to a script that you are invoking.
A 2 Commands You Can Issue Within SQL*Plus