 |
|
Oracle archive Log tips
Oracle Application Server Tips by Burleson
Consulting |
The archive logs are files created by the
Archive process (ARC) from the redo logs. Once a redo log is
full, the database performs a log switch and begins overwriting the
next redo log. The ARC process stats copying the changes from
the full redo log to an archive log file.
By default, the
archive log files are located in the infrastructure?s $ORACLE_HOME/dbs/arch
directory. The ARC process creates one file for each redo log
it copies (Figure 11-1). The archive log files are the
mechanism that oracle uses to recover the database from a backup.
Lets say that we took a backup of the metadata repository on Monday
and on Tuesday an operator deleted one of the database?s data files.
We shutdown the database, restore the one missing data file and
restart the database.
Oracle will see that the SNC for the
restored data files in incorrect and will determine which archive
log file has the first change it needs to apply and will begin
rolling the data file forward applying each change recorded in the
archive logs. The database will continue until the data file
is current.
When the ARC process is copying changes to archive
logs, the database is in ARCHIVELOG mode. When the installer
creates the Metadata Repository database it is created in
NOARCHIVELOG mode which means that to recover the database from a
backup you must first place it into ARCHIVELOG mode. To place
the database in ARCHIVELOG mode using the default log file
locations, you must shut it down, partially restart it, switch to
ARCHIVELOG mode and finally open the database.
[oracle@appsvr
oracle]$ $ORACLE_HOME/bin/sqlplus ?/ as sysdba?
# Change the log_archive_start=true
SQL> alter database set log_archive_start=true scope both;
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
NOTE: The Metadata Repository
database is created in NOARCHIVELOG mode. You must change it
to ARCHIVELOG mode to be able to recover and roll forward the
database. If the database is in NOARCHIVELOG mode you can only
restore the backup file and all changes made since that time will be
lost.
Now that you are in ARCHIVELOG mode, how
long do you keep the archive logs. The answer is, as long as
you maintain a backup. If you rotate backup tapes and maintain
a weeks worth of tapes, then you need to maintain a weeks worth of
archive logs.
If you no longer have the backup, the archive
logs for that backup are of no value. Likewise, if you have
the backup but have deleted the archive logs, the backup can only be
used to restore to the backup?s point in time. The database
can not roll forward with out the archive logs. Also, the
database can not skip a missing archive log. The database will
roll forward until it needs the missing archive log and no further.
Now that we have a basic understanding of
how Oracle maintains transaction logs, we need to discuss the
methods of backing up the database. The key to having a valid
backup is that each file is consistent and did not change during the
backup.
Now that we know the mechanisms Oracle uses
to protect data in the database we need to discuss the how those
features are used in backup and recovery.
This is an excerpt from "Oracle
10g Application Server Administration Handbook" by Don Burleson
and John Garmany.