Manual | Automatic Archiving   «Prev  Next»
Lesson 5Automatic archive log options
ObjectiveSet up automatic archiving of the redo log files.

Automatic archive log Options

You probably will not bother with the mundane task of manually backing up online redo log files, opting instead to have the instance back up the online redo log files independent of the DBA. This reduces the chance for error and also reduces the chance that your redo log files will fill up. So let us look at how to set up automatic archiving of your online redo log files.

Start automatic archiving

Most Oracle installations set up the database to archive log files automatically. It is a relatively simple process and makes your life much easier. To start automatic archiving do the following:
Question: What is the process to start automatic archiving of the redo log files in Oracle 12c?
To enable automatic archiving of the redo log files in Oracle 12c, follow these steps:
  1. First, ensure that your database is in ARCHIVELOG mode. If it's not, follow the steps mentioned in the previous answer to enable ARCHIVELOG mode.
  2. Set the log_archive_start parameter to TRUE in order to enable automatic archiving. In Oracle 12c, the default value for this parameter is already TRUE, so you don't need to change it. However, you can check the current value using the following command:
    SHOW PARAMETER log_archive_start;
    

    If the value is FALSE, you can set it to TRUE using the following command:
    ALTER SYSTEM SET log_archive_start=TRUE SCOPE=spfile;
    
  3. Specify the location for the archived redo log files using the log_archive_dest parameter. You can check the current value with this command:
    SHOW PARAMETER log_archive_dest;
    

    If you want to change the location, use the following command:
    ALTER SYSTEM SET log_archive_dest='/path/to/your/archive/directory' SCOPE=spfile;
    
  4. If you made any changes to the log_archive_start or log_archive_dest parameters, you need to restart the database for the changes to take effect. First, shut down the database:
    SHUTDOWN IMMEDIATE;
    

    Then, start the database:
    STARTUP;
    

Now, the Oracle database will automatically archive redo log files to the specified location. Remember to monitor the archived redo log files directory to avoid running out of disk space. You may also want to configure a log rotation policy or set up a backup solution to handle the archived log files.

Using the ARCH process archives your redo log files as they fill up. If you bring the database down, you must restart the ARCH process each time you start an instance. By default ARCH is disabled.

Enabling ARCH at the start of the instance

If you want ARCH to automatically start each time your instance starts, you must modify the LOG_ARCHIVE_START parameter in the init.ora file. Our system would be set up as:
LOG_ARCHIVE_START=TRUE

This will allow ARCH to start each time the instance starts up.

Disabling automatic archiving

If for some reason you choose to stop your system from automatically archiving, enter the following command:
SVRMGR>alter system archive log stop
You must be very careful when doing this. Even though you have stopped the ARCH process from archiving, you have not changed the state of the database from archive mode to noarchive mode. The instance will expect that you will be manually archiving your redo log files, so you run the danger of filling up your redo logs, thereby making the system hang. You must set the database back to noarchive log mode and make sure that the LOG_ARCHIVE_START parameter in the init.ora file is set to FALSE. The next lesson shows how to obtain archive log information.