:

Enable Archivelog Mode

If you would like to put your database into Archivelog mode, follow the steps outlined below, substituting the appropriate values for the destinations on disk.

1. Check what state and mode the database is in

SELECT log_mode, open_mode FROM v$database;

If the log_mode shows as NOARCHIVELOG, then you need to put the DB intoARCHIVELOG mode. The result of this query also shows you if the DB is openREAD/WRITE or MOUNTED, etc.

2. Check where the archivelogs will be written to with the following command

SHOW PARAMETER LOG_ARCHIVE

This will display all of the parameters which have control over archive log mode in the database. The values for these parameters can change between versions. In this example, I am using a 10g database. Please check the documentation for the version that you are using if you are not sure.

The parameters that we will be changing/checking are as follows:

log_archive_format – this controls the format that the file names will have

log_archive_dest_n – where n will be a number between 1 and 10. You should use log_archive_dest_1 first and add additional ones as necessary.

log_archive_dest_state_n – where n will be a number between 1 and 10 and controls the status of the corresponding log_archive_dest_n parameter. For example, here are the values for a DB that is in archivelog mode:

NAME                       TYPE         VALUE
-------------------------- ------------ ------------------------------
log_archive_dest_1         string       LOCATION=O:\Oracle\TEST\Archlogs
log_archive_dest_state_1   string       ENABLE
log_archive_format         string       %t_%s_%r.arc

NOTE: log_archive_start is no longer in use in 10g, and is set to false by default. You shouldn’t need to change it but in earlier versions you may need to. Again, check the docs to see if you need to change it to TRUE otherwise the logs won’t archive and the DB will eventually hang when it uses up all of the online redo log space and is unable to archive the logs.

3. Put the database into a MOUNTED state

SHUTDOWN IMMEDIATE
STARTUP MOUNT

4. Put the DB into ARCHIVELOG mode and open it

ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

5. Check archivelogs are generated

First of all you need to switch logfile on the DB:

ALTER SYSTEM SWITCH LOGFILE;

Check that the archivelogs are generated by running the above command and then checking the destination on disk for the file in the appropriate format.

Your database is now in archivelog mode.

If you would like to learn more about how your database works when it is in archive log mode, why you would use it and how to back up your archive logs have a read through my other article called Archive Log Mode.

Like it, share it...

Category: Database Config


Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *