Oracle redo log

Source: Internet
Author: User

A redo log group can contain one or more log members, which should be stored on different disks as disk log images. The same group of Members has the same content, if you do not have multiple disks, you do not have to create multiple log members for redo logs. Archive starts when a group is full and uses the next log group. When the log group is full and re-migrated to the first log group, if the first log Group is fully archived, it will be overwritten, if not, you can only use the log buffer to use it after archiving.

I. Operation Process of redo logs:
Redo logs are used in an ordered and cyclic manner. When a group of log files is filled up, redo logs repeatedly overwrite the next group of log files. This is called Log switching. The checkpoint operation also occurs at this time. The checkpoint operation is used for synchronization. It writes the header information of the data file and controls the file. In archive mode, when a set of log files are filled up, ARCH (archive write process) copies the set to archive log files. (The redo log file LGWR being written by ARCH cannot be written)
1. The final redo log file is based on the LGWR background process.
2. The redo log group being written by LGWR is called the current redo log group.
3. redo log files ------ online log files; archive log files ------ offline log files

Ii. query redo log groups:
1. Log group:
Select group #, sequence #, members, bytes, status, archived from v $ log;
Significance of values in the Status column:
Current: Current group.
Inactive: This set of logs is no longer required for instance recovery.
Activie: this group of logs is active, but not the current group. For example, archiving.
Unused: this group has never been written. Is the status in which Zhigang is added to the DB.
2. log files:
Select * from v $ logfile;
Meanings of values in the Status column:
Blank: this file is in use.
Stale: The file content is incomplete.
Invalid: the file cannot be accessed. For example
Deleted: this file is no longer useful.

3. Create and delete a redo log file group:
1. create two new log groups
SQL> alter database add logfile group 4 ('/Oracle/oradata/orcl/redo04.rdo') size 10 m;
SQL> alter database add logfile group 5 ('/oracle/oradata/orcl/redo05.rdo') size 10 m;
2. Switch the current log to a new log group.
Alter system switch logfile;
Alter system switch logfile;
3. Delete the old log Group
Alter database drop logfile group 1;
Alter database drop logfile group 2;
Alter database drop logfile group 3;
4. delete files in the original log group 1, 2, and 3 in the operating system
Rm/oracle/oradata/orcl/redo01.rdo
Rm/oracle/oradata/orcl/redo01.rdo
Rm/oracle/oradata/orcl/redo01.rdo
5. Rebuild log groups 1, 2, and 3
Alter database add logfile group 1 ('/oracle/oradata/orcl/redo01.rdo') size 10 m;
Alter database add logfile group 2 ('/oracle/oradata/orcl/redo02.rdo') size 10 m;
Alter database add logfile group 3 ('/oracle/oradata/orcl/redo03.rdo') size 10 m;
6. Switch the log Group
Alter system switch logfile;
Alter system switch logfile;
Alter system switch logfile;

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