Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Old Archivelogs

Status
Not open for further replies.

kwil38

Programmer
Jan 20, 2005
49
US
I am using Oracle 10g and RMAN on Linux.

Is there a way to automatically delete archivelogs that have been backed up 3 times via OEM or a script?

Currently, I'm deleting them manually with the following:

rman catalog=rman/*****@RMAN target=netbackup/******@PROD
RMAN> delete archivelog all completed before 'sysdate -3';

Thanks!
 

Yes,

In EM: Click on Maintenance tab, select "Schedule Backup".

Select Archive logs from "Customized backup".

Somewhere you will have to choose to "remove archive logs".

Good Luck! [3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Sorry, I wasn't very clear on what I needed.

I'm using Netbackup (which in turn uses RMAN) to backup my database. I don't want to create and run the backup from OEM, only to create a job which simply deletes archivelogs that have been backed up 3 times.

Is that possible?
 
You could try this:
call the backup command 3 times in your script, once for today, once for yesterday and once for all older and deleted the backuped logs of the last step.
Code:
BACKUP ARCHIVELOG FROM 'trunc(sysdate-1)';
BACKUP ARCHIVELOG TIME BETWEEN 'trunc(sysdate-2)' AND 'trunc(sysdate-3)';
BACKUP ARCHIVELOG UNTIL 'trunc(sysdate-3)' DELETE INPUT;
I assume the backup is done after midnight...

Stefan
 
kwil,

the correct way to do this is to use RMAN's built-in facilities which are designed to do this automatically.

One defines a retention policy and then instructs RMAN to delete old archive logs, in accordance with that policy.

Below is my config script which does this. Note the first line which configures the retention policy. This has a reduncancy of 3, as you require.

Code:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'e:\oracle\rman_backups\dev0\cab_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   'e:\oracle\rman_backups\dev0\backup_%U';
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'e:\oracle\rman_backups\dev0\SNCF_dev0.ORA';

When I inovke the overnight backup routine, I do the backup and then delete obsolete archive logs in accordance with the previously configured policy. My standard file is below:-

Code:
backup database plus archivelog;
restore database validate;
delete noprompt obsolete;
exit;

The delete noprompt obsolete does the deletion.

Let us know how this works out for you.

Regards

T


Grinding away at things Oracular
 

You did say:
Is there a way to automatically delete archivelogs that have been backed up 3 times via OEM or a script?

You can either create an RMAN job in OEM to delete the logs or write a "script" with the rman command and execute with "cron" scheduler.




----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top