Knight Talks Tech

How to Enable/Disable Archive Log Mode in Oracle 11g

It is advisable to backup your database before either enabling or disabling archive log mode as a precaution.

Enabling archive log mode

Verify the current archive log mode.

We can see that database log mode is “No Archive Mode”. Also worth noting is the destination used for archiving. In order to see where that location is mapped to we can check the recovery_file_dest parameter.

This shows us that the archive logs would be written to the fast recovery area (FRA). You may want to leave this as it is or, for example, if you prefer to store the archive logs elsewhere or disk space is tight on the drive hosting the FRA then you can amend where they are written to.
To change where the archive logs are written to we need to set the log_archive_dest_1 parameter, there can be multiple locations where archive logs are written to so you are able to set log_archive_dest_n parameters.

Before we can enable archive log mode we need to put the database into mount mode.

We can now set the archive log mode and open the database.

We can now see that archive log mode is enabled and that the logs will be written to a location other than the FRA.

Disabling archive log mode

Verify the current archive log mode.

We now need to shut the database down and bring it back in mount mode.

We now set the database to noarchivelog and re-open it. Verify the archive log mode with archive log list; and we see that it shows No Archive Mode.

Now we see that archive logging is disabled.

Force a log switch

You can force Oracle to perform a log switch, this results in the generation of an archive log file on the file system.
Connect to the database and check the log sequence.

One method to force the switch of log files is to use ALTER SYSTEM SWITCH LOGFILE.
We can then also see that the log sequence has updated.

 
The “Next log sequence to archive” number from the earlier screenshot is reflected in the file name of the newly generated log file.

ALTER SYSTEM SWITCH LOGFILE writes a checkpoint which indicates at what point the online redo log file has been written to the archive log file. It is a faster process than ALTER SYSTEM ARCHIVE LOG CURRNET as it does not wait for the archiver process to complete writing to the archive log file.
One risk of using ALTER SYSTEM SWITCH LOGFILE is that the command returns control to the user although the archiver process is still writing to the archive log file on the file system which could run out of space.

Exit mobile version