📄 ch05.htm
字号:
5.21.</P>
<P><A NAME="21"></A><A HREF="21.htm"><B>Figure 5.21.</B></A></P>
<P><I>Changing the startup type to Manual.</I></P>
<P>This invokes the Oracle bootstrap instance at startup, but does not start the
main Oracle instance. This can be accomplished as shown in the next section.</P>
<H3><FONT COLOR="#000077"><B>Starting the Instance with Enterprise Manager</B></FONT></H3>
<P>After the bootstrap instance has been created, you can use Enterprise Manager's
Instance Manager to start up and shut down the instance. Invoke the Instance Manager
by clicking the Instance tab on the Oracle Enterprise Manager toolbar or through
the Enterprise Manager program group, or by using Enterprise Manager. You will be
presented with the Instance Manager user information screen shown in Figure 5.22.</P>
<P><A NAME="22"></A><A HREF="22.htm"><B>Figure 5.22.</B></A></P>
<P><I>The Instance Manager Login Information screen.</I></P>
<P>Here you need to log on with the <TT>internal</TT> username and the appropriate
password. If you are connecting to an instance that is not the default instance as
assigned in the NT Registry, you should specify the service that connects to the
desired Oracle instance.</P>
<P>After you connect, you will see the Instance Manager startup screen on the right
side and database information screen on the left side, as shown in Figure 5.23. In
this example, you will see that the Oracle instance is currently not up.</P>
<P><A NAME="23"></A><A HREF="23.htm"><B>Figure 5.23.</B></A></P>
<P><I>The Instance Manager main screen provides information about the state of the
instance.</I></P>
<P>To get to the Startup screen, click the Startup tab on the right side of the screen;
you will then see the Startup screen, shown in Figure 5.24.</P>
<P>From this screen, you can specify the startup options. The available options are
<UL>
<LI>No Mount--Starts the instance but does not mount a database.
<P>
<LI>Mount--Starts the instance and mounts the database, but does not open the database.
<P>
<LI>Mount and Open (default)--Starts, mounts, and opens the database.
</UL>
<P><A NAME="24"></A><A HREF="24.htm"><B>Figure 5.24.</B></A></P>
<P><I>The Startup screen.</I></P>
<UL>
<LI>Force--Forces the startup, even if there are problems.
</UL>
<UL>
<LI>Restrict--Starts the database in restricted mode. Only users with <TT>RESTRICT
SESSION</TT> privilege can access the database.
</UL>
<P>You also have the option of accessing an internally saved configuration file (available
only if the instance is started), or specifying a parameter file. Specifying the
parameter file allows you to use the parameter file you created for this instance.
This is covered in more detail on Day 6.</P>
<P>Clicking the Startup button starts the Oracle instance with the options you have
specified.</P>
<H2><FONT COLOR="#000077"><B>Starting the Instance with Server Manager</B></FONT></H2>
<P>From Server Manager or from a SQL script, you can use the command <TT>STARTUP</TT>.</P>
<H3><FONT COLOR="#000077"><B>The Syntax for <TT>STARTUP</TT></B></FONT></H3>
<P>The <TT>STARTUP</TT> command is used to start an Oracle instance and has the following
syntax:</P>
<P><B>SYNTAX:</B></P>
<PRE><FONT COLOR="#0066FF">STARTUP
[PFILE=parameter_file]
[MOUNT or NOMOUNT]
[PEN]
[EXCLUSIVE]
[RESTRICT]
[FORCE]
[RECOVER]
</FONT></PRE>
<P>These options, which are approximately the same as with the Instance Manager described
previously, are
<UL>
<LI><TT>PFILE=</TT>parameter_file--This specifies which parameter file to use. This
file is often referred to as the <TT>init.ora</TT> file.
<P>
<LI><TT>NOMOUNT</TT>--Starts the instance but does not mount a database.
<P>
<LI><TT>MOUNT </TT>database<TT>]</TT>--Starts the instance and mounts the database
named database, but does not open the database.
<P>
<LI><TT>OPEN </TT>database<TT>]</TT>--Starts, mounts, and opens the database named
database. This is the default parameter.
<P>
<LI><TT>FORC</TT>--Forces the startup, even if there are problems.
<P>
<LI><TT>RESTRICT</TT>--Starts the database in restricted mode. Only users with <TT>RESTRICT
SESSION</TT> privilege can access the database.
<P>
<LI><TT>EXCLUSIV</TT>E--Allows only one instance to mount the database.
<P>
<LI><TT>PARALLE</TT>/<TT>SHARED</TT> --These parameters are synonymous. They allow
multiple instances to mount the database in a parallel-server environment. This parameter
has an additional qualifier, <TT>RETRY</TT>, which specifies that if a database is
busy being recovered by another instance, this instance will try to open the database
every five seconds.
</UL>
<P>As you can see, the startup options are the same whether you are using the Instance
Manager or the character-based Server Manager. The advantage of using Server Manager
is that this can be scripted into the same file as the database-creation scripts.</P>
<H2><FONT COLOR="#000077"><B>Shutting Down the Instance</B></FONT></H2>
<P>Because much of the data that has been changed in the Oracle database might still
be residing in the database buffer cache, a disorderly database shutdown can result
in a significant recovery period when the database is started up again. To avoid
this, an orderly shutdown should always be performed. Four different types of shutdowns
can be performed by Oracle:
<UL>
<LI>Normal--This type of shutdown is by far the most highly recommended way to shut
down the instance. Once a normal shutdown has been initiated, no new users can log
on to the database and the instance will wait until all users have disconnected before
the instance is terminated.
<P>
<LI>Immediate--With an immediate shutdown, all currently active transactions are
terminated and any uncommitted transactions are rolled back. All connected users
are simultaneously disconnected from the instance. Upon completion of these tasks,
the Oracle instance is terminated.
<P>
<LI>Transactional--The transactional option allows currently running transactions
to complete. As soon as a transaction has completed or aborted, the connection is
terminated. During this time, no new connections are allowed.
<P>
<LI>Abort--The abort shutdown essentially aborts the instance. All activity is terminated,
and the instance aborted. The result of an abort shutdown is a database recovery
on startup.
</UL>
<P>The abort shutdown should be used only as a last resort when no other options
are available. The immediate shutdown should be used only when it is critical that
the instance be shut down as soon as possible. You will typically use the normal
shutdown option.</P>
<P>Similar to the instance startup, the instance shutdown can be done graphically
(through Enterprise Manager's tools) or via the character-based Server Manager. Both
options are presented here.</P>
<H3><FONT COLOR="#000077"><B>Shutting Down the Instance Automatically</B></FONT></H3>
<P>The Oracle instance can be configured to start automatically when the NT Server
is booted, as shown previously. When the instance is configured this way, NT automatically
shuts down services that were automatically started. In this way, you might see quite
a delay when shutting down NT, but an orderly database shutdown is occurring.</P>
<H3><FONT COLOR="#000077"><B>Shutting Down the Instance with the Instance Manager</B></FONT></H3>
<P>From the Instance Manager, click the Shutdown tab on the right side of the screen.
This invokes the Shutdown screen shown in Figure 5.25.</P>
<P><A NAME="25"></A><A HREF="25.htm"><B>Figure 5.25.</B></A></P>
<P><I>The Shutdown screen.</I></P>
<P>Here you can choose Normal, Immediate, or Abort. Normal is the preferred option,
although in the event of an urgent shutdown, the Immediate option should be selected.
<TT>SHUTDOWN ABORT</TT> should be used only as a last resort.</P>
<H3><FONT COLOR="#000077"><B>Shutting Down the Instance with Server Manager</B></FONT></H3>
<P>Shutting down the database with Server Manager can be accomplished through the
use of the <TT>SHUTDOWN</TT> command. This can be useful when you want to shut down
the instance from within a script.</P>
<H4><FONT COLOR="#000077"><B>The Syntax for <TT>SHUTDOWN</TT></B></FONT></H4>
<P>The <TT>SHUTDOWN</TT> command is used to shut down an Oracle instance and has
the following syntax:</P>
<P><B>SYNTAX:</B></P>
<PRE><FONT COLOR="#0066FF">SHUTDOWN
[NORMAL]
or [IMMEDIATE]
or [TRANSACTIONAL]
or [ABORT]
</FONT></PRE>
<P>These options, approximately the same as with the Instance Manager, are
<UL>
<LI><TT>NORMAL</TT>--The default option. Shuts down the instance normally.
<P>
<LI><TT>IMMEDIATE</TT>--Shuts down the instance immediately, as described previously.
<P>
<LI><TT>TRANSACTIONAL</TT>--Allows currently running transactions to complete and
shuts down the instance, as described previously.
<P>
<LI><TT>ABORT</TT>--Aborts the instance, as described previously.
</UL>
<P>I like using the <TT>SHUTDOWN</TT> command from Server Manager when I am scripting
an operation such as a database creation. In this way, the entire procedure can be
scripted.</P>
<H2><FONT COLOR="#000077"><B>Configuring the Network</B></FONT></H2>
<P>After the instance has been created, you must configure the network so you can
connect to it. The network configuration serves two purposes:
<UL>
<LI>To allow a remote process to connect to the database. This is done via the <TT>LISTENER.ORA</TT>
configuration. This is essentially the server side of your network configuration.
</UL>
<UL>
<LI>To allow a connection into the instance via an alias. In this manner, you can
connect to various databases with different SID values by connecting to the service
that points to that SID. There are two ways to configure the network service: through
the Network Topology Generator that comes with Enterprise Manager, or through the
Oracle Network Configuration wizard that comes with Oracle for NT.
</UL>
<P>Let's look at the <TT>LISTENER.ORA</TT> configuration, then at the client-side
configuration.</P>
<H3><FONT COLOR="#000077"><TT><B>LISTENER.ORA</B></TT><B> Configuration</B></FONT></H3>
<P>The <TT>LISTENER.ORA</TT> file is created for each network protocol at installation
time. This file defines not only the network protocols, but the Oracle SIDs that
can be accessed through the listener. By default, the SID defined in the <TT>LISTENER.ORA</TT>
file is <TT>ORAC</TT> (from the starter database). The initial <TT>LISTENER.ORA</TT>
file looks like this:</P>
<PRE><FONT COLOR="#0066FF"> 1: ################
2: # Filename......: listener.ora
3: # Node..........: local.world
4: # Date..........: 24-MAY-94 13:23:20
5: ################
6: LISTENER =
7: (ADDRESS_LIST =
8: (ADDRESS=
9: (PROTOCOL= IPC)
10: (KEY= oracle.world)
11: )
12: (ADDRESS=
13: (PROTOCOL= IPC)
14: (KEY= ORCL)
15: )
16: (ADDRESS=
17: (COMMUNITY= NMP.world)
18: (PROTOCOL= NMP)
19: (SERVER= EDW)
20: (PIPE= ORAPIPE)
21: )
22: (ADDRESS=
23: (COMMUNITY= TCP.world)
24: (PROTOCOL= TCP)
25: (Host= edw)
26: (Port= 1521)
27: )
28: (ADDRESS=
29: (COMMUNITY= TCP.world)
30: (PROTOCOL= TCP)
31: (Host= edw)
32: (Port= 1526)
33: )
34: )
35: STARTUP_WAIT_TIME_LISTENER = 0
36: CONNECT_TIMEOUT_LISTENER = 10
37: TRACE_LEVEL_LISTENER = ADMIN
38: SID_LIST_LISTENER =
39: (SID_LIST =
40: (SID_DESC =
41: (SID_NAME = ORCL)
42: )
43: )
44: PASSWORDS_LISTENER = (oracle)
</FONT></PRE>
<P>To add an additional SID onto the SID list, simply copy the section of the <TT>LISTENER.ORA</TT>
that describes the SID as shown here and paste it to the <TT>LISTENER.ORA</TT> file
after the <TT>ORCL</TT> SID definition. The following should be placed on line 43:</P>
<PRE><FONT COLOR="#0066FF">(SID_DESC =
(SID_NAME = ORCL)
)
</FONT></PRE>
<P>Be sure to keep the parentheses correct. Change the SID value to the value of
the SID that you have added to your system.</P>
<H2><FONT COLOR="#000077"><B>Oracle Net8 Easy Config</B></FONT></H2>
<P>In order to administer the <TT>TNSNAMES.ORA</TT> file, you can use the Oracle
Net8 Easy Config utility found in the Oracle for NT tools:
<DL>
<DD><B>1. </B>When you invoke the Net8 Easy Config utility, you will be greeted with
the main screen of the Oracle Service Name wizard. From here you can choose to create
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -