Managing the Archived Redo Logs

If you run your database in ARCHIVELOG mode, Oracle allows you to save filled groups of online redo log files, known as archived redo logs, to one or more offline destinations. Archiving is the operation of turning online redo logs into archived redo logs.

Use archived logs to:

An archived redo log file is a copy of one of the identical filled members of an online redo log group: it includes the redo entries present in the identical members of a group and also preserves the group's unique log sequence number.

If you enable archiving, LGWR is not allowed to re-use and hence overwrite an online redo log group until it has been archived. Therefore, the archived redo log contains a copy of every online redo group created since you enabled archiving. The best way to back up the contents of the current online log is always to archive it, then back up the archived log.

 

Displaying Archived Redo Log Information

The following data dictionary views contain useful information about the archived redo logs:

Views

Description

V$DATABASE

Identifies whether the database is in ARCHIVELOG or NOARCHIVELOG mode.

V$ARCHIVED_LOG

Displays archived log information from the control file.

V$ARCHIVE_DEST

Describes the current instance, all archive destinations, and the current value, mode, and status of these destinations.

V$LOG

Displays all online redo log groups for the database and indicates which need to be archived.

V$LOG_HISTORY

Contains log history information such as which logs have been archived and the SCN range for each archived log.

 

Setting the Archive Mode

To switch a database's archiving mode between NOARCHIVELOG and ARCHIVELOG mode, use the SQL statement ALTER DATABASE with the ARCHIVELOG or NOARCHIVELOG option. The following statement switches the database's archiving mode from NOARCHIVELOG to ARCHIVELOG:

ALTER DATABASE ARCHIVELOG; 

Before switching the database's archiving mode, perform the following operations:

  1. Shut down the database instance.
  2. Back up the database.
  3. Restart the instance and mount but do not open the database.
  4. Issue ALTER DATABASE ARCHIVELOG or ALTER DATABASE NOARCHIVELOG to switch the database's archiving mode.

 

Enabling Automatic Archiving

To enable automatic archiving of filled groups, include the initialization parameter LOG_ARCHIVE_START parameter in the database's parameter file and set it to TRUE:

LOG_ARCHIVE_START=TRUE 

The new value takes effect the next time you start the database.

To enable automatic archiving of filled online redo log groups without shutting down the current instance, use the SQL statement ALTER SYSTEM with the ARCHIVE LOG START parameter:

ALTER SYSTEM ARCHIVE LOG START;

If you use the ALTER SYSTEM method, then you do not need to shut down and restart the instance to enable automatic archiving

 

Archiving Redo Logs to Multiple Locations

You can specify a single destination or multiple destinations for the archived redo logs. Oracle recommends archiving your logs to different disks to guard against file corruption and media failure.

Specify the number of locations for your archived logs by setting either of two mutually exclusive sets of initialization parameters:

The first method is to use the LOG_ARCHIVE_DEST_n parameter to specify from one to five different destinations for archival. Each numerically-suffixed parameter uniquely identifies an individual destination, for example, LOG_ARCHIVE_DEST_1, LOG_ARCHIVE_DEST_2, etc. Use the LOCATION keyword to specify a pathname or the SERVICE keyword to specify a net service name (for use in conjunction with a standby database).

The second method, which allows you to specify a maximum of two locations, is to use the LOG_ARCHIVE_DEST parameter to specify a primary archive destination and the LOG_ARCHIVE_DUPLEX_DEST to determine an optional secondary location.

 

To set the archiving destination using LOG_ARCHIVE_DEST_n:

Edit the LOG_ARCHIVE_DEST_n parameter to specify from one to five archiving locations. For example, enter:

LOG_ARCHIVE_DEST_1 = 'LOCATION=/disk1/arc/'
LOG_ARCHIVE_DEST_2 = 'LOCATION=/disk2/arc/'
LOG_ARCHIVE_DEST_3 = 'LOCATION=/disk3/arc/'

Edit the LOG_ARCHIVE_FORMAT parameter, using %s to include the log sequence number as part of the filename and %t to include the thread number. Use capital letters (%S and %T) to pad the filename to the left with zeros. For example, enter:

LOG_ARCHIVE_FORMAT = arch%t_%s.arc

 

To set archiving destinations with LOG_ARCHIVE_DEST and LOG_ARCHIVE_DUPLEX_DEST:

  1. Edit the initialization parameter file, specifying destinations for the LOG_ARCHIVE_DEST and LOG_ARCHIVE_DUPLEX_DEST parameter. If the database is open, then you can also edit the parameter dynamically using the ALTER SYSTEM statement.
  2. For example, change the parameter to read:

    LOG_ARCHIVE_DEST = '/disk1/arc'
    LOG_ARCHIVE_DUPLEX_DEST_2 = '/disk2/arc'

  3. Edit the LOG_ARCHIVE_FORMAT parameter, using %s to include the log sequence number as part of the filename and %t to include the thread number. Use capital letters (%S and %T) to pad the filename to the left with zeroes. If the database is open, you can alter the parameter using the ALTER SYSTEM statement.

For example, enter:

LOG_ARCHIVE_FORMAT = arch_%t_%s.arc
Hosted by www.Geocities.ws

1