[Oracle]sqlplus Start parameter description

Source: Internet
Author: User
Tags sqlplus

[Oracle]sqlplus Start parameter description

# su-oracle [Grid]

Usage 1:sqlplus-h | -V

Displays the syntax and usage of the Sql*plus command, and then returns control to the operating system.
Displays the version number of the Sql*plus, and then returns control to the operating system.

Usage 2:sqlplus [[<option>] [{logon |/nolog}] [<start>]

<option> is: [-c <version>] [-l] [-m] <options> "] [-R <level>] [-S]

-C <version>:
Set the Sql*plus command to a compatible version. The format of <version> is "x.y[.z". For example,-C 10.2.0

Specifies that if the first connection is unsuccessful, do not prompt for a user name and password again. This option can be used in operating system scripts to prevent prompting for connection information again when the database server is not running. This option is not available in the Sql*plus graphical user interface
-m[arkup] "<options>":
You can use this option to generate completely standard, stand-alone Web pages from a query or script.
You can use Sqlplus-markup HTML on or SET MARKUP HTML on SPOOL to generate a standard Web page. Sql*plus will automatically generate full HTML pages using <HTML> and <BODY> tags. When you execute the SPOOL off command or exit Sql*plus, the HTML tags in the spool file are closed.
The-silent and –restrict command-line options are also useful when using-markup.
You can use SET MARKUP html on SPOOL OFF to generate HTML output that can be embedded in an existing Web page. There are no <HTML> and <BODY> tags in the output generated in this way.
Use MARKUP HTML on to generate HTML output into a <PRE> tag or an HTML table. When you export to a table, the standard HTML <TABLE>, <TR>, and <TD> tags are automatically used to encode the rows and columns of the query results. When the HTML option is set to ON, the default behavior is to output to an HTML table. You can use the <PRE> tag to generate output by setting Preformat on.
Use the show MARKUP command to view the status of the MARKUP option.
The Sqlplus–markup command and the SET MARKUP command have the same options and functionality.
NOTE: The markup_option clause may need to be enclosed in quotation marks.
HTML [on| OFF]:
HTML is a required MARKUP parameter that specifies the output of the generated HTML type. The optional parameters on and OFF of HTML are used to specify whether to generate HTML output. The default is off.
MARKUP HTML on generates HTML output using the specified MARKUP option, or with Set MARKUP, the option set by the previous set MARKUP HTML command in the current session.
The HTML can be set to on or off as needed during the session. The default is OFF.
You can use the Sql*plus command SPOOL filename to write the generated output to a spool file. Please refer to spool {on| below for more information. OFF}
HEAD text:
The HEAD text option allows you to specify the contents of the <HEAD> tag. By default, text is:
<title>sql*plus report</title>
If the text includes a space, you must enclose it in quotation marks. Sql*plus does not detect the HTML validity of text, so you must ensure that the text you enter is valid for the <HEAD> tag. This option allows you to customize the output for specific browsers or special needs.
BODY text:
The BODY text option allows you to specify properties for the <BODY> tag. By default, there are no properties. If the text includes a space, you must enclose it in quotation marks. Sql*plus does not detect the HTML validity of text, so you must ensure that the text you enter is valid for the <BODY> tag. This option allows you to customize the output for specific browsers or special needs.
TABLE text:
The TABLE text option allows you to specify properties for the <TABLE> tag. You can use the TABLE text option to set properties for <TABLE> tags, such as BORDER, cellpadding, cellspacing, and WIDTH. The WIDTH property of <TABLE> is set to 90% by default, and the BORDER property is set to 1.
If the text includes a space, you must enclose it in quotation marks. Sql*plus does not detect the HTML validity of text, so you must ensure that the text you enter is valid for the <TABLE> tag. This option allows you to customize the output for specific browsers or special needs.
Entmap {on| OFF}:
Entmap on or OFF Specifies whether Sql*plus is used with HTML entities &lt;, &gt;, &quot; and &amp; To replace the special characters <, >, and & respectively. By default, Entmap is set to ON.
The Entmap can be set to on or OFF as needed during the session. For example, when set to OFF, the Sql*plus screen output is:
Sql>select department_id, City
1 from Emp_details_view
2 WHERE SALARY = 12000;
When set to ON, the Sql*plus screen output is:
Sql&gt; SELECT department_id, City
2 from Emp_details_view
3 WHERE SALARY = 12000;
If there are no mapped entities, the Web browser may think of the data as invalid HTML and subsequent output will not display properly. Use Entmap OFF to write your own HTML tags to customize the output.
The entities in the <HEAD> and <BODY> tags are not mapped, so you must ensure that valid entities are used in the markup HEAD and BODY options.
Note: Entmap only works if the HTML option or the SPOOL option is set to ON

SPOOL {on| OFF}:
SPOOL on or OFF specifies whether the Sql*plus <HTML>, <BODY>, </BODY>, </HTML> labels are written to the start of each file created by the SPOOL filename command, respectively, and End of the place. The default is OFF.
The SPOOL can be set to on or OFF as needed during the session period.
You must understand the difference between the set MARKUP HTML SPOOL option and the SQLPLUS SPOOL filename command.
The SET MARKUP HTML SPOOL on option is used to write the <HTML> tag to the spool file. The spool file is created only if the SQLPLUS SPOOL filename command is used.
When the SPOOL filename command is published, Sql*plus writes several HTML tags to the spool file. The labels that are written and their default contents are:
<title>sql*plus report</title>
<meta name= "generator" content= "Sql*plus 9.0.1" >
When you publish the EXIT, SPOOL off, or SPOOL filename command, Sql*plus attaches the following label to the file and closes the file:
You can use the HEAD and BODY options to specify the properties of the <HEAD> tag content and <BODY>.
Pre[format] {on| OFF}:
Preformat on or OFF Specifies whether Sql*plus writes the output to the <PRE> tab or to an HTML table. The default value is OFF, so the output is written to the HTML table by default. The Preformat can be set to on or OFF as needed in the session.
To use the <PRE> label generation output report, you must set Preformat on. For example:
Sqlplus-m "HTML on Preformat"
SET MARKUP HTML on Preformat on
MARKUP Usage Note:
The existing script that does not explicitly set Preformat on will generate output in the HTML table. If you want to generate output in the <PRE> tab, you must set Preformat on.
When you generate output in an HTML table, some sql*plus commands behave differently. The commands that are used to format the report may have different meanings for Web tabular reports.
PAGESIZE is the number of rows in an HTML table, not the number of rows of data. Each row of an HTML table can contain multiple rows of data. Ttitle, Btitle, and column headings are repeated every PAGESIZE line.
If WRAP is set to On,linesize, it will have an effect on longer data. Depending on the length of the data, they may be displayed as multiple lines and the Web browser may interpret the line break as a space.
Ttitle and Btitle can be output to three positions in the line: Left, middle, and maximum line width are set to 90% of the browser window. Because these elements are handled differently in a WEB report, they may not be aligned with the primary output data in the report. The entity mappings in Ttitle and Btitle are the same as the ENTMAP settings specified in the MARKUP command.
If you use a caption in the output, Sql*plus will display the data using a new HTML table after the title. The column widths of each table displayed in the browser may vary depending on the width of the data in each column.
In an HTML report, the set COLSEP and recsep generate output only if Preformat is set to ON.
-r[estrict] <level>:
Allows the user to disable several commands that can interact with the operating system. This is similar to disabling commands using the Product User profile (PUP) table. However, if you disable the command using this option, the commands are disabled even if you are not connected to the server and remain until you exit Sql*plus.
If you do not use the –R option, all commands are available, unless they have been disabled in the PUP table.
The maximum limit is-R 3, if the-R 3 is used, then LOGIN. SQL will not be read, and Glogin.sql will be read but the restricted command used in it will fail.
The following commands are disabled for each restriction level:
Command Level 1, Level 2, Level 3
EDIT Disabled disabled disabled
GET disabled
HOST Disabled disabled disabled
SAVE disabled disabled
SPOOL disabled disabled
start,@,@@ disabled
STORE disabled disabled

Set the silent mode to suppress all sql*plus information and prompt messages, including the command prompt, the echo of commands, and the welcome message that is displayed when you start Sql*plus normally. If you omit the user name or password, Sql*plus prompts for them, but the message is not visible. Sql*plus can be invoked silently in other programs.
The silent option is a useful pattern when you create a WEB-formatted report with the Sqlplus–m command in a CGI script or operating system script. When you use the silent option, neither the welcome nor the Sql*plus information appears in the report.

<logon> is: {<username>[/<password>][@<connect_identifier>] |/}
[As {SYSDBA | Sysoper | SYSASM}] [Edition=value]

Specify the database account user name, password, and connection identifier. If there is no connection identifier, Sql*plus will connect to the default database
/indicates the default login when operating system authentication is used. Unable to enter with default login <connect_identifier>,sql*plus attempts to log in using the user name Ops$name, where name is the operating system user name. Note that the prefix "ops$" can be set to any other string. For example, you can do this in INIT. In the ORA parameter file, change it to LogonName or useridname.

Clause as SYSDBA, the as Sysoper and as Sysasm options specify to connect with database administrator privileges. You can also use/and/nolog for privileged connections. If you use this option, command parameters must be enclosed in quotation marks in most operating systems, for example:
Sqlplus "/As SYSDBA"
Sqlplus "System/password as Sysoper"

<connect_identifier> Oracle Connection identifier. Its exact syntax relies on the network communication protocol used by Oracle during installation. This can be an Oracle network service name or a simple connection method.

@[<net_service_name> | [//] host[:P Ort]/<service_name>]
<net_service_name> Oracle Network Service name, if not entered, the default is environment variable $ORACLE _sid value
Host name or IP address of the destination database
Port target Database Listening ports, if not entered, default is 1521
<service_name> Target Database service name

The/nolog option starts only sql*plus does not connect to the database. To execute any SQL command, you must first make a valid connection by executing the Connect command. You can use/nolog when you want to prompt for a user name, password, or database with a sql*plus script. The first line in the script file is not assumed to contain a login information.

EDITION Specifies the value of the session version.

<start> is: @<url>|<filename>[.<ext>] [<parameter> ...]
Specifies the name and parameters of the script file to execute. You can call scripts that reside on the local file system or in a WEB server.
Sql*plus passes the arguments to the script as if it were executed using the Sql*plus START command. If you do not specify a file name extension, the suffix defined by the Set SUFFIX command is used. The default value is. sql

When Sql*plus starts and connects to the database, some local SQL files may be executed such as "$ORACLE _home/sqlplus/admin/glogin.sql" files and "Login.sql" files in the user's working directory.


Start-only sql*plus do not log on to the database
$ sqlplus/nolog

Login as Default Administrator
$ sqlplus/as SYSDBA

Log in as a database account
$ sqlplus
$ sqlplus Username
$ sqlplus [email protected]
$ sqlplus [Email Protected]//host/sid
$ sqlplus [Email Protected]//host:port/sid
$ sqlplus Username/password
$ sqlplus Username/[email protected]
$ sqlplus Username/[email Protected]//host/sid
$ sqlplus Username/[email Protected]//host:port/sid
$ sqlplus username as Sysdba
$ sqlplus [email protected] as SYSDBA
$ sqlplus [email protected]//host/sid as Sysdba
$ sqlplus [email protected]//host:port/sid as Sysdba
$ sqlplus Username/password as Sysdba
$ sqlplus username/[email protected] as Sysdba
$ sqlplus username/[email Protected]//host/sid as Sysdba
$ sqlplus username/[email Protected]//host:port/sid as Sysdba

Log in to the database and execute the sql*plus script file
$ sqlplus username/[email protected] @/home/oracle/createdb
$ sqlplus username/[email protected] @/home/oracle/createdb.sql
$ sqlplus username/[email protected] @/home/oracle/createdb.sql 10 10 30 40

[Oracle]sqlplus Start parameter description

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.