Oracle online redo log file

Source: Internet
Author: User

Almost all internal changes that occur in Oracle are recorded in the online redo log file. oracle uses these redo log groups to restore the database, so they are very important.

The main tasks of online redo log files are:

Back up data,

1: record all data changes
2: provides a recovery mechanism.
3: It must be organized into groups.
4: there are at least two groups of online redo log files

Each redo log is assigned to a group. oralce writes an online redo log group at a time. Once online redo logs in this group are filled, oracle writes the conversion to the next online redo log group. Therefore, oracle writes data between multiple groups in a loop.

Each online redo log file is assigned a unique sequence number ). The serial numbers of online redo log files will not be repeated unless the database is rebuilt.

We can have multiple online reorganizations even log files in one group, which means that each online redo log group contains at least two online redo log files, and each file in the group becomes a member, each member should be allocated to different disks. In order to include the lost group of files, oracle writes data to the member in the group concurrently. The online redo log files in a group are identical, write information to all online redo log file groups through the LGWR process.

Each member in the group has the same size. When oracle Data writes information to the redo log file group, it first allocates a log sequence numbers. multiplexing: at least two member members in a group, this avoids the spof of redo log files. A group of redo log files contains multiple members, each of which has a number.

When a database is created, the online redo log file is created, and the database cannot be missing the online redo log file. If all member files in a group are lost, the database will be damaged, therefore, it is very important to save and back up these files. There are two types of redo logs: Online redo logs and archive logs.

When does LGWR write redo log file?

1: when a transaction commit
2: Write every three seconds
3: When the redo log buffer becomes 1/3 full, write
4: When the redo log buffer size operation is 1 MB, write operations should be performed.
5: write before DBWn checkpoints execution.

Check the role of the DBWn process (write the redo log files information back to datafiles)

You must first write the redo log and then write it to the data file.

Online redo day Files Work:

Use it cyclically to understand the definition of log switch. (Switch between different groups for writing), log switch triggers checkpoints to write the dirty data in the memory back to the database file called a checkpoints

LOG Switches and checkpoints

V $ log; this view is used to redo log files online.

1: Use v $ logfile to find the redo log file and Group of the database;

SQL> col member format a50;
SQL> select group #, type, member from v $ logfile;

3 online d: \ APP \ TOPWQP \ ORADATA \ ORCL \ REDO03.LOG
2 online d: \ APP \ TOPWQP \ ORADATA \ ORCL \ REDO02.LOG
1 online d: \ APP \ TOPWQP \ ORADATA \ ORCL \ REDO01.LOG

2: manually switch the log command

For example, in the following example, the status of the group whose group number is 2 is current for the first query. The following command executes the alter system switch logfile command and then queries the group number 3 currently written by oracle again, indicates that the log switch log group is switched, Which is manually switched.

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

1 1 442 INACTIVE
2 1 443 CURRENT
3 1 441 INACTIVE

SQL> alter system switch logfile;

The system has been changed.

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

1 1 442 INACTIVE
2 1 443 ACTIVE
3 1 444 CURRENT

  • 1
  • 2
  • 3
  • 4
  • 5
  • Next Page

Related Article

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: 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.