You are on page 1of 5

ORACLE-PEOPLESOFT DBA SCHOOL, E-508 KEERTHI APTS, BEHIND SARATHI STUDIOS,

AMEERPET, FACULTY: SATYA SEELAM (HARI) PH: 9966293445

Archive Files Management


The Oracle database can run in one of two modes:

 NOARCHIVELOG (Default)
 ARCHIVELOG (Optional)

Archiving:
The redo log files contain a record of all the changes that occur in the database.

These can CREATE, ALTER, DROP, TRUNCATE, INSERT, UPDATE, DELETE, MERGE, GRANT,
REVOKE, COMMIT, or ROLLBACK statements.

These changes are written to the redo log files by the Log Writer (LGWR) background processes.

Let us assume there are two redo log groups in the HRDEV database. The LGWR initially begins
writing to the first redo log file.

When this redo log file becomes full, Oracle performs a log switch and the LGWR starts writing
to the second redo log group.

When the second redo log file becomes full, it once again performs a log switch and returns to
the first redo log group.

At this point LGWR will overwrite the previous contents of the log file based on the archiving
mode of the database.

A database may operate in archivelog mode or noarchivelog mode.

The default archiving mode in a database is noarchivelog.

In noarchivelog mode the LGWR process can overwrite the contents of the first redo log file
without first saving its contents.

When a database is operating in archivelog mode, the LGWR will overwrite the contents of the
redo log file, only after the contents of the redo log file have been stored to an offline file called
the archive file.

An archive file is a copy of the redo log file, before it can be overwritten.

Archive files are used for recovering a database in the event of media failure.
ORACLE-PEOPLESOFT DBA SCHOOL, E-508 KEERTHI APTS, BEHIND SARATHI STUDIOS,
AMEERPET, FACULTY: SATYA SEELAM (HARI) PH: 9966293445

It is highly recommended that archive files be stored in an offline site in a fireproof storage
facility.

Archive files are created automatically by the ARCH background process whenever a log switch
occurs. This is known as automatic archiving.

In Oracle 10g enabling archiving in a database, by default, enables automatic archiving.

The given fig describes automatic archiving in the database.


ORACLE-PEOPLESOFT DBA SCHOOL, E-508 KEERTHI APTS, BEHIND SARATHI STUDIOS,
AMEERPET, FACULTY: SATYA SEELAM (HARI) PH: 9966293445

LGWR
ARCH
REDO LOG 1

LOGSWITCH

REDO LOG 2

ARCHIVE LOG FILE

Archiving in an Oracle Database

The backup and recovery strategies available to a database administrator vary depending on
the archiving mode of the database.
ORACLE-PEOPLESOFT DBA SCHOOL, E-508 KEERTHI APTS, BEHIND SARATHI STUDIOS,
AMEERPET, FACULTY: SATYA SEELAM (HARI) PH: 9966293445

The following steps can be used to put a database in archivelog mode.

a. Launch SQL*Plus, and logon as a user with SYSDBA privileges.


SQL>CONNECT DB_ADMIN/DB_ADMIN AS SYSDBA

b. Shut down the database properly.


SQL>SHUTDOWN IMMEDIATE;

c. Mount the database.

SQL>STARTUP MOUNT;

d. Put the database in archivelog mode.

SQL>ALTER DATABASE ARCHIVELOG;


e. Open the database.
SQL>ALTER DATABASE OPEN;

F. Exit SQL*Plus

SQL>EXIT

NOARCHIVELOG Mode
 In NOARCHIVELOG mode, the online redo log files are overwritten each time an online
redo log file is filled, and log switches occur.
 LGWR does not write a redo log group until the checkpoint for that group is completed.

ARCHIVELOG MODE
If the database is configured to run in ARCHIVELOG mode, active groups of filled online redo log
files must be archived.

This is done by the Oracle background process Archiver(ARCn).

Because all changes made to the database are recorded in the online redo log files, the
database administrator can use the physical backup and the archived online Redolog files to
recover the database without losing any committed data.
ORACLE-PEOPLESOFT DBA SCHOOL, E-508 KEERTHI APTS, BEHIND SARATHI STUDIOS,
AMEERPET, FACULTY: SATYA SEELAM (HARI) PH: 9966293445

Convert the Database in Archive Log Mode:


1. Shutdown the database.

SQL>SHUTDOWN;

2. Edit the init.ora file and add the following parameter.

$vi $ORACLE_HOME/dbs/initHRDEV.ora
LOG_ARCHIVE_DEST=/disk1/oradata/HRDEV/ARCH
3. Create a directory for the archive log file.

$mkdir /disk1/oradata/HRDEV/ARCH

4. Start the Database in MOUNT state and issue the following command

SQL>STARTUP MOUNT
SQL>ALTER DATABASE ARCHIVELOG;
SQL>ALTER DATABASE OPEN;
To check whether the database is in archive log mode:
SQL>ARCHIVE LOG LIST

You might also like