Oracle® Database Administrator's Reference 10g Release 2 (10.2) for hp OpenVMS Part Number B25416-02 |
|
|
View PDF |
This chapter describes how to use and administer SQL*Plus on OpenVMS. It contains the following topics:
This section describes how to administer command-line SQL*Plus. It includes:
See Also:
SQL*Plus User's Guide and ReferenceWhen you start SQL*Plus, it runs the GLOGIN.SQL
site profile setup file and then runs the LOGIN.SQL
user profile setup file.
The global site profile file is ORA_ROOT:[SQLPLUS.ADMIN]GLOGIN.SQL
. If a site profile already exists at this location, then it is overwritten when you install SQL*Plus. If SQL*Plus is removed, then the site profile file is also removed.
The user profile file is LOGIN.SQL
. SQL*Plus looks for this file in the current directory, and then in the directories you specify by using the SQLPATH
logical. Set this logical to a comma-delimited list of directories. For example:
$DEFINE SQLPATH "disk1:[path1],disk2:[path2]"
SQL*Plus searches these directories for the LOGIN.SQL
file in the order they are listed.
The options set in the LOGIN.SQL
file override those set in the GLOGIN.SQL
file.
See Also:
SQL*Plus User's Guide and Reference for more information about profile filesDuring a typical installation, the PRODUCT_USER_PROFILE
table is created automatically. This table is used to disable the SQL and SQL*Plus commands you specify. To re-create this table, run the following script in the SYSTEM
schema:
ORA_ROOT:[SQLPLUS.ADMIN]PUPBLD.SQL
For example:
$ SQLPLUS SYSTEM/MANAGER SQL> @ORA_ROOT:[SQLPLUS.ADMIN]PUPBLD.SQL
Oracle Database provides demonstration tables that you can use for testing. To install the demonstration tables in a database, you must choose an installation type that installs a preconfigured database.
See Also:
Oracle Database Installation Guide for more information about installation optionsDuring a Typical installation, the user SCOTT
and the demonstration tables are created automatically.
Use the ORA_SQLPLUS_DEMO:DEMOBLD.SQL
SQL script to create the demonstration tables. In SQL*Plus, you can use any user name to run the DEMOBLD.SQL
file to create the demonstration tables in a schema. For example, enter:
$ SQLPLUS SYSTEM/MANAGER SQL> @ORA_SQLPLUS_DEMO:DEMOBLD.SQL
Use the ora_sqlplus_demo:demodrop.sql
script to drop the demonstration tables. In SQL*Plus, you can use any user name to drop the demonstration tables in the user's schema. For example, enter:
$ SQLPLUS SCOTT/TIGER SQL> @ORA_SQLPLUS_DEMO:DEMODROP.SQL
Note:
Both thedemobld.sql
and demodrop.sql
scripts drop the EMP
, DEPT
, BONUS
, SALGRADE
, and DUMMY
tables. Before you run the demobld.sql
script, ensure that these tables do not exist or are not in use for other purposes.This section describes how to install and remove SQL*Plus command line Help.
See Also:
SQL*Plus User's Guide and ReferenceIt contains the following topics:
There are three ways to install SQL*Plus command line Help:
Use Oracle Database Configuration Assistant.
You can use Oracle Database Configuration Assistant to create Help
tables when creating a database.
Install the Help facility manually.
Note:
Running this procedure drops any existing command lineHelp
tables before creating new tables.This section describes how to use SQL*Plus on OpenVMS systems. It contains the following topics:
If you enter an ED
or EDIT
command at the SQL*Plus prompt, then the system starts an operating system editor, such as EDT
or TPU
, depending on how the OpenVMS EDIT
symbol is defined.
When you start the editor, the current SQL buffer is placed in the editor. When you exit the editor, the changed SQL buffer is returned to SQL*Plus.
You can specify which editor starts by defining the SQL*Plus _EDITOR
variable. You can define this variable in the GLOGIN.SQL
site profile, the LOGIN.SQL
user profile, or define it during the SQL*Plus session. For example, to set the default editor to EDT
, enter:
SQL> DEFINE _EDITOR=EDT
If you start the editor, then SQL*Plus uses the AFIEDT.BUF
temporary file to pass text to the editor. You can use the SET EDITFILE
command to specify a different file name. For example:
SQL> SET EDITFILE test15:[tmp]myfile.sql
SQL*Plus does not delete the temporary file.
Using the HOST
command or a dollar sign ($) as the first character after the SQL*Plus prompt causes subsequent characters to be passed to a sub-process.
To return to SQL*Plus, enter LOGOUT
.
For example, to enter one command:
SQL> HOST SHOW DEFAULT
or
SQL> $ SHOW DEFAULT
To enter multiple operating system commands from SQL*Plus, enter the Host
or $
command, and press Enter. SQL*Plus returns you to the operating system prompt.
To return to SQL*Plus, enter:
$ LOGOUT
While running SQL*Plus, you can stop the scrolling record display and terminate a SQL statement by pressing Ctrl+C.
The SPOOL command causes output from all subsequent SQL commands to be captured in a specified file. The default file name extension of files generated by the SPOOL
command is .lis
. To change this extension, specify a spool file containing a period (.). For example, enter:
SQL> SPOOL QUERY.TXT