Archivelog Mode

How to Enable ARCHIVELOG Mode in Oracle

The process of copying inactive redo log files into archived files is called archiving. Archiving is only possible if the database is running in ARCHIVELOG mode. It makes databases keep transaction history much longer than finite redo logs. Which means that you can have larger recovery point objective (RPO) than usual whenever data lost, database corrupted, system failures or in any doubt.

Reasons Why We Should Use ARCHIVELOG

Here I list some advantages of enabling ARCHIVELOG mode for data protection:

In short, ARCHIVELOG mode is eventually used for database continuity in terms of data protection, not aims at availability.

The destination of archived logs can be file systems, disk groups of ASM or fast recovery area (FRA). If you’re planning to use FRA, the default destination for archived logs. You should enable FRA before enabling ARCHIVELOG mode.

You can have a look at Managing Archived Redo Log Files for more operations about archived logs.

Enabling ARCHIVELOG Mode

First of all, let’s check current mode of this database.

SQL> select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     11
Current log sequence           13

Shutdown the database

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

Startup to mount state.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1553305600 bytes
Fixed Size                  2253544 bytes
Variable Size             956304664 bytes
Database Buffers          587202560 bytes
Redo Buffers                7544832 bytes
Database mounted.

Change log mode to ARCHIVELOG.

SQL> alter database archivelog;

Database altered.

Open the database.

SQL> alter database open;

Database altered.

Check the log mode again.

SQL> select log_mode from v$database;

LOG_MODE
------------
ARCHIVELOG

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     11
Next log sequence to archive   13
Current log sequence           13

We have enabled the archiving feature of the database.

Enabling NOARCHIVELOG Mode

As for reverting ARCHIVELOG Mode, the steps of procedure are the same except that we change log mode to NOARCHIVELOG at mount state.

SQL> alter database noarchivelog;

Database altered.

Please note that, ARCHIVELOG or NOARCHIVELOG should be switched at database level not system level. For example, the following statement is wrong:

SQL> alter system archivelog;

Leave a Reply

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