Jan 23, 2014

How to enable ARCHIVED LOG MODE

Please follow below steps to enable Archived Log Mode

1) Login to database

[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 24 06:23:47 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>



2) Check whether database in archivelog mode

SQL> archive log list
Database log mode           No Archive Mode
Automatic archival           Disabled
Archive destination           USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     7
Current log sequence           9
            OR
SQL> select log_mode from v$database;

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

1 row selected.

  2.a) Check current archive log location (Optional)
       SQL> show parameter recovery_file_dest
 
       NAME                  TYPE        VALUE
       --------------------- ----------- ----------------------
       db_recovery_file_dest string      /u02/app/oracle
                                         /flash_recovery_area
       db_recovery_file_dest
big integer 3852M
         _size

  2.b) Change archivelog location if required
       SQL> alter system set log_archive_dest_1='LOCATION=/u02
       /app/oracle/oradata/cosp1/arch' scope=both;        

       System altered.

       
Note: Please ensure the path exists as Oracle won't create directory structure. Hence it would throw specified value is invalid error;
SQL> alter system set log_archive_dest_1='LOCATION=/u02/app/oracle/oradata/cosp1/arch' scope=both;
alter system set log_archive_dest_1='LOCATION=/u02/app/oracle
/oradata/cosp1/arch' scope=both
*


ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated
ORA-07286: sksagdi: cannot obtain device information.
Linux Error: 2: No such file or directory


   2.c) Verify changed archivelog file location
               SQL> archive log list
               Database log mode                  No Archive Mode
               Automatic archival                  Disabled
               Archive destination                  /u02/app/oracle/oradata/cosp1/arch
               Oldest online log sequence      7
               Next log sequence to archive  9
               Current log sequence              9



3) Restart database in Mount Mode (Restarting database is also known as Bouncing Database)

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


SQL> startup mount
ORACLE instance started.

Total System Global Area  535662592 bytes
Fixed Size            1337720 bytes
Variable Size          180356744 bytes
Database Buffers      348127232 bytes
Redo Buffers            5840896 bytes
Database mounted.

4) Enable archivelog mode

SQL> alter database archivelog;

Database altered.


5) Open database 

SQL> alter database open;

Database altered.

6) Verify archivelog mode by switching logfile

SQL> alter system switch logfile;

System altered.


Navigate to your archive destination (/u02/app/oracle/oradata/cosp1/arch) and you will find new archived log generated.

1 comment: