Oracle correctly deletes the archivelog File

Source: Internet
Author: User

 

Oracle correctly deletes the archivelog File

After the archive mode is enabled, Oracle will generate many archivelog files under the specified archive Directory, which is not cleared regularly by default and takes a long time, this folder occupies a lot of space.

Q: How do I regularly and correctly Delete archivelog files?

Many people directly delete files in the archive Directory, which cannot be used to delete file records in the Oracle CLF file.

Correct method:

1. Use RMAN to connect to the target DB:

RMAN target sys/***** @ orcl

2. In the RMAN command window, enter the following command:

 

Crosscheck archivelog all;
Delete expired archivelog all;

Or delete the archivelog before the specified time:

Delete archivelog all completed before 'sysdate-7'; (DELETE archived logs 7 days ago)

3. Other related commands:

View the archived log list:

List archivelog all;

View the list of invalid archive logs:

List expired archivelog all;

4. regularly clear archivelog:

You can write the following code as a. bat file and add a new scheduled task under the task plan of the control panel:

RMAN target sys/***** @ orcl
Crosscheck archivelog all;
Delete expired archivelog all;

The above content is personal summary only.

 

 

 

This article is from the "when you start watching the cloud" blog

 

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.