Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of status and switching of Oracle redo log group

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The Oracle redo log (redo log) is used to record operation entries for database data recovery. To improve efficiency, oracle usually recommends setting up three sets of redo log.

one。 Overview

Oracle redo log groups usually have four states, namely unused,inactive,active,current.

Unused usually refers to log groups that have never been used, that is, newly added log groups.

The current status is LGWR the process is writing the log of redo log buffer to the log group.

Active is in the state after the log switch has just been completed. At this time, the data changes caused by transactions committed in the log group have not been fully written to the data file from DB buffer cache, so the log group cannot be overwritten and becomes inactive after it is fully written. If the database is in archive mode, the archive is completed in that state.

The log of the inactive status can be overwritten and can be written to the log. If you are in archiving mode, this stage proves that the archiving has been completed.

two。 Experiment

In this experiment, we take the archive mode as an example:

The log group is divided into three groups with a status of inactive,inactive,current. As shown in the figure:

After manual archiving, it was observed that the state of group 1 changed to current, that of group 3 changed to active, and that of group 2 remained unchanged. As shown below:

Indicates that the currently written log group is group 1, and group 3 is archiving and writing the necessary data to datafile. After these two tasks are completed, take a look at the following figure:

Indicates that group 3 has finished archiving and is ready to write next time. In non-archive mode, the state of group 3 can also change to inactive, indicating that the data has been written from DB BUFFER CACHE to DB files.

III. Summary

The above experiments are a good illustration of the state of the oracle log group throughout the life cycle. Of course, you don't see the unused status, which is just after the log group has been added to the database, and this operation is rare in the production environment, so we don't see this state in this experiment.

Others may wonder why the command alter system archive log current is used when switching logs manually. There is also an explanation here.

The final effect of both sets of commands is the same. Alter system switch logfile performs switch logfile operations without waiting for archiving to be completed. It is fast, especially suitable for non-archiving mode, and takes effect on the current instance. On the other hand, alter system archive log current will not operate until the archive is completed, and it will take effect on all instances.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report