Tuesday, August 12, 2014

Enable and Disable Archive Log Mode in Oracle 10g/11g

Enable Archive Log Mode:

Follow below steps to enable archive log mode on an Oracle 10g or 11g databases.

[oracle@primdb ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Aug 12 20:57:58 2014
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> archive log list;
Database log mode            No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     39
Next log sequence to archive   41
Current log sequence           41
SQL> 

The log mode is No Archivelog mode. The archive destination is USE_DB_RECOVERY_FILE_DEST. You can see by looking at the parameter RECOVERY_FILE_DEST.

SQL> show parameter recovery_file_dest;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ----------------------------------
db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_area
db_recovery_file_dest_size        big integer 4122M
SQL> 

By default, archive logs are written to the flash recovery area. If you want to change that location you can set the parameter LOG_ARCHIVE_DEST_n to the new location which we want to write archive logs.

SQL> alter system set log_archive_dest_1='LOCATION=/u02/app/oracle/arch' scope = both;

System altered.

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u02/app/oracle/arch
Oldest online log sequence     39
Next log sequence to archive   41
Current log sequence           41
SQL> 

Now we shutdown the database and open the database in mount state.

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

SQL> startup mount;
ORACLE instance started.
Total System Global Area  534462464 bytes
Fixed Size                  2230072 bytes
Variable Size             394266824 bytes
Database Buffers          130023424 bytes
Redo Buffers                7942144 bytes
Database mounted.
SQL> 

Now you set archive log mode and open the database.

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/app/oracle/arch
Oldest online log sequence     39
Next log sequence to archive   41
Current log sequence           41
SQL>

Now we can see archivelog mode is enabled.

Disable Archive Log Mode:

Follow below steps to disable archive log mode on an Oracle 10g or 11g databases.

[oracle@primdb ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Aug 12 21:05:05 2014
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> 
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/app/oracle/arch
Oldest online log sequence     39
Next log sequence to archive   41
Current log sequence           41
SQL> 

Database is in Archivelog mode. We need to shutdown the database and open in mount state.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area  534462464 bytes
Fixed Size                  2230072 bytes
Variable Size             394266824 bytes
Database Buffers          130023424 bytes
Redo Buffers                7942144 bytes
Database mounted.
SQL> 

Now disable archivelog mode and open the database.

SQL> alter database noarchivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u02/app/oracle/arch
Oldest online log sequence     39
Next log sequence to archive   41
Current log sequence           41
SQL> 

Now you can see archivelog mode has been disabled.

Hope this will help you... :)

Best Regards,    

No comments:

Post a Comment

Some Most Popular Articles