Archive Enabled

This is going to be a short post.  As we work with databases, we want to make sure that we can recover without taking it down to perform a backup.  In order to do this we need to enable archive log mode in the database.  Lets take a look at the steps needed to place the database into archive log mode.
 
First we want to connect to the database as SYSDBA.
 
sqlplus / as sysdba
 
Lets see what  mode we are currently in.  The archive log list command will provide feedback on the current mode of the database.
 
SQL> archive log list

Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 393
Current log sequence 395

Now that we  know the database is in noarchivelog mode, we need to identify a location for the archive logs.  In current releases of the database we can store archive logs in the fast_recovery_area.  For example purposes we are going to put the archive logs in a different area.
 

SQL> alter system set log_archive_dest_1=’LOCATION=/oracle/app/archivelogs’ scope=spfile;

 
Once we set our destination for archive logs, we need to shutdown the database.
 
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 
Before we can switch the mode of the database, we need to mount the database.
 
SQL> startup mount

ORACLE instance started.

Total System Global Area 801701888 bytes
Fixed Size 2232640 bytes
Variable Size 524291776 bytes
Database Buffers 268435456 bytes
Redo Buffers 6742016 bytes
Database mounted.

Now we can switch the mode of the database by using the alter database command.
 
SQL> alter database archivelog;


Database altered.

Once the mode has been switch to archive log, we can open the database.

 
SQL> alter database open;


Database altered.

Lets verify that the database is in archive log mode now.
 
SQL> archive log list 

Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/app/archivelogs
Oldest online log sequence 393
Next log sequence to archive 395
Current log sequence 395

And additional test to make sure that archive logs are going to the correct location we can switch the log file.
 
SQL> alter database switch logfile;

System altered.

SQL> !ls -ltr /oracle/app/archivelogs
total 7432
-rw-rw—-. 1 oracle oracle 7607296 May 22 09:15 1_395_809518082.dbf

Hope the steps provided will help everyone in remembering how to place a database into archive log mode.  Enjoy!

Please follow and like:
Comments

Leave a Reply

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

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.