Using redo in Oracle to implement recovery

Source: Internet
Author: User

In the database, the functions of Redo are mainly implemented through 3 components: Redo log Buffer, LGWR background process, and Redo log file (in archive mode, Redo log files will eventually be written as archive logs).

In Oracle's SGA, there is a shared memory called Redo Log Buffer, as shown in Figure 1.

Figure 1 Oracle Instance

Redo Log Buffer, located in the SGA, is a circularly used memory area that holds information about changes to the database. This information is stored in the form of a redo entry (Redo Entries) (Redo Entries is also often referred to as Redo Records). Redo Entries contains important information about refactoring and redo database changes, including inserts, updates, deletes, CREATE, alter, or drop. Redo entries is used for database recovery when necessary.

The contents of the Redo entries are copied from the user's memory space by the Oracle database process into the Redo Log buffer in the SGA. Redo entries occupies continuous sequential space in memory, because Redo log buffer is recycled, Oracle through a background process LGWR continuously write the contents of Redo log buffer into Redo log file.

When the user modifies the data in the buffer cache, Oracle does not immediately write the modified data to the data file because it is inefficient, so far the busiest part of the computer system is disk I/O operations, and Oracle is doing this to reduce the number of IO When the modified data reaches a certain number, it can be written efficiently and in batches.

Most traditional databases (including Oracle, of course) follow the No-force-at-commit policy when processing data modifications. In other words, it is not mandatory to write at the time of submission. In order to ensure that data can be recovered in the event of a database failure, such as a power outage, Oracle introduces the redo mechanism to defer the writing of random, scattered chunks of data through sequential, sequential log entries. This delay allows the data to be written out to obtain the performance improvement of the batch effect.

Similar to Redo log buffer, Redo log file is also recycled and Oracle allows at least two log groups to be used. By default, 3 log groups are established when a database is created.

SQL> select group#,members,status from v$log;

GROUP# MEMBERS  STATUS

---------- ---------- ----------------

1 1 INACTIVE

2 1  CURRENT

3 1 INACTIVE

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.