Enabling Oracle ARCHIVELOG Mode

If you want to check or enable/disable oracle Archivelog Mode, you can do it thru 2 procedures.


Procedure 1

Login as "ora" or su - from "root" at OS

# sqlplus /nolog
SQL > connect / as sysdba
SQL > shutdown immediate;
SQL > startup mount;

Checking the current archive mode status.

SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
NOARCHIVELOG

Set archivelog destination and format :
SQL> alter system set log_archive_format=‚¬„¢ SIDarch%t_%s.dbf;
SQL> alter system set log_archive_dest=‚¬„¢/oracle/SID/archivelogs;
Check archivelog destination and format
SQL> select name,value from v$parameter where name=‚¬„¢log_archive_format‚¬„¢;
SQL> select name,value from v$parameter where name=‚¬„¢log_archive_dest‚¬„¢;
Backup or Copy original "initSID.ora" :
# cp /oracle/SID/920_64/dbs/initSID.ora /oracle/SID/920_64/dbs/initSID.ora.orig
SQL> create pfile=‚¬„¢ /oracle/SID/920_64/dbs/initSID.ora‚¬„¢ from spfile;
SQL> alter database archivelog;
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
SQL> alter database open;
SQL> exit

PROCEDURE 2 [only do this procedure if procedure 1 above failed]

This procedure update the pfile directly. The pfile should be in either $ORACLE_BASE/admin/SID/pfile or $ORACLE_HOME/admin/SID/pfile.

Login as "ora" or su - from "root" at operating system.
# sqlplus /nolog
SQL > connect / as sysdba
Checking the current archive mode status, if status "NOARCHIVELOG" than shutdown database to run enable archivelog mode procedure.
SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
NOARCHIVELOG
SQL > shutdown immediate;
SQL > exit
# vi $ORACLE_BASE/admin/SID/pfile
Add the following lines to the end of the pfile :
# Archive Log Destinations #
log_archive_dest_1='location=/oracle/SID/archivelogs'
log_archive_start=TRUE
Startup the database in mount mode and put it in archivelog mode.
# sqlplus /nolog
SQL > connect / as sysdba
SQL > startup mount;
SQL> alter database archivelog;
SQL> alter database open;
Check archivelog destination and status
SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
ARCHIVELOG
SQL> show parameter log_archive_dest_1
SQL> show parameter spfile;
SQL> show parameter log_archive_start;
Test create archivelog
SQL> alter system switch logfile;
SQL> create pfile from spfile;
SQL> shutdown immediate;
SQL> startup
SQL> exit