Oracle deletes an archived log instance

Source: Internet
Author: User

When the Oracle archive log is full, you cannot log on to Oracle normally. You must delete some archived logs to log on to Oracle normally.

1. Delete physical files of archived logs. archive logs are generally stored in the archive directory. The file format in the AIX system is "201717884_667758186.dbf". We recommend that you back up the database before performing the operation, at least logs of the last few days are retained for database recovery.

2. After deleting the physical file of the archived log, We can log on to Oracle normally, but we have not completely deleted the archived log, the Oracle controlfile still records the archivelog information, which is displayed visually in the Oracle OEM manager. After we manually clear the files under the archive directory, these records are not removed from controlfile. Next we will do this.

We use RMAN to perform the delete operation. The procedure is as follows: (WIN client system is used as an example)

1. Specify database instances

C: \ Documents ents and Settings \ Administrator> SET Oracle_SID = orcl

2. Connect to the database

C: \ Documents ents and Settings \ Administrator> rman target sys/sysadmin @ orcl

3. view the status of archived logs

RMAN> list archivelog all;

4. manually delete archived log files

RMAN> delete archivelog all completed before 'sysdate-7 ';

Note:
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'; DELETE all logs from the past 7 days, with caution
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.