In oracle database its very important to manage the archive logs to free up the space on archive log destination for new archive logs.
Below are some rman commands to delete the old archive log which was already backuped up on disk.
rman target /
RMAN>
run
{
allocate channel c1 type disk;
#Backup archivelog oder than 2 day's and delete them.
backup
format '/backup01/prod/%d_ARC_%u_%s_%p'
archivelog until time 'sysdate-2' delete input;
release channel c1;
}
============================================
run {
allocate channel c1 type disk;
#Delete archielog older than 2 day's
delete archivelog all completed before ‘sysdate-2’;
release channel c1;
}
===============================================
run {
allocate channel c1 type disk;
#Backup archivelog that was not backup.
backup archivelog all not backed up 1 times;
release channel c1;
}
============================================
run{
allocate channel c1 type disk;
sql'alter system archivelog current';
#Backup database plus archivelog older than 2 day's and delete them.
BACKUP
FORMAT '/backup01/prod/%d_DB_%u_%s_%p'
DATABASE
PLUS ARCHIVELOG UNTIL TIME 'sysdate-2'
delete input;
release channel c1;
}
==============================================
Run {
allocate channel c1 type disk;
#Delete archielog older than 5 day's which was backup atleast 1 time.
DELETE ARCHIVELOG UNTIL TIME 'sysdate-5' BACKED UP 1 TIMES TO DEVICE TYPE DISK;
release channel c1;
}
================================================
Use below script to delete noprompt expired archivelog .
Run{
allocate channel c1 type disk;
delete expired archivelog all;
release channel c1; }
or -------------------------------------------------------
Run{
allocate channel c1 type disk;
delete noprompt expired archivelog all;
release channel c1;
}
Click here for more information on rman backup of oracle database. If you want to restore the rman backup click here.
Below are some rman commands to delete the old archive log which was already backuped up on disk.
rman target /
RMAN>
run
{
allocate channel c1 type disk;
#Backup archivelog oder than 2 day's and delete them.
backup
format '/backup01/prod/%d_ARC_%u_%s_%p'
archivelog until time 'sysdate-2' delete input;
release channel c1;
}
============================================
run {
allocate channel c1 type disk;
#Delete archielog older than 2 day's
delete archivelog all completed before ‘sysdate-2’;
release channel c1;
}
===============================================
run {
allocate channel c1 type disk;
#Backup archivelog that was not backup.
backup archivelog all not backed up 1 times;
release channel c1;
}
============================================
run{
allocate channel c1 type disk;
sql'alter system archivelog current';
#Backup database plus archivelog older than 2 day's and delete them.
BACKUP
FORMAT '/backup01/prod/%d_DB_%u_%s_%p'
DATABASE
PLUS ARCHIVELOG UNTIL TIME 'sysdate-2'
delete input;
release channel c1;
}
==============================================
Run {
allocate channel c1 type disk;
#Delete archielog older than 5 day's which was backup atleast 1 time.
DELETE ARCHIVELOG UNTIL TIME 'sysdate-5' BACKED UP 1 TIMES TO DEVICE TYPE DISK;
release channel c1;
}
================================================
Use below script to delete noprompt expired archivelog .
Run{
allocate channel c1 type disk;
delete expired archivelog all;
release channel c1; }
or -------------------------------------------------------
Run{
allocate channel c1 type disk;
delete noprompt expired archivelog all;
release channel c1;
}
Click here for more information on rman backup of oracle database. If you want to restore the rman backup click here.
No comments:
Post a Comment
Thanks for reading till end. I hope this will help you more to improve your knowledge.
Now it's your turn!
What do you think? Share your experience in the comments box and subscribe for more interesting post.