Enabling Archiving of Redo Log Files

To back up the database while it is open, or to be able to perform complete or point-in-time media recovery, you must enable the archiving of redo log files. To do so, you place the database in ARCHIVELOG mode. You can determine if archiving of redo logs is enabled for the target database using the following query:

SELECT LOG_MODE FROM V$DATABASE;

If you do not specify a destination to which the database should write archived log files, the database writes them to the fast recovery area. You can specify a different destination, or you can specify that multiple copies of each archived log file be written, each to a different destination. Redundant copies help ensure that archived log files are always available in the event of a failure at one of the destinations.

The following procedure assumes that you want to place archived log files in the directory /u02/oracle/logfiles, and redundant copies of archived log file in the directory /u03/oracle/logfiles. The redundant copies are optional.

WARNING:

You must ensure that there is sufficient disk space at all times for archived log file destinations. If the database encounters a disk full error as it attempts to archive a log file, a fatal error occurs and the database stops responding. You can check the alert log for a disk full message.

To enable archiving of redo log files:

  1. Connect Oracle Recovery Manager (RMAN) to the target database as described in "Connecting to the Target Database Using RMAN."
  2. Shut down the database.
    SHUTDOWN IMMEDIATE;
    
  3. Back up the database.

    It is recommended that you always back up a database before making any major change to the database.

    See "Performing a Whole Database Backup."

  4. Start the instance and mount the database (do not open the database). To enable archiving, the database must be mounted but not open.
    STARTUP MOUNT;
    
  5. Enter the following command to set the first archived log file destination:
    ALTER SYSTEM SET LOG_ARCHIVE_DEST_1 = 'LOCATION=/u02/oracle/logfiles';
    

    Note:

    The directory must exist.

  6. (Optional) Enter the following command to set the second archived log file destination:
    ALTER SYSTEM SET LOG_ARCHIVE_DEST_2 = 'LOCATION=/u03/oracle/logfiles';
    
  7. Change the database archiving mode and then open the database for normal operations.
    ALTER DATABASE ARCHIVELOG;
    ALTER DATABASE OPEN;
    
  8. Shutdown the database.
    SHUTDOWN IMMEDIATE;
    
  9. Back up the database.

    Because changing the archiving mode updates the control file, it is recommended that you create a new backup.

    See "Performing a Whole Database Backup."

  10. Start up the database normally.
    STARTUP;
    

Note:

You cannot use backups from before the switch to ARCHIVELOG mode to restore and recover the database to a point in time after the switch. Thus, if you do not immediately make a backup after switching, then you are running your database without a valid backup. See "Performing and Scheduling Backups Using RMAN" to learn how to make database backups.

See Also: