Oracle Archive Log Files


The instance treats the online redo log groups as a circular buffer in which to store transaction information, filling one group and then moving on to the next. After all groups have been written to, the instance begins overwriting information in the first log group.

To configure your database for maximum recoverability, you must instruct the database to make a copy of the online redo log group before allowing it to be overwritten. These copies are known as archived logs.

To facilitate the creation of archive log files:
1.       Specify a naming convention for your archive logs.
2.       Specify a destination or destinations for storing your archive logs. One of the destinations is probably your flash recovery area.
3.       Place the database in ARCHIVELOG mode.

Note: Steps 1 and 2 are not necessary if you are using a flash recovery area.
The destination must exist before placing the database in ARCHIVELOG mode. When a directory is specified as a destination, there should be a slash at the end of the directory name.

Archive Log File: Naming and Destinations
To configure archive log file names and destinations, select Enterprise Manager > Availability > Configure Recovery Settings.

Each archive log file must have a unique name to avoid overwriting older log files. To help create unique file names, Oracle Database 11g allows several wildcard characters in the name format:

          %s: Includes the log sequence number as part of the file name
          %t: Includes the thread number as part of the file name
          %r: Includes the resetlogs ID to ensure that the archive log file name remains unique (even after
        certain advanced recovery techniques that reset log sequence numbers)
          %d: Includes the database ID as part of the file name

The format must include %s, %t, and %r. The use of %d is optional, but it must be included if multiple databases share the same archive log destination.

Archive log files can be written to as many as ten different destinations. Destinations may be local (a directory) or remote (an Oracle Net alias for a standby database).

The default destination (number 10) sends archive log files to a location determined by the DB_RECOVERY_FILE_DEST initialization parameter. DB_RECOVERY_FILE_DEST is also known as the RECOVERY AREA parameter. This destination is visible at the bottom of the Recovery Settings properties page as Flash Recovery Area Location.

Note: If you do not want archives sent to this location, delete USE_DB_RECOVERY_FILE_DEST.
To change recovery settings, you must be connected as SYSDBA or SYSOPER.

Enabling ARCHIVELOG Mode
1.       In Enterprise Manager, select Availability > Configure Recovery Settings > ARCHIVELOG Mode. The equivalent SQL command is:

SQL> ALTER DATABASE ARCHIVELOG;
          This command can be issued only while the database is in the MOUNT state. The instance must therefore be restarted to complete this last step.
2.       In Enterprise Manager, you are prompted for operating system and database credentials during the restart of the database. The database credentials must be for a user with the SYSDBA privileges.
3.       After the instance is restarted, the changes that you have made to the archive processes, log format, and log destinations are in effect. In SQL*Plus, you can see them with the ARCHIVE LOG LIST command.
4.       Back up your database after switching to ARCHIVELOG mode because your database is only recoverable from the last backup taken in that mode.
With the database in NOARCHIVELOG mode (the default), recovery is possible only until the time of the last backup. All transactions made after that backup are lost.
In ARCHIVELOG mode, recovery is possible until the time of the last commit. Most production databases are run in ARCHIVELOG mode.

How to manually turn on Archive Log