Thursday, December 17, 2009

Enable Archive log Mode for RAC database

Whether it is single instance database or multiple instance database, all changes made to the database are written into online redo log files. In an Oracle RAC environment, each instance have its own set of online redolog files that is known as thread. Each Oracle instance will use its set of online redologs in a circular fashion. If there is log switch occur then it will write to next online redo log file. If the database is in "Archive Log Mode", Oracle will make a copy of the online redo log before it gets reused. A thread must contain at least two online redologs so that it can archive it properly before it is used.

In a RAC environment each instance have exclusive right access to its own set of redo log files. That means suppose I have a database named arju and arju database has two nodes, arju1 instance and arju2 instance. arju1 instance can't write to online redo log files of arju2 instance. However each instance can read another instance's current online redolog file to perform instance recovery if that instance was terminated abnormally. So one instance must have read access of another online redo log files. It is therefore a requirement that online redo log files to be located on a shared storage device.

Whenever you create your database manually then by default database is in noarchive log mode. If you create your database with database configuration assistant (dbca) then there is a checkbox and check the box will enable your database archival mode. But if your database is in noarchivelog mode and you want to enable the archivelog mode then you must shutdown the database. So while enabling archivelog mode in RAC database you must shutdown your all instances. The following is the procedure to enable a database from noarchivelog mode to archivelog mode in RAC environment.

Step 01: Login to any instance and check the archival settings and location.
SQL> conn / as sysdba
SQL> archive log list

Step 02: If you need to change archival location then you can change it by
ALTER SYSTEM SET archival_parameter=new_value scope=both;

Step 03: Shutdown all RAC instances. The following command will shutdown all instances of orcl cluster database.
$ srvctl stop database -d orcl

Step 04: Connect to any of the local instance and MOUNT the database:

$ sqlplus "/ as sysdba"
SQL> startup mount

Step 05: Enable archive log mode.

SQL> alter database archivelog;

Step 06: Shutdown the local instance:
SQL> shutdown immediate

Step 07: Startup all the instances using srvctl.

$ srvctl start database -d orcl

Optionally, bring any services (i.e. TAF) back up using srvctl:

$ srvctl start service -d orcl

Step 08: Login to the local instance and verify Archive Log Mode is enabled:

$ sqlplus "/ as sysdba"
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 81
Next log sequence to archive 82
Current log sequence 82
After enabling Archive Log Mode, each instance in the RAC configuration can automatically archive redologs.

Related Documents

No comments:

Post a Comment