Sunday, August 23, 2015

Enabling Archivelog

For non clustered, database archive logging can be enabled by the below method

Set the below parameters if Flash Recovery Area is being used
SQL> ALTER SYSTEM SET db_recovery_file_dest='/u01/FRA/ORCL/'; -- starting from version 10g and above
SQL> ALTER SYSTEM SET db_recovery_file_dest_size=10G;

If you decide not to use FRA, then the below parameters should be set
SQL> ALTER SYSTEM SET log_archive_start=TRUE SCOPE=spfile; -- required for 9i
SQL> ALTER SYSTEM SET log_archive_dest_1='location=/u01/oradata/ORCL/archive/' SCOPE=spfile;
SQL> ALTER SYSTEM SET log_archive_format='arch_%t_%s.arc' SCOPE=spfile;

If the above has been set perform the below.
SQL> SHUT IMMEDIATE;
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;

For clustered database, follow the steps below
Logon to any of the node in the cluster
$ sqlplus / as sysdba
Set the relevant archive parameters such as log_archive_dest_1 and log_archive_format as explained above and perform the below steps
SQL> ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile; -- required for DB version 10g and below
$ srvctl stop database -d DB_NAME
SQL> STARTUP MOUNT;
SQL> ARCHIVE LOG START; -- required for DB version 9i only
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER SYSTEM SET cluster_database=TRUE SCOPE=spfile; -- required for DB version 10g and below
SQL> SHUTDOWN IMMEDIATE;
$ srvctl start database -d DB_NAME

Now archive log has been turned on.

Happy logging!!

No comments:

Post a Comment