⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch11.htm

📁 Teach yourself Oracle8 in 21 day
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>

<HEAD>

	<TITLE>Teach Yourself Oracle 8 In 21 Days -- Ch 11 -- Managing Processes</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF">

<CENTER>
<H1><IMG SRC="../buttonart/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"><BR>
<FONT COLOR="#000077">Teach Yourself Oracle 8 In 21 Days</FONT></H1>
</CENTER>
<CENTER>
<P><A HREF="../ch10/ch10.htm"><IMG SRC="../buttonart/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch12/ch12.htm"><IMG
SRC="../buttonart/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../buttonart/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> 
<HR>

</CENTER>
<CENTER>
<H1><FONT COLOR="#000077">- Day 11-<BR>
Managing Processes</FONT></H1>
</CENTER>
<P>Today you'll learn about processes, or threads that are used in the NT instance.
You'll see how to identify, monitor, and kill a process or thread.</P>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>The term <I>process</I> is
used in this book to describe a thread of execution, or a mechanism that can execute
a set of code. In many operating systems, <I>processes</I> has been replaced with
<I>threads</I> or <I>lightweight</I> <I>processes</I>. To minimize confusion, the
term <I>process</I> refers to the mechanism of execution and can refer to either
a traditional process or a thread.</P>
<P>First you'll review how the Oracle processes work and what they do. You'll examine
a bit of the terminology and the function of the Oracle8 instance. Later you'll see
how to monitor the processes. You'll spend the remainder of this lesson on one of
my favorite topics: the Oracle Parallel Query option.
<H2><FONT COLOR="#000077"><B>Understanding the Oracle8 Processes</B></FONT></H2>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>The Oracle RDBMS uses two
types of processes: the user processes (also known as the <I>shadow</I> or <I>server</I>
<I>processes</I>) and the Oracle processes (also known as <I>background</I> <I>processes</I>).
In some operating systems, such as Windows NT, these processes are actually threads;
for consistency, I will refer to them as <I>processes</I>.</P>
<P>User, or client, processes are the user's connections into the RDBMS system. The
user process manipulates the user's input and communicates with the Oracle server
process through the Oracle program interface. The user process is also used to display
the information requested by the user and, if necessary, can process this information
into a more useful form.
<H3><FONT COLOR="#000077"><B>Background Processes</B></FONT></H3>
<P>Background processes are the Oracle processes used to perform various tasks within
the RDBMS system. These tasks vary from communicating with other Oracle instances
and performing system maintenance and cleanup to writing dirty blocks to disk. The
nine Oracle processes are DBWR, LGWR, CKPT, PMON, SMON, RECO, ARCH, LCK<I>n</I>,
and D<I>nnn</I>. Refer to Day 2, &quot;Exploring the Oracle Architecture,&quot; for
descriptions of these processes.</P>
<P>With Windows NT, these processes are implemented as threads. Because the Oracle
threads are listed by number, you cannot readily distinguish which thread is which.
So you can cross-reference them, the Oracle threads are listed in Table 11.1.
<H4><FONT COLOR="#000077"><B>Table 11.1. Oracle service threads.</B></FONT></H4>
<P>
<TABLE BORDER="1">
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT"><B>Thread number</B></TD>
		<TD ALIGN="LEFT"><B>Oracle process</B></TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT">0, 1</TD>
		<TD ALIGN="LEFT">Oracle service</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT">2</TD>
		<TD ALIGN="LEFT">PMON</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT">3</TD>
		<TD ALIGN="LEFT">DBWR</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT">4</TD>
		<TD ALIGN="LEFT">LGWR</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT">5</TD>
		<TD ALIGN="LEFT">SMON</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT">6</TD>
		<TD ALIGN="LEFT">RECO</TD>
	</TR>
</TABLE>

<H3><FONT COLOR="#000077"><B>Server Processes (Shadow Processes)</B></FONT></H3>
<P>The server, or shadow, processes communicate with the user and interact with Oracle
to carry out the user's requests. For example, if the user process requests a piece
of data not already in the SGA, the shadow process is responsible for reading the
data blocks from the datafiles into the SGA.</P>
<P>There can be a one-to-one correlation between the user processes and the shadow
processes (as in a dedicated server configuration). Although one shadow process can
connect to multiple user processes (as in a multithreaded server configuration),
doing so reduces the utilization of system resources.</P>
<P>Each shadow process or thread uses a certain amount of Oracle and OS resources.
Specifically, each shadow process uses approximately 1MB of memory. This memory and
the overhead of managing large numbers of processes create quite a load on the system.
Therefore, you should reduce the number of user connections if possible.
<H4><FONT COLOR="#000077"><B>Multiplexing Processes</B></FONT></H4>
<P>Because the load incurred by large numbers of user processes can be quite heavy
on the system, measures should be taken to reduce this number. Several different
methods that involve multiplexing the connections into the Oracle instance can be
used to reduce the user load.</P>
<P>Multiplexing involves reducing the number of connections. On one side of the multiplexor,
each process or user might have its own connection On the other side, many processes
or users might share the same connections. Let's look at a multiplexor as a gray
box, as shown in Figure 11.1.</P>
<P><A NAME="01"></A><A HREF="01.htm"><B>Figure 11.1.</B></A></P>
<P><I>The logical view of a multiplexor.</I></P>
<P>In its simplest form, the multiplexor reduces a large number of connections to
a smaller number of connections. The multiplexing can be done on the server itself,
but in general, the multiplexing is done on another server.</P>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A system that has a middle
server to handle connection processing is typically called a <I>three-tier</I> <I>system</I>.
If you are directly connecting all the users from client systems to the database
server, this is known as a <I>two-tier</I> <I>system</I>.</P>
<P>An example of a two-tier system is shown in Figure 11.2. As you can see, a number
of network client systems are connected to the database server via a LAN.</P>
<P><A NAME="02"></A><A HREF="02.htm"><B>Figure 11.2.</B></A></P>
<P><I>The two-tier system.</I></P>
<P>The two-tier system directly links the user connections (via a LAN) into the Oracle
instance via the server processes. If you are using the multithreaded server, the
server processes might be reduced but the LAN connections into the server are still
there for all of the users. This is shown as a logical view in Figure 11.3.</P>
<P><A NAME="03"></A><A HREF="03.htm"><B>Figure 11.3.</B></A></P>
<P><I>The two-tier system logical view.</I></P>
<P>In the logical view, you can see more clearly that there is a one-to-one relationship
between the users and the connections into the Oracle instance. As I mentioned earlier,
these connections can be quite expensive.


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>In computer system performance language,
	a process is said to be <I>expensive</I> if it consumes a relatively large amount
	of system resources. 
<HR>


</BLOCKQUOTE>

<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>In a three-tier system, a
middleware system is used to handle much of the overhead involved in handling user
connections and large numbers of processes. This <I>middleware</I> can be in the
form of a transaction monitor (TM) or an application. An example of a three-tier
system is shown in Figure 11.4.</P>
<P><A NAME="04"></A><A HREF="04.htm"><B>Figure 11.4.</B></A></P>
<P><I>The three-tier system.</I></P>
<P>This looks very similar to the two-tier system when you look at the physical layer,
but when you look at the logical picture of this system, as shown in Figure 11.5,
you can see that the number of connections into the RDBMS has been greatly reduced.
Because each connection is expensive in CPU and memory, this savings can improve
the performance of your system.</P>
<P><A NAME="05"></A><A HREF="05.htm"><B>Figure 11.5.</B></A></P>
<P><I>The three-tier system logical view.</I></P>
<P>The three-tier system is becoming quite popular and will likely become more so.
In fact, Microsoft released a middleware component in 1997 called the Microsoft Transaction
Server. Other transaction monitors in use today include Tuxedo, Encina, and TopEnd.
Many of these products have been around for years.</P>
<P>Transaction monitors have typically been used in mid-range to high-end systems,
but with the popularity of PC servers, you'll see more and more multiplexing done
in this area as well.
<H2><FONT COLOR="#000077"><B>Dedicated Versus Multithreaded Server Processes</B></FONT></H2>
<P>As mentioned previously, the user connection into the Oracle instance can occur
via a dedicated server process or a multithreaded server process. In either case,
they appear and act identically to the end user under most conditions.</P>
<P>There are a few situations when it is necessary to connect via the dedicated server
process:

<UL>
	<LI>To start up and shut down an instance
	<P>
	<LI>To perform media recovery
	<P>
	<LI>To run a batch job
</UL>

<P>Under these conditions, the system must use a dedicated server process. Forcing
a dedicated server process under other conditions is described a bit later.
<H3><FONT COLOR="#000077"><B>Dedicated Server</B></FONT></H3>
<P>When a SQL request from a user is sent to the RDBMS, the server process executes
that command. This mechanism protects Oracle from being directly manipulated by a
user process. This actually increases the stability and robustness of the Oracle8
RDBMS. A diagram of the dedicated server process is shown in Figure 11.6.</P>
<P><A NAME="06"></A><A HREF="06.htm"><B>Figure 11.6.</B></A></P>
<P><I>The dedicated server process.</I></P>
<P>With a dedicated server process, there is a one-to-one correlation between the
user process and the server process. Each server process is dedicated to one user
process. To request a dedicated server process when the system is running with the
multithreaded server enabled, include the parameter <TT>SRVR=DEDICATED</TT> in the
connect string. This will create a dedicated server process for that user process.
<H3><FONT COLOR="#000077"><B>Multithreaded Server</B></FONT></H3>
<P>The multithreaded server process allows many user processes to share a number
of shared server processes. This is diagrammed in Figure 11.7.</P>
<P><A NAME="07"></A><A HREF="07.htm"><B>Figure 11.7.</B></A></P>
<P><I>The multithreaded server process.</I></P>
<P>As you can see, all requests to the shared server processes must go through the
dispatcher process, which in turn queues the request in the shared pool in the SGA.
Once the request has been processed, it is returned to the dispatcher through the
shared pool in the SGA.


<BLOCKQUOTE>
	<P>
<HR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -