Enabling Archive - Log Mode
Enabling Archive - Log Mode
So we're in NOARCHIVELOG mode and we need to change. We can use a database alter statement, but that won't be
permanent, so we have to update the pfile directly. The pfile should be in either $ORACLE_BASE/admin/SID/pfile or
$ORACLE_HOME/admin/SID/pfile. Add the following lines to the end of the file:
############################
# Archive Log Destinations -benr(10/15/04)
############################
log_archive_dest_1='location=/u02/oradata/cuddle/archive'
log_archive_start=TRUE
Note that we're not actually required to specify the location of the log destination, but if we don't it'll end up in strange
places (in my test it went to $ORACLE_HOME/dbs making a mess). You can specify as many as 10 different archive
log destinations by using the parameters log_archive_dest_1 through log_archive_dest_10. Remember, if you run out
of space in your archive log destination the database will shut down!
Now we can startup the database in mount mode and put it in archivelog mode.
[oracle@vixen pfile]$sqlplus sys/passwd as sysdba;
SQL*Plus: Release 10.1.0.2.0 - Production on Tue Jun 30 16:00:58 2009
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
Database mounted.
184549376
1300928
157820480
25165824
262144
bytes
bytes
bytes
bytes
bytes
You can see here that we put the database in ARCHIVELOG mode by using the SQL statement "alter database
archivelog", but Oracle won't let us do this unless the instance is mounted but not open. To make the change we
shutdown the instance, and then startup the instance again but this time with the "mount" option which will mount the
instance but not open it. Then we can enable ARCHIVELOG mode and open the database fully with the "alter database
open" statement.
COMPILATION BY: - SANKET S. PRADHAN
There are several system views that can provide us with information regarding archives, such as:
V$DATABASE
Identifies whether the database is in ARCHIVELOG or NOARCHIVELOG mode and whether MANUAL
(archiving mode) has been specified.
V$ARCHIVED_LOG
Displays historical archived log information from the control file. If you use a recovery catalog, the
RC_ARCHIVED_LOG view contains similar information.
V$ARCHIVE_DEST
Describes the current instance, all archive destinations, and the current value, mode, and status of these
destinations.
V$ARCHIVE_PROCESSES
Displays information about the state of the various archive processes for an instance.
V$BACKUP_REDOLOG
Contains information about any backups of archived logs. If you use a recovery catalog, the
RC_BACKUP_REDOLOG contains similar information.
V$LOG
A display all redo log groups for the database and indicates which need to be archived.
V$LOG_HISTORY
Contains log history information such as which logs have been archived and the SCN range for each archived
log.
Using these tables we can verify that we are intact in ARCHIVELOG mode:
SQL> select log_mode from v$database;
LOG_MODE
-----------ARCHIVELOG
SQL> select DEST_NAME, STATUS, DESTINATION from V$ARCHIVE_DEST;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
To Clear Archive Logs
(1432)
$ rman target sys/galaxy
RMAN> DELETE ARCHIVELOG ALL COMPLETED BEFORE 'TRUNC(SYSDATE-5)';(To clear archive logs 5 days before)
RMAN> crosscheck archivelog all;
(To check archivelog count)
RMAN> delete archivelog all;
(To clear all archive logs)