Pages

Wednesday, July 3, 2019

How to delete Archive logs ?

To check the Archivelog allocated and used space :

set lines 100
col name format a60
select name
, floor(space_limit / 1024 / 1024) "Size MB"
, ceil(space_used  / 1024 / 1024) "Used MB"
from v$recovery_file_dest
order by name
/
-----------------------------------------
To fix the problem, you need to either make the flash recovery area larger, or remove some files from it.

If you have the disk space available, make the recovery area larger:

alter system set db_recovery_file_dest_size=<size> scope=both
/
-------------------------------------------
To remove files you must use RMAN. Manually moving or deleting files will have no effect as oracle will be unaware. The obvious choice is to backup and remove some archive log files. However, if you usually write your RMAN backups to disk, this could prove tricky. RMAN will attempt to write the backup to the flash recovery area...which is full. You could try sending the backup elsewhere using a command such as this:

rman target / catalog user/pass@rmancat

run {
allocate channel t1 type disk;
backup archivelog all delete input format '/<temp backup location>/arch_%d_%u_%s';
release channel t1;
}
This will backup all archive log files to a location of your choice and then remove them.

-------------------------------


To delete all archivelog on disk no matter whether they are backed up or not ...

RMAN > delete archivelog all;
-------------------------------

To delete all archivelog on disk no matter wether they are backed up or not and they are one day old ...

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


No comments:

Post a Comment