I will explain Alter system switch logfile in Oracle in this post.
Alter system switch logfile
Online redo log files are files that hold transaction records in the database. Log files to recover the database in case of a problem.
For example, if we shut down the database abruptly (shutdown abort), SMON performs instance recovery by reading these log files during database startup.
There must be at least two online redo log groups in a database and each redo log group must have at least one online redo log member.
When the database is first created, 3 online redo log groups are created by default.
Normally Redolog files switch to other redolog file when Current Redolog filled. A log switch occurs when LGWR stops writing to one redo log group and starts writing to another. By default, a log switch occurs automatically when the current redo log file group fills.
When the “Current” online redo log group is full, the LGWR process continues to write to the next online redo log group. When the last online redo log group is full, it continues to overwrite the first redo log group again.
If you want to force a log switch to make the currently active group inactive and available for redo log maintenance operations. For example, you want to drop the currently active group, but are not able to do so until the group is inactive. You may also wish to force a log switch if the currently active group needs to be archived at a specific time before the members of the group are completely filled. This option is useful in configurations with large redo log files that take a long time to fill.
You can use the following statement forces a log switch.
ALTER SYSTEM SWITCH LOGFILE; ALTER SYSTEM ARCHIVE LOG CURRENT;
If your database is Cluster ( Oracle RAC ) and you have lots of instances, you want to switch for all logfiles, then run the following command.
SQL> ALTER SYSTEM SWITCH ALL LOGFILE; System altered.
1,609 views last month, 1 views today