Archived Log FileRMAN

Online Archived Logs vs Backup Archived Logs

Let me make it short first. If you can tell the difference between the following two RMAN statements, then you have already know the difference.

RMAN> list archivelog all; RMAN> list backup of archivelog all;

Of course, I can also explain the difference much longer.

Online Archived Logs

Online archived logs are derived from online redo log files by archiving the “Inactive” redo files to the destination of archived logs. Therefore, the size of archived log file is inherited from redo files.

The destination for online archived log is LOG_ARCHIVE_DEST_n if any of these parameters is configured. But mostly, they are in DB_RECOVERY_FILE_DEST which is also called Fast Recovery Area (FRA), you have to set USE_DB_RECOVERY_FILE_DEST before using it.

Online archived logs can be used to recover the database to a point in time after the data files are restored. In a data guard environment, they can be transported to the standby database and applied if ARCH attribute was set.

Command examples

RMAN> list archivelog all;

It lists all online archived logs which are kept in the record (recovery catalog) of control file. Which means the control file knows where to find them to use.

RMAN> crosscheck archivelog all;

It checks the existence of all online archived logs, if anyone is not where it should be, RMAN marks it as “expired” which means “This archived log is not available currently”.

Strictly speaking, they are not truly expired, they may be not there temporarily. We can move back the missing archived logs to the original destination, then crosscheck again. Just like nothing happened.

RMAN> delete noprompt expired archivelog all;

It deletes all online archived logs which were marked as “expired” and don’t ask anything before deleting.

RMAN> delete noprompt archivelog until time 'sysdate -7';

It deletes all online archived logs which were archived before 7 days ago and don’t ask anything before deleting.

Backup Archived Logs

Backup archived logs are derived from online archived logs in RMAN backup processes. Usually, the backup archived logs are stored as backup sets.

The destination for backup archived log is defined by your RMAN channel(s), it varies. If you use the default channel DISK, then they are in DB_RECOVERY_FILE_DEST.

Backup archived logs cannot be used to recover the database directly. They must be restored as online archived logs from backup sets before they can be used. Which means, we usually keep more backup archived logs than online archived logs in case any other application need them.

Backup archived logs are usually restored to their original location of online archived logs. Of course, you can assign a different destination for backup archived logs to be restored.

When we use RECOVER DATABASE to make the data files consistent, if necessary, RMAN will restore backup archived logs into online archived logs automatically, then use the restored online archived logs to perform recovery. That is to say, you don’t have to restore them manually.

Command examples

The commands for backup archived logs are very similar with online archived logs. So I think you can tell the difference now, there’s no need to explain them.

RMAN> list backup of archivelog all; RMAN> crosscheck backup of archivelog all; RMAN> delete noprompt expired backup of archivelog all; RMAN> delete noprompt backup of archivelog until time 'sysdate -14';

Now, here is a situation that you might know how to deal with:

I need some archived logs, but I can’t find them in FRA. Where can I find them?
I think you know the answer:
  1. Online archived logs
  2. Because there may be some undeleted archived logs in other destinations beside FRA. e.g. LOG_ARCHIVE_DEST_3
  3. Backup archived logs
  4. You can restore them back to online and continue your job.
Where you may not notice is:
  1. Standby database server
  2. There might have some undeleted archived that you want.

Copies of Archived Logs

This section is a little advanced to study and can be skipped. Please be aware of that.

There’s a very special type of backup that I have to explain, which is called image copies. Strickly, this kind of archived logs are not backup, they can be regarded as online archived logs. You don’t have to restore before using them, because they are “copies” of online archived logs. The following commands can make the image copies of archived logs to the destination you defined. RMAN> backup as copy archivelog all to destination '/path/to/backup/'; RMAN> backup as copy archivelog all format '/path/to/backup/%U';

Where can we find them? You can do this: RMAN> list archivelog all;
They are mixed with online archived logs and the filename could be different.

In the above, I was trying to explain several types of archived logs for you to tell which is which. For more information, you can refer to the official documentation for RMAN commands.

Leave a Reply

Your email address will not be published. Required fields are marked *