Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Redo logs and rollback segments difference ?

Re: Redo logs and rollback segments difference ?

From: <iolo_at_my-dejanews.com>
Date: Thu, 30 Jul 1998 13:22:55 GMT
Message-ID: <6pps3f$pci$1@nnrp1.dejanews.com>


In article <35C03AF3.2050_at_platinum.com>,   Jean-Francois Vincent <jf.vincent_at_platinum.com> wrote:
> Hello, i wonder what is the conceptual difference beetween redo log and
> rollback segments under ORACLE. It seems the both contains transactions
> bring possibility to rollback transaction, i guess transaction are
> written twice in rollback and in redo log. Am i right ?
> Can you explain me in detail the difference of each one ?
> thank you very much.
>
> J-Fr.
>

Salut Jean-François,

Redo Log Files

Every Oracle database has a set of two or more redo log files. The set of redo log files for a database is collectively known as the database's redo log. The primary function of the redo log is to record all changes made to data. Should a failure prevent modified data from being permanently written to the datafiles, the changes can be obtained from the redo log and work is never lost.

Redo log files are critical in protecting a database against failures. To protect against a failure involving the redo log itself, Oracle allows a multiplexed redo log so that two or more copies of the redo log can be maintained on different disks.

The Use of Redo Log Files

*The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to a database's datafiles.* !!!

For example, if an unexpected power outage abruptly terminates database operation, data in memory cannot be written to the datafiles and the data is lost. However, any lost data can be recovered when the database is opened, after power is restored. By applying the information in the most recent redo log files to the database's datafiles, Oracle restores the database to the time at which the power failure occurred.

The process of applying the redo log during a recovery operation is called *rolling forward.*


Rollback Segment

One or more rollback segments are created by the database administrator for a database to temporarily store "undo"
information. This information is used:

          Read Consistency

          Read consistency, as supported by Oracle, does the following:

  guarantees that the set of data seen by a statement is consistent with respect to a single point-in-time and does not change during statement execution (statement-level read consistency)

  ensures that readers of database data do not wait for writers or other readers of the same data

  ensures that writers of database data do not wait for readers of the same data

  ensures that writers only wait for other writers if they attempt to update identical rows in concurrent transactions

               The simplest way to think of Oracle's implementation of read
               consistency is to imagine each user operating a private copy of
               the database, hence the multiversion consistency model.

          Read Consistency, Rollback Segments, and Transactions

  To manage the multiversion consistency model, Oracle must create a read-consistent set of data when a table is being queried (read) and simultaneously updated (written). When an update occurs, the original data values changed by the update are recorded in the database's rollback segments. As long as this update remains part of an *uncommitted transaction*, any user that later queries the modified data views the original data values

  Oracle uses current information in the system global area and information in the rollback segments to construct a read-consistent view of a table's data for a query. Only when a transaction is committed are the changes of the transaction made permanent. Statements, which start after the user's transaction is ommitted, only see the changes made by the committed transaction.

  Note that a transaction is key to Oracle's strategy for providing read consistency. This unit of committed (or uncommitted)SQL statements dictates the start point for read-consistent views generated on behalf of readers controls when modified data can be seen by other transactions of the database for reading or updating

Structures Used for Recovery

Oracle uses several structures to provide complete recovery from an instance or disk failure: the redo log, rollback segments, a control file, and necessary database backups.

The Redo Log

As described in "Redo Log Files" , the redo log is a set of files that protect altered database data in memory that has not been written to the datafiles. The redo log can be comprised of two parts: the online redo log and the archived redo log.

The Online Redo Log The online redo log is a set of two or more online redo log files that record all committed changes made to the database. Whenever a transaction is committed, the corresponding redo entries temporarily stored in redo log buffers of the system global area are written to an online redo log file by the background process LGWR.

The online redo log files are used in a cyclical fashion; for example, if two files constitute the online redo log, the first file is filled, the second file is filled, the first file is reused and filled, the second file is reused and filled, and so on. Each time a file is filled, it is assigned a log sequence number to identify the set of redo entries.

To avoid losing the database due to a single point of failure, Oracle can maintain multiple sets of online redo log files. A multiplexed online redo log consists of copies of online redo log files physically located on separate disks; changes made to one member of the group are made to all members.

If a disk that contains an online redo log file fails, other copies are still intact and available to Oracle. System operation is not interrupted and the lost online redo log files can be easily recovered using an intact copy.

The Archived Redo Log Optionally, filled online redo files can be archived before being reused, creating an archived redo log. Archived (offline) redo log files constitute the archived redo log.

The presence or absence of an archived redo log is determined by the mode that the redo log is using:

ARCHIVELOG The filled online redo log files are archived before they are reused in the cycle.

NOARCHIVELOG The filled online redo log files are not archived.

In ARCHIVELOG mode, the database can be completely recovered from both instance and disk failure. The database can also be backed up while it is open and available for use. However, additional administrative operations are required to maintain the archived redo log.

If the database's redo log is operated in NOARCHIVELOG mode, the database can be completely recovered from instance failure, but not from a disk failure. Additionally, the database can be backed up only while it is completely closed. Because no archived redo log is created, no extra work is required by the database administrator.

Control Files

The control files of a database keep, among other things, information about the file structure of the database and the current log sequence number being written by LGWR. During normal recovery procedures, the information in a control file is used to guide the automated progression of the recovery operation.

Multiplexed Control Files This feature is similar to the multiplexed redo log feature: a number of identical control files may be maintained by Oracle, which updates all of them simultaneously.

Rollback Segments

As described in "Segments" , rollback segments record rollback information used by several functions of Oracle. During database recovery, after all changes recorded in the redo log have been applied, Oracle uses rollback segment information to undo any uncommitted transactions. Because rollback segments are stored in the database buffers, this important recovery information is automatically protected by the redo log.

HTH
--
Oliver Willandsen
European Commission
http://europa.eu.int
All remarks are my own and do not necessarily reflect official European Commission policy

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Thu Jul 30 1998 - 08:22:55 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US