Oracle Cleanup Archive logs

Source: Internet
Author: User

We all know the information about every archivelog in the controlfile, of course, after we delete these physical files under OS, in our

These archivelog are still recorded in the Controlfile, and the visual logs in Oracle's OEM manager show that when we manually clear the files in the archive directory, the records are not erased from the controlfile. That is, Oracle does not know that these files are no longer in existence! This time we have to do the manual removal, following my experiment, you can try this method:

1. Enter Rman

2. Connect Target/

3. Crosscheck Archivelog All;

4. Delete Expired Archivelog all;

At this time we will go to the OEM to see it must not be seen, if you have never done this action, we can compare the action before the controlfile after the action of the Controlfile size!

How Oracle correctly deletes the archive and reclaims space

How Oracle correctly deletes the archive and reclaims space

An Oracle archive log is often full, represented as/oraarchive this file space occupies 100% people must complain about why Oracle has no archive maintenance tools, many people directly delete things, wrong, Oracle has, and very smart, Files and flashback can be deleted correctly, but remember that Oracle Archive logs are important for Oracle's data recovery and backup, and it is not necessary to delete archived logs.

Procedures for deleting archived logs

Log on to the database server host as an Oracle user or over a network connection

Go to Oracle Data Backup tool

Rman target/

or Rman target/@orcl

Execute in command Window

DELETE ARCHIVELOG all completed before ' SYSDATE-7 ';

Description

SYSDATA-7, indicates that the current system time 7 days ago, the Before keyword represents the archive log 7 days ago, and if the flashback function is used, the flashback data is also deleted.

In the same way, you can delete all logs from 7 days ago to the present, but this command should be considered clearly, after this deletion, it is best to make full backup database immediately

DELETE ARCHIVELOG from time ' SYSDATE-7 ';

Unix/linux can also find the archived data 7 days ago using the EXEC sub-operation to delete

Find/oraarchive-xdev-mtime +7-name "*.dbf"-exec rm-f {};

Doing so will still leave an undocumented archive in Rman

You still need to execute the following 2 commands in Rman

Crosscheck Archivelog All;

Delete Expired Archivelog all;

So it's not as good as the method above, but the advantage of using find is that you can do a lot of things on the condition, and on the Exec subkey, to achieve more complex functions

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.