Tuesday, 17 April 2012

Database ARCHIVELOG mode: Overview

Database ARCHIVELOG mode: Overview

An Oracle database could be in ARCHIVELOG or NOARCHIVELOG mode. When the database is in ARCHIVELOG mode, backups are taken of the redo log files when the redo logs are full or switched. That assure that all the database operations are kept in 2 places (in data files and in archive log files). Having the database in ARCHIVELOG mode assure us that the data will not be lost even if the original data (from datafiles) will become inaccessible or will be deleted accidentally.

ARCH Process

In ARCHIVELOG mode, the database will make copies of all online redo logs after they are filled. These copies are called archived redo logs. The archived redo logs are created via the ARCH process. The ARCH process copies the archived redo log files to one or more archive log destination directories.

Configuring the database for ARCHIVELOG Mode

The use of ARCHIVELOG mode requires some configuration of the database. First you must put the database in ARCHIVELOG mode and you must also configure the ARCH process, and prepare the archived redo log destination directories. In earlier versions of Oracle you had to enable a special Oracle process called ARCH by setting another parameter. Oracle Database 10g does not require this. When the database is in ARCHIVELOG mode, it will start the ARCH process automatically.

To see if the database is in archivelog mode or not?

SELECT LOG_MODE FROM V$DATABASE;

Putting the database in ARCHIVELOG Mode

SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

ARCHIVE LOG LIST: displays log mode, automatich archival, archive destination.

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

How to OFF the archive mode?

ALTER DATABASE ARCHIVELOG OFF;

No comments:

Post a Comment