Wednesday, 5 September 2012



Enabling ARCHIVELOG Mode

If your going to enable archivelog mode on a real database thats important to you, I would recommend shutting down the database and doing a cold backup just in case. Keeping a "final noarchivelog mode backup" seems to be a good and excepted practice.
Lets start by checking the current archive mode.


SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
NOARCHIVELOG


So we're in NOARCHIVELOG mode and we need to change.
We can use a database alter statement, but that won't be perminant, so lets just update the pfile directly.
The pfile should be in either $ORACLE_BASE/admin/SID/pfile or $ORACLE_HOME/admin/SID/pfile.


I'll add the following lines to the end of the file:
############################
# Archive Log Destinations
############################
log_archive_dest_1='location=/u01/oradata/dir/archive'
log_archive_start=TRUE


Now we can startup the database in mount mode and put it in archivelog mode.


[oracle@oracle11i ~]$ sqlplus sys/passwd as sysdba
SQL*Plus: Release 11.2.0.2.0 - Production on Wed Sep 04 16:00:58 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.


SQL> startup mount
ORACLE instance started.
Total System Global Area 184549376 bytes

Fixed Size 1300928 bytes
Database Buffers 25165824 bytes

Variable Size 157820480 bytes 
Redo Buffers 262144 bytes
Database mounted.


SQL> alter database archivelog;
Database altered.


SQL> alter database open;
Database altered.


SQL> select log_mode from v$database;

LOG_MODE
 ------------
ARCHIVELOG

Thus the database is enabled in archivelog mode.
System views that can provide us with information reguarding archives are listed below:


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
Displays 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.







No comments:

Post a Comment