Skip Headers
Oracle® Database Administrator's Reference
10g Release 2 (10.2) for hp OpenVMS

Part Number B25416-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

4 Administering SQL*Plus

This chapter describes how to use and administer SQL*Plus on OpenVMS. It contains the following topics:

4.1 Administering Command-Line SQL*Plus

This section describes how to administer command-line SQL*Plus. It includes:

4.1.1 Using Setup Files

When you start SQL*Plus, it runs the GLOGIN.SQL site profile setup file and then runs the LOGIN.SQL user profile setup file.

4.1.1.1 Using the Site Profile 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.

4.1.1.2 Using the User Profile File

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 files

4.1.2 Using the PRODUCT_USER_PROFILE Table

During 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

4.1.3 Using Demonstration Tables

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 options

4.1.3.1 Performing a Typical Installation

During a Typical installation, the user SCOTT and the demonstration tables are created automatically.

4.1.3.2 Creating Demonstration Tables Manually

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

4.1.3.3 Deleting Demonstration Tables

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 the demobld.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.

4.2 SQL*Plus Command Line Help

This section describes how to install and remove SQL*Plus command line Help.

It contains the following topics:

4.2.1 Installing the SQL*Plus Command Line Help

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 line Help tables before creating new tables.

4.2.2 Removing SQL*Plus Command Line Help

You can also run the ORA_SQLPLUS:HELPDROP.SQL script in SQL*Plus to manually drop the command line Help tables in a schema. For example:

$ SQLPLUS SYSTEM/MANAGER
SQL> @ORA_ROOT:[SQLPLUS.ADMIN.HELP]HELPDROP.SQL

4.3 Using Command-Line SQL*Plus

This section describes how to use SQL*Plus on OpenVMS systems. It contains the following topics:

4.3.1 Using a System Editor from SQL*Plus

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.

4.3.2 Running Operating System Commands from SQL*Plus

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

4.3.3 Interrupting SQL*Plus

While running SQL*Plus, you can stop the scrolling record display and terminate a SQL statement by pressing Ctrl+C.

4.3.4 Using the SPOOL Command

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

4.4 SQL*Plus Restrictions

This section describes SQL*Plus restrictions. It contains the following topics:

4.4.1 Resizing Windows

The default values for SQL*Plus LINESIZE and PAGESIZE are not automatically adjusted for window size.

4.4.2 Return Codes

When exiting SQL*Plus and returning a status code back to the operating system with EXIT, WHENEVER OSERROR EXIT, or WHENEVER SQLERROR EXIT, OpenVMS return codes accept a positive 4 byte number in the range of 0 to 2147483647 (00000000 to 7FFFFFFF in hexadecimal).