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

📄 ch18.htm

📁 Teach yourself Oracle8 in 21 day
💻 HTM
📖 第 1 页 / 共 3 页
字号:

	<P><B>9.</B> The Finish Snapshot Wizard screen (see Figure 18.28) summarizes all
	the operations to be performed. At this point you should review the snapshot-creation
	operation to determine whether all the options have been set up correctly. If you
	are satisfied, click OK.
</DL>

<P><A NAME="28"></A><A HREF="28.htm"><B>Figure 18.28.</B></A><B></B></P>
<P><I>The Finish Snapshot Wizard screen of the Snapshot wizard.</I></P>
<P>After the snapshot is configured, the database link refreshes the snapshot on
a regular basis. You can set many small details and options; I have not gone into
all of them here. Consult the Oracle documentation or the online help to better use
all the options. </P>

<P><FONT COLOR="#000077"><B>Configuring Using the <TT>CREATE SNAPSHOT</TT> Command</B>
</FONT></P>

<P>You can define a snapshot via the <TT>CREATE SNAPSHOT</TT> SQL statement, which
is sometimes more useful if the query is complex. Use the <TT>CREATE SNAPSHOT</TT>
command in conjunction with a query to create the snapshot-defining query. An example
of a defining query is shown in Listing 18.1.
<H4><FONT COLOR="#000000"><B>INPUT: </B></FONT><FONT COLOR="#000077"><B></B></FONT></H4>

<H4><FONT COLOR="#000077"><B>Listing 18.1. Creating a snapshot.</B></FONT></H4>
<PRE><FONT COLOR="#0066FF">CREATE SNAPSHOT etw.dogs AS
SELECT name, owner_name
FROM dogs, dog_owners
<TT>WHERE dogs.owner_id = dog_owner.id; </TT></FONT></PRE>
<P><B>ANLYSIS: </B></P>

<P>This creates a snapshot using a join between the <TT>dogs</TT> table and the <TT>dog_owners</TT>
table. This snapshot can then be used to set up replicated sites.
<H2><FONT COLOR="#000077"><B>Using Advanced Replication</B></FONT></H2>
<P>Advanced replication can be used for a variety of different uses: for remote disconnected
sites (portable computers), for distributing application loads, and to create failover
sites in the event of system failure. Oracle's advanced replication option does not
work in quite the same way as the snapshot-replication method. Because multiple sites
might be modifying data, it would not work to simply copy the database on a regular
basis. Instead, changes are saved and queued to be run on other replication sites.</P>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>Oracle replicates changes
on a row basis; this is known as <I>row-level replication</I>. These row changes
are saved and queued to run at a later time on the replicated systems. I suggest
that you read the Oracle documentation if you want a detailed description of the
steps taken to perform advanced replication.
<H3><FONT COLOR="#000077"><B>Using Advanced Replication for Disconnected Sites</B></FONT></H3>
<P>Advanced replication can be used in a disconnected environment where some of the
replicated systems are periodically disconnected and reconnected. For example, these
systems can be used with portable computers where they are used on the road (disconnected)
and reconnected to the network nightly via modem.</P>
<P>In this manner, the snapshot can be refreshed each night, causing the database
to be resynced with other masters. The portable data and the data on the home system
can be synced every night, providing the traveling user with regular updated access
to corporate data.
<H3><FONT COLOR="#000077"><B>Using Advanced Replication for Distributed Workloads</B></FONT></H3>
<P>When your database's workload is spread across different areas of the country,
it might be beneficial to use advanced replication to allow local access to your
corporate data. If the replicated databases are local, access times will be reduced
and the data will be available regardless of the state of the wide area network.</P>
<P>If you use advanced replication, each site can perform its own updates and the
changes can be propagated nightly to the other systems. There are a few problems,
however, if the same records are updated at multiple sites. You must address this
when you configure the conflict-resolution setup for advanced replication.</P>
<P>If your database handles a large number of updates that typically involve the
same records, replication might not be suitable for your configuration. But if you
have only a few updates, and if they do not typically involve the same data, replication
might be suitable.
<H3><FONT COLOR="#000077"><B>Using Advanced Replication for Quick Recoverability</B></FONT></H3>
<P>Advanced replication can serve a variety of different purposes, one of which is
quick recovery in the event of a catastrophic system failure. If you use the advanced
replication option, an entire database can be replicated. Not only can the database
be used during normal operations, but if one of the systems should happen to fail,
the users can use one of the available replicated sites.
<H2><FONT COLOR="#000077"><B>Using a Standby Database</B></FONT></H2>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>Another method sometimes
used for quick recovery is the Oracle standby database. A <I>standby database</I>
is a complete copy of your primary database, but it is constantly in recovery mode.
Each time a log switch occurs on your primary database, the archived log file is
applied to the standby database, bringing it up to date.</P>
<P>In the event of a catastrophic system failure, the standby database can be used
as the primary database. In the event of a failure on the primary system, you can
archive the current log files using the <TT>ALTER</TT> <TT>SYSTEM ARCHIVE LOG CURRENT</TT>
command. This creates an archive log file of the current redo log file. In this manner,
the standby database can be made current with the primary database.</P>
<P>The standby database is designed to be used only as a recovery mechanism. After
the standby database has been activated, it becomes the primary database. The original
database can later be re-created as the standby database, but you cannot switch back
to the original. More details on the standby database can be found in <I>Oracle8
Server Backup and Recovery Guide</I>.
<H2><FONT COLOR="#000077"><B>Using Read-Only Tablespaces</B></FONT></H2>
<P>By using read-only tablespaces in areas where updates are not necessary, you can
reduce downtime spent in recovery. Because the RDBMS knows that a tablespace marked
as read-only cannot be updated, the normal recovery process will be skipped. In the
event of media failure on the volume containing the read-only tablespace, you must
restore the damaged datafiles, but no instance recovery is necessary.</P>
<P>All tablespaces are created read-write and must be populated with data to be considered
useful. After the data and indexes have been created to your specifications, the
tablespace can be made read-only. This can happen in several ways. For example, Enterprise
Manager or Storage Manager can be used to modify a tablespace to be read-only, as
described in the previous section. Simply go to the Tablespace Modification screen,
shown in Figure 18.29, and click the Read Only box. Invoke this screen by selecting
the desired tablespace from the Storage Manager.</P>
<P><A NAME="29"></A><A HREF="29.htm"><B>Figure 18.29.</B></A><B></B></P>
<P><I>Making a tablespace read-only.</I></P>
<P>The tablespace can also be made read-only via the <TT>ALTER TABLESPACE</TT> command.
The syntax will look something like this:</P>
<PRE><FONT COLOR="#0066FF">ALTER TABLESPACE DOGS READONLY;
</FONT></PRE>
<P>There are several uses for the read-only tablespace, but they are fairly specific.
Whether you can take advantage of it depends on your applications. If you have a
large amount of static data that can be put on slower media, the read-only tablespace
might be advantageous. Also, if you want to guarantee that archival data is not modified,
a read-only tablespace might work.
<H2><FONT COLOR="#000077"><B>Summary</B></FONT></H2>
<P>Today you learned how Oracle replication works and how to configure it via Replication
Manager. You also learned a few ways to reduce downtime by using replication and
by using the standby database feature. You learned how using read-only tablespaces
can reduce the amount of time it takes to recover a tablespace, because Oracle knows
that no changes have been made to it.</P>
<P>Replication is a very specific option and is useful only in very specific cases.
If you can take advantage of replication with your system, you will see very good
results.
<H2><FONT COLOR="#000077"><B>What's Next?</B></FONT></H2>
<P>In tomorrow's lesson, &quot;Advanced Oracle Options,&quot; you will learn about
some of the advanced options available to Oracle, including the Oracle Parallel Server
(OPS) and Oracle Parallel Query options.</P>
<P>The Oracle Parallel Server option, an add-on feature, allows more than one instance
of Oracle to share the same database. This allows two or more systems to simultaneously
access the same data, providing a performance boost and failover capabilities. This
linking of systems to form one larger system has traditionally been called a <I>cluster</I>.</P>
<P>The Parallel Query option can provide a good-to-outstanding performance improvement
over traditional query operations by splitting some operations into multiple processes
or threads. Tomorrow you will learn how the Parallel Query option works and how to
use it.
<H3><FONT COLOR="#000077"><B>Q&amp;A</B></FONT></H3>

<DL>
	<DD><B>Q What is replication?</B>

	<P><B>A</B> Replication is a feature that allows a database or schema object(s) to
	be copied to another system.

	<P><B>Q What types of replication does Oracle offer?</B>

	<P><B>A</B> Oracle offers several types of replication: read-only table snapshots,
	updateable snapshots, and realtime data replication.

	<P><B>Q What is a standby database?</B>

	<P><B>A</B> The standby database is a database that is constantly in recovery mode,
	recovering archived log files from the primary database. In the event of a failure,
	the standby database can immediately substitute for the primary database.

	<P><B>Q How does a read-only tablespace help speed up recovery?</B>

	<P><B>A</B> Because a tablespace is marked read-only, Oracle knows that no instance
	recovery is necessary. That tablespace can then be skipped.
</DL>

<H2><FONT COLOR="#000077"><B>Workshop</B></FONT></H2>
<P>The workshop provides quiz questions to help you solidify your understanding of
the material covered and exercises to provide you with experience in using what you've
learned. Find answers to the quiz questions in Appendix A, &quot;Answers.&quot;
<H3><FONT COLOR="#000077"><B>Quiz</B></FONT></H3>

<DL>
	<DD><B>1. </B>What is a read-only table snapshot?<BR>
	<B></B>

	<P><B>2. </B>What is an updateable snapshot?<BR>
	<B></B>

	<P><B>3. </B>What is realtime data replication?<BR>
	<B></B>

	<P><B>4. </B>What is a master site?<BR>
	<B></B>

	<P><B>5. </B>What is a snapshot site?<BR>
	<B></B>

	<P><B>6. </B>What are some uses of read-only table snapshots?<BR>
	<B></B>

	<P><B>7.</B> What are some uses of advanced replication?<BR>
	<B></B>

	<P><B>8.</B> What is the difference between a complete refresh and a fast refresh?<BR>
	<B></B>

	<P><B>9.</B> What is a standby database used for?<BR>
	<B></B>

	<P><B>10. </B>Why would you use a read-only tablespace?
</DL>

<H3><FONT COLOR="#000077"><B>Exercises</B></FONT></H3>

<DL>
	<DD><B>1.</B> Use Replication Manager to set up a master site.<BR>
	<B></B>

	<P><B>2.</B> Use Replication Manager to set up a snapshot site.<BR>
	<B></B>

	<P><B>3. </B>Use Storage Manager to make a tablespace read-only.<BR>
	<B></B>

	<P><B>4. </B>Set that tablespace back to read-write.
</DL>

<H1></H1>
<CENTER>
<P>
<HR>
<A HREF="../ch17/ch17.htm"><IMG SRC="../buttonart/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch19/ch19.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> <BR>
<BR>
<BR>
<IMG SRC="../buttonart/corp.gif" WIDTH="284" HEIGHT="45" ALIGN="BOTTOM" ALT="Macmillan Computer Publishing USA"
BORDER="0"></P>

<P>&#169; <A HREF="../copy.htm">Copyright</A>, Macmillan Computer Publishing. All
rights reserved.
</CENTER>


</BODY>

</HTML>

⌨️ 快捷键说明

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