Redo log switching


Its a common requirement (or service level agreement) that a standby database be kept less than 'n' minutes behind its associated primary. More accurately, the requirement is normally a specification of the amount of the data that is allowed to be lost in the event of a disaster on the primary.

Up until now, this normally meant careful consideration of redo log sizes, or some scheduled task to archive the current log file at regular intervals. 9i introduces a new parameter to achieve this for us:

From the documentation:

Setting the ARCHIVE_LAG_TARGET Initialization Parameter When you set the ARCHIVE_LAG_TARGET initialization parameter, you cause Oracle to examine an instance's current online redo log periodically. If the following conditions are met the instance will switch the log:

In an Oracle Real Application Clusters environment, the instance also kicks other threads into switching and archiving logs if they are falling behind. This can be particularly useful when one instance in the cluster is more idle than the other instances (as when you are running a 2-node primary/secondary configuration of Oracle Real Application Clusters).

Initialization parameter ARCHIVE_LAG_TARGET specifies the target of how many seconds of redo the standby could lose in the event of a primary shutdown or crash. It also provides an upper limit of how long (in the number of seconds) the current log of the primary database can span. Because the estimated archival time is also considered, this is not the exact log switch time.

The following initialization parameter setting sets the log switch interval to 30 minutes (a typical value).

ARCHIVE_LAG_TARGET = 1800