RMAN backups, archive logs, and Oracle Streams - proper backup and keeping in synch
If you have Streams configured in your Oracle database environment, you probably know that RMAN is "Streams aware", meaning, it knows which archive logs Streams still needs and won't remove those from disk once backed up.
There are however RMAN commands that will remove archive logs even if they're still needed by Streams.
The problem I encountered the other day was with this RMAN command to backup my archive logs, which I run every 15 minutes:
run {
backup archivelog all
delete input;
}
My archive logs were removed from disk after being backed up, but not if needed by Streams. The problem was my backup files were getting cumulatively larger throughout the day, because every time it ran, RMAN backed up every archive log still on disk. This quickly filled the disk.
I only wanted to backup archive logs that had not already been backed up, so I tried this:
run {
backup archivelog all
not backed up 1 times
delete input;
}
My archive backups were now much smaller. But, I found that RMAN was now deleting archive logs still needed by the Streams Capture process. It turns out, this is documented (Usage of RMAN in Streams Environment-Doc ID 421176.1).
The syntax not backed up 1 times delete input will remove archive logs regardless if Streams needs them.
So, to only backup archive logs that had not been backed up, and keep archive logs Streams still needed, I split the RMAN commands up like so:
run {
backup archivelog all
not backed up 1 times;
delete archivelog all;
}
This backs up archive logs not already backed up, and then in another command, delete archivelog all, removes them, but not if needed by Streams.
There are however RMAN commands that will remove archive logs even if they're still needed by Streams.
The problem I encountered the other day was with this RMAN command to backup my archive logs, which I run every 15 minutes:
run {
backup archivelog all
delete input;
}
My archive logs were removed from disk after being backed up, but not if needed by Streams. The problem was my backup files were getting cumulatively larger throughout the day, because every time it ran, RMAN backed up every archive log still on disk. This quickly filled the disk.
I only wanted to backup archive logs that had not already been backed up, so I tried this:
run {
backup archivelog all
not backed up 1 times
delete input;
}
My archive backups were now much smaller. But, I found that RMAN was now deleting archive logs still needed by the Streams Capture process. It turns out, this is documented (Usage of RMAN in Streams Environment-Doc ID 421176.1).
The syntax not backed up 1 times delete input will remove archive logs regardless if Streams needs them.
So, to only backup archive logs that had not been backed up, and keep archive logs Streams still needed, I split the RMAN commands up like so:
run {
backup archivelog all
not backed up 1 times;
delete archivelog all;
}
This backs up archive logs not already backed up, and then in another command, delete archivelog all, removes them, but not if needed by Streams.
Comments