How Does Oracle Delete the archive and recycle the space correctly?

Source: Internet
Author: User

An Oracle archive log is often full, as the file space occupied by/oraarchive is 100%. Everyone must complain about why Oracle does not have an archive maintenance tool. Many people delete the file directly. Wrong, Oracle has, it is intelligent to delete archive and FLASHBACK correctly. However, it is important to remember that Oracle archive logs are important for Oracle data recovery and backup. You cannot delete archive logs unless necessary.

Deleting archived logs

Log on to the database server host as an Oracle user or connect to the database server through a network

Go to Oracle Data Backup Tool
Rman target/
Or rman target/@ orcl
Run
Delete archivelog all completed before 'sysdate-7 ';
Description
SYSDATA-7, indicating the current system time 7 days ago, the before keyword indicates the archived log 7 days ago, and if the flash back function is used, the flash back data is also deleted.
In the same way, you can delete all the logs from the past seven days to the present. However, this command should be clear. After this deletion, it is best to back up the database immediately.
Delete archivelog from time 'sysdate-7 ';

In UNIX/LINUX, you can also use FIND to FIND the archived data seven days ago and delete it using the EXEC sub-operation.

Find/oraarchive-xdev-mtime + 7-name "*. dbf"-exec rm-f {};
In this way, unmanaged archive files will still be left in RMAN.
You still need to execute the following two commands in RMAN
Crosscheck archivelog all;
Delete expired archivelog all;
So it is not as easy to use as the above method, but the advantage of using FIND is that you can perform a lot of operations on the condition and the EXEC subitem to implement 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.