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!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Mrs. Jaye's Class Blog

Coordinate Algebra & Advanced Algebra

Pardy DBA

ORA-00001: unique constraint (ORA.BLOG_TAGLINE_PK) violated

Martin Widlake's Yet Another Oracle Blog

Oracle performance, Oracle statistics and VLDBs


Heli's thoughts on Database Designing, Oracle SQL Developer Data Modeler, User Groups etc.

Julian Dontcheff's Database Blog

The good DBA is one who learns from his mistakes, the best DBA is one who learns from other DBA's mistakes

Martins Blog

Trying to explain complex things in simple terms

The Data Warrior

Changing the world, one data model at a time. How can I help you?

Maaz Anjum's Blog

A life yet to be lived...

Stuff that interests me, if not you!

%d bloggers like this: