Friday, May 6, 2011

Steps for changing archive log mode and archive log destination

Hi,
The below post seems to be very simple but has it importance when it comes to maintaining archive logs and doing Database recovery.

Below are the steps for changing archive log mode:

For changing the archive log mode we have to shutdown the database and we have to do it only it mount state
as follows:

Step 1:
---------

SQL> select name from v$database;

NAME
---------
ORACLE11

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 25
Current log sequence 27
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

Step 2:
--------

SQL> startup mount
ORACLE instance started.

Total System Global Area 431038464 bytes
Fixed Size 1375088 bytes
Variable Size 327156880 bytes
Database Buffers 96468992 bytes
Redo Buffers 6037504 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

Step 3:
--------


SQL> alter database open;

Database altered.

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 25
Next log sequence to archive 27
Current log sequence 27

We can change the archive log destination online which is very much useful when your archive destination is almost going to filled.

Changing archive log destination:
Below is a simple command to do it.Here I'm changing from flash recovery area(DB_RECOVERY_FILE_DEST) path(Default location
of archives) to new location.

SQL> select name from v$database;

NAME
---------
ORACLE11

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> ALTER SYSTEM SET log_archive_dest_1='location=D:\Oracle11gDB\archives';

System altered.

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination D:\Oracle11gDB\archives
Oldest online log sequence 25
Next log sequence to archive 27
Current log sequence 27
(OR)
In Linux OS below command can be used:
SQL> ALTER SYSTEM SET log_archive_dest_1='LOCATION=/u02/archives';

System altered.

In my upcoming posts I will explain how this archives are useful for recovery purpose.Some times small things matters the most.

Hope it helps.


Best regards,

Rafi.

No comments:

Post a Comment