Thursday, August 11, 2011

How to enable Automatic ArchiveLog in Oracle 11g Database

To check whether the database is in Archive log mode or not

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination None
Oldest online log sequence 564
Current log sequence 566

Set the archival destination

SQL> alter system set log_archive_dest_1='LOCATION=PRMRYDSK_GRP' scope=both;

System altered.

Shutdown the database and start in Mount state

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

SQL> startup mount
ORACLE instance started.
Total System Global Area 8752304128 bytes
Fixed Size 2213792 bytes
Variable Size 1543506016 bytes
Database Buffers 7180648448 bytes
Redo Buffers 25935872 bytes
Database mounted.

Enable archive log

SQL>alter database archivelog;

Database altered.

Open the database
SQL> alter database open;

Database altered.

Shutdown and startup the DB.(This step is not mandatory)

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

SQL> startup
ORACLE instance started.
Total System Global Area 8752304128 bytes
Fixed Size 2213792 bytes
Variable Size 1543506016 bytes
Database Buffers 7180648448 bytes
Redo Buffers 25935872 bytes
Database mounted.
Database opened.

Check whether the automatic archive log mode is enabled

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination PRMRYDSK_GRP
Oldest online log sequence 564
Next log sequence to archive 566
Current log sequence 566
SQL>

No comments: