backup database plus archivelog delete input

Introduction: – In this article we will learn how to Backup database plus archive log delete input. In oracle database it’s very important to manage the archive logs to free up the space on archive log destination for new archive logs. 

Follow below steps to backup database plus archive log delete input.

Some rman commands to delete the old archive log which was already backup up on disk.


Backup archivelog oder than 2 day’s and delete them.


rman target /

RMAN>

run
{
    allocate channel c1 type disk;
    
    backup
    format '/backup01/prod/%d_ARC_%u_%s_%p'
    archivelog until time 'sysdate-2' delete input;
    
    release channel c1;

}

 Delete archivelog older than 2 day’s

run {

allocate channel c1 type disk;

delete archivelog all completed before ‘sysdate-2’;

release channel c1;

}

Backup archivelog that was not backup.

run {
allocate channel c1 type disk;



backup archivelog all not backed up 1 times;

release channel c1;
}

Backup scripts for database plus archivelog older than 2 day’s and delete them. Here we will do backup archivelog all delete input.

run{
allocate channel c1 type disk;
sql'alter system archivelog current';
BACKUP
FORMAT '/backup01/prod/%d_DB_%u_%s_%p'
DATABASE
PLUS ARCHIVELOG UNTIL TIME 'sysdate-2'
delete input;
release channel c1;
}

Delete Archivelog older than 5 day’s which was backup at least 1 time.

Run {

allocate channel c1 type disk;

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.

Leave a Comment