📄 ch3_sql.htm
字号:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//en"
"http://www.w3c.org/TR/1999/PR-xhtml1-19991210/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" sml:lang="en" lang="en">
<head>
<!-- Run date = May 1, 2002 19:19:1 -->
<meta name="XHTML Generator" content="Oracle SGML to XHTML converter - Version 3.1.2">
<title> Administering SQL*Plus and iSQL*Plus </title>
<link rel="next" href="ch4_comp.htm" title="Next">
</head>
<body bgcolor="#ffffff">
<a id="top" name="top"></a>
<a href="#BEGIN">Skip Headers</a><br><br>
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="left" valign="top"><font face="helvetica, arial, sans-serif">
<b>Oracle9<em>i</em> Administrator's Reference </b>
<br />
<b>Release 2 (9.2.0.1.0) for UNIX Systems: AIX-Based Systems, Compaq Tru64 UNIX, HP 9000 Series HP-UX, Linux Intel, and Sun Solaris</b>
<br />
Part No. A97297-01
</font>
</td>
<td valign="bottom" align="right" width="144">
<table cellspacing="0" cellpadding="0" width="100%">
</tr>
<td align="center" valign="top" width="25%"><a href="toc.htm"><img src="../Support/gifs/conticon.gif" alt="Go To Table Of Contents" border="0" height="30" width="30"><br /><font size="-2">Contents</font></a></td>
<td align="center" valign="top" width="25%"><a href="index.htm"><img src="../Support/gifs/indxicon.gif" alt="Go To Index" border="0" height="30" width="30"><br /><font size="-2">Index</font></a></td>
</tr>
</table>
</td>
</tr>
</table>
<hr />
<p>
<a href="ch2_tun.htm">
<img src="../Support/gifs/larrow.gif" alt="Previous" border="0" height="30" width="30"></a>
<a href="ch4_comp.htm">
<img src="../Support/gifs/rarrow.gif" alt="Next" border="0" height="30" width="30"></a>
</p>
<a name="BEGIN"></a>
<div class="IND">
<!-- End Header --><a id="CHDJCHJI" name="CHDJCHJI"></a><a id="i8440" name="i8440"></a>
<h1>
<font face="arial, helvetica, sans-serif" color="#330099">
3
<br />
Administering SQL*Plus and <em>i</em>SQL*Plus
</font>
</h1>
<p>This chapter describes how to use and administer SQL*Plus and <em>i</em>SQL*Plus on Oracle9<em>i</em>. It contains the following sections:
</p>
<ul>
<li type="disc">
<p><a href="#i4981">Administering Command-Line SQL*Plus</a>
</p>
</li>
<li type="disc">
<p><a href="#CHDECGID">Administering <em>i</em>SQL*Plus</a>
</p>
</li>
<li type="disc">
<p><a href="#i2833">Using Command-Line SQL*Plus</a>
</p>
</li>
<li type="disc">
<p><a href="#i9455">SQL*Plus Restrictions</a>
</p>
<div align="center">
<br /><table summary="This is a layout table to format a note" title="This is a layout table to format a note" dir="ltr" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"><tbody>
<tr>
<td align="left" colspan="1" rowspan="1">
<p>
<font face="arial, helvetica, sans-serif">
<strong>See Also:</strong>
</font>
</p><em>SQL*Plus Users Guide and Reference</em> for more information on <em>i</em>SQL*Plus and SQL*Plus.
</td>
</tr></tbody>
</table><br />
</div>
</li>
</ul><a id="i4981" name="i4981"></a>
<div class="sect1">
<!--
infolevel=all
infotype=general
--><a id="sthref395" name="sthref395"></a>
<h2>
<font face="arial, helvetica, sans-serif" color="#330099">Administering Command-Line SQL*Plus<a id="sthref396" name="sthref396"></a>
</font>
</h2>
<p>This section describes how to administer command-line SQL*Plus. In the examples in this section, SQL*Plus uses the value of the ORACLE_HOME environment variable wherever a question mark (<code>?</code>) appears.
</p>
<div class="sect2">
<!--
infolevel=all
infotype=general
--><a id="sthref397" name="sthref397"></a>
<h3>
<font face="arial, helvetica, sans-serif" color="#330099">
Using Setup Files<a id="sthref398" name="sthref398"></a><a id="sthref399" name="sthref399"></a>
</font>
</h3>
<p>When you start SQL*Plus, it executes the <code>glogin.sql</code> site profile set-up file and then executes the <code>login.sql</code> user profile set-up file.
</p>
<div class="sect3">
<!--
infolevel=all
infotype=general
--><a id="sthref400" name="sthref400"></a>
<h4>
<font face="arial, helvetica, sans-serif" color="#330099">
Using the Site Profile<a id="sthref401" name="sthref401"></a><a id="sthref402" name="sthref402"></a> File
</font>
</h4>
<p>The global site profile file is <code>$ORACLE_HOME/sqlplus/admin/glogin.sql</code>. If a site profile already exists at this location, it is overwritten when you install SQL*Plus. If SQL*Plus is removed, the site profile file is deleted.
</p>
</div class="sect3">
<div class="sect3">
<!--
infolevel=all
infotype=general
--><a id="sthref403" name="sthref403"></a>
<h4>
<font face="arial, helvetica, sans-serif" color="#330099">
Using the User Profile<a id="sthref404" name="sthref404"></a><a id="sthref405" name="sthref405"></a><a id="sthref406" name="sthref406"></a> File
</font>
</h4>
<p>The user profile file is <code>login.sql</code>. SQL*Plus looks for this file in the current directory, and then in the directories you specify using the SQLPATH environment variable. Set this environment variable to a colon-separated list of directories. SQL*Plus searches these directories for the <code>login.sql</code> file in the order they are listed.
</p>
<p>The options set in the <code>login.sql</code> file override those set in the <code>glogin.sql</code> file.
</p>
<div align="center">
<br /><table summary="This is a layout table to format a tip" title="This is a layout table to format a tip" dir="ltr" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"><tbody>
<tr>
<td align="left" colspan="1" rowspan="1">
<p>
<font face="arial, helvetica, sans-serif">
<strong>See Also:</strong>
</font>
</p><em>SQL*Plus User's Guide and Reference</em> for more information on profile files.
</td>
</tr></tbody>
</table><br />
</div>
</div class="sect3">
</div class="sect2">
<div class="sect2">
<!--
infolevel=all
infotype=general
--><a id="sthref407" name="sthref407"></a>
<h3>
<font face="arial, helvetica, sans-serif" color="#330099">
Using the PRODUCT_USER_PROFILE Table<a id="sthref408" name="sthref408"></a><a id="sthref409" name="sthref409"></a>
</font>
</h3>
<p>Oracle9<em>i</em> provides the PRODUCT_USER_PROFILE table that you can use to disable the SQL and SQL*Plus commands that you specify. This table is created automatically when you choose an installation type that installs a starter database. A started database is not installed, and demonstration tables are not created, in the following circumstances:
</p>
<ul>
<li type="disc">
<p>If you select the Software Only database configuration option
</p>
</li>
<li type="disc">
<p>If you do not select the Demo Schemas option during a Custom installation
</p>
</li>
</ul>
<br /><table summary="This is a layout table to format a tip" title="This is a layout table to format a tip" dir="ltr" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"><tbody>
<tr>
<td align="left" colspan="1" rowspan="1">
<p>
<font face="arial, helvetica, sans-serif">
<strong>See Also:</strong>
</font>
</p><em>Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems</em> for information on installation options.
</td>
</tr></tbody>
</table><br />
<p>To recreate the PRODUCT_USER_PROFILE table, run the <code>$ORACLE_HOME/sqlplus/admin/pupbld.sql</code> script in the SYSTEM schema:
</p>
<pre>$<em>ORACLE_HOME</em>/sqlplus/admin/pupbld.sql
</pre>
<p>For example, enter the following commands, where <em><code>SYSTEM_PASSWORD</code></em> is the password of the SYSTEM user:
</p>
<pre>$ sqlplus SYSTEM/<em>SYSTEM_PASSWORD</em>
SQL> @?/sqlplus/admin/pupbld.sql
</pre>
<p>You can also recreate the PRODUCT_USER_PROFILE table manually in the SYSTEM schema using the <code>$ORACLE_HOME/bin/pupbld</code> shell script. This script prompts for the SYSTEM password. If you need to run the <code>pupbld</code> script without interaction, set the SYSTEM_PASS environment variable to the SYSTEM username and password. For example, enter the following command where <em><code>SYSTEM_PASSWORD</code></em> is the password of the SYSTEM user:
</p>
<pre>$ SYSTEM_PASS=SYSTEM/<em><code>SYSTEM_PASSWORD</code></em>; export SYSTEM_PASS
</pre>
</div class="sect2"><a id="i2869" name="i2869"></a>
<div class="sect2">
<!--
infolevel=all
infotype=general
--><a id="sthref410" name="sthref410"></a>
<h3>
<font face="arial, helvetica, sans-serif" color="#330099">
Using Demonstration Tables<a id="sthref411" name="sthref411"></a><a id="sthref412" name="sthref412"></a>
</font>
</h3>
<p>Oracle9<em>i</em> provides demonstration tables that you can use for testing. These demonstration tables are created automatically when you choose an installation type that installs a starter database. A started database is not installed, and demonstration tables are not created, in the following circumstances:
</p>
<ul>
<li type="disc">
<p>If you select the Software Only database configuration option
</p>
</li>
<li type="disc">
<p>If you do not select the Demo Schemas option during a Custom installation
</p>
</li>
</ul>
<div align="center">
<br /><table summary="This is a layout table to format a note" title="This is a layout table to format a note" dir="ltr" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"><tbody>
<tr>
<td align="left" colspan="1" rowspan="1">
<p>
<font face="arial, helvetica, sans-serif">
<strong>See Also:</strong>
</font>
</p><em>Oracle9i Sample Schemas</em> guide for information on demonstration tables and the <em>Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems</em> for information on installation options.
</td>
</tr></tbody>
</table><br />
</div>
</div class="sect2">
<div class="sect2"><a id="sthref413" name="sthref413"></a>
<h3>
<font face="arial, helvetica, sans-serif" color="#330099">
Using EMP and DEPT Tables
</font>
</h3>
<p>This section describes how to manually create and delete the EMP and DEPT demonstration tables.
</p>
<div class="sect3">
<!--
infolevel=all
infotype=general
--><a id="sthref414" name="sthref414"></a>
<h4>
<font face="arial, helvetica, sans-serif" color="#330099">
Creating Demonstration Tables Manually<a id="sthref415" name="sthref415"></a>
</font>
</h4>
<p>Use the <code>$ORACLE_HOME/sqlplus/demo/demobld.sql</code> SQL script to create the EMP and DEPT demonstration tables. In SQL*Plus, you can use any username to run the <code>demobld.sql</code> script to create the demonstration tables in a schema. For example, enter:
</p>
<pre>$ sqlplus SCOTT/TIGER
SQL> @?/sqlplus/demo/demobld.sql
</pre>
<p>You can also use the <code>$ORACLE_HOME/bin/demobld</code> shell script to run the <code>demobld.sql</code> script, as follows:
</p>
<pre>$ demobld SCOTT TIGER
</pre>
</div class="sect3">
<div class="sect3">
<!--
infolevel=all
infotype=general
--><a id="sthref416" name="sthref416"></a>
<h4>
<font face="arial, helvetica, sans-serif" color="#330099">
Deleting Demonstration Tables<a id="sthref417" name="sthref417"></a>
</font>
</h4>
<p>Use the <code>$ORACLE_HOME/sqlplus/demo/demodrop.sql</code> script to drop the EMP and DEPT demonstration tables. In SQL*Plus, you can use any username to drop the demonstration tables from the user's schema. For example, enter:
</p>
<pre>$ sqlplus SCOTT/TIGER
SQL> @?/sqlplus/demo/demodrop.sql
</pre>
<p>You can also use the <code>$ORACLE_HOME/bin/demodrop</code> shell script to run the <code>demodrop.sql</code> script, as follows:
</p>
<pre>$ demodrop SCOTT TIGER
</pre>
</div class="sect3">
</div class="sect2">
<div class="sect2">
<!--
infolevel=all
infotype=general
--><a id="sthref418" name="sthref418"></a>
<h3>
<font face="arial, helvetica, sans-serif" color="#330099">
SQL*Plus Command-Line Help<a id="sthref419" name="sthref419"></a>
</font>
</h3>
<p>This section describes how to install and remove the SQL*Plus command-line help.
</p>
<div align="center">
<br /><table summary="This is a layout table to format a tip" title="This is a layout table to format a tip" dir="ltr" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"><tbody>
<tr>
<td align="left" colspan="1" rowspan="1">
<p>
<font face="arial, helvetica, sans-serif">
<strong>See Also:</strong>
</font>
</p><em>SQL*Plus User's Guide and Reference</em> for more information on the SQL*Plus command-line help.
</td>
</tr></tbody>
</table><br />
</div>
</div class="sect2">
<div class="sect2">
<!--
infolevel=all
infotype=general
--><a id="sthref420" name="sthref420"></a>
<h3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -