Oracle manually switches log files and clears log files

Source: Internet
Author: User

Oracle manually switches log files and clears log files

Oracle switch log file group
Log File groups are used cyclically. When a group of log files is full, the Oracle system automatically switches to the next group of log files. When necessary, the database administrator can also manually switch to another log file group. To switch the log file group, use the following statement:
Alter system switch logfile;

Clear Log File groups
If the log files in the log file group are damaged, the database will not be able to archive the damaged log files. This will eventually cause the database to stop running. In this case, you can clear the content in the log file group without shutting down the database.
The syntax for clearing a log file group is as follows:
Alter database clear logfile group group_number;
Note:
The log file group to be cleared cannot be in the current state, that is, the log file group currently in use by the database cannot be cleared.
When there are only two Log File groups in the database, the log file group cannot be cleared.
The specific operations are as follows:
SQL> select group #, status from v $ log; // view the status of the log file
GROUP # STATUS
--------------------------
1 ACTIVE -- activity window sill
2 INACTIVE -- INACTIVE
3 INACTIVE
4 CURRENT -- the log file group currently in use by the database
SQL> alter system switch logfile;
The system has been changed.
The following shows that the database file group has been changed.
SQL> select group #, status from v $ log;
GROUP # STATUS
--------------------------
1 INACTIVE
2 CURRENT
3 INACTIVE
4 ACTIVE
Clear the log file group and initialize the file. The file is not deleted and the knowledge content is cleared.
Alter database clear logfile group 4;

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.