Saturday, September 22, 2007

Enabling Archive Log

Enabling ARCHIVELOG Mode

Lets start by checking the current archive mode.

SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
NOARCHIVELOG

I'll add the following lines to the end of pfile:

log_archive_start=true
log_archive_dest_1="location=f:/mandatory"
log_archive_format=arch_%s.arc
log_archive_max_processes=2

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

SQL> startup mount
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 1300928 bytes
Variable Size 157820480 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.

SQL> alter database archivelog;
Database altered.

SQL> alter database open;
Database altered.

There are several system views that can provide us with information reguarding 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 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. Using these tables we can verify that we are infact in ARCHIVELOG mode:


SQL> select log_mode from v$database;
LOG_MODE------------ARCHIVELOG


SQL> select DEST_NAME,STATUS,DESTINATION from V$ARCHIVE_DEST;

Learn more about managing archive redo logs in the Oracle Database Administrator's Guide:


http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10739/archredo.htm

==================================================================

Disabling Archive Log Mode

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination f:/
Oldest online log sequence 26
Next log sequence to archive 28
Current log sequence 28

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

CHange the Values at init file, You can disable automatic archiving of filled redo log files by setting the LOG_ARCHIVE_START initialization parameter to FALSE or add # in the begining of parameters that are related to archive mode. check the following example:

#log_archive_start=true
#log_archive_dest_1="location=f:/ mandatory"
#log_archive_format=arch_%s.arc
#log_archive_max_processes=2

Then startup database in nomount mode, and disable archivelog mode.

SQL> startup mount
ORACLE instance started.

Total System Global Area 118255568 bytes
Fixed Size 282576 bytes
ariable Size 83886080 bytes
Database Buffers 33554432 bytes
Redo Buffers 532480 bytes
Database mounted.

SQL> alter database noarchivelog;

Database altered.

SQL> alter database open
2 /
Database altered.

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination D:\oracle\ora90\RDBMS
Oldest online log sequence 26
Current log sequence 28

No comments: