Monday, March 19, 2012

Archive Log Commands


ARCHIVE LOG MODE COMMANDS :

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.
======================PFILE============================
SQL> alter database archivelog;
Database altered.

SQL>alter system archive log start to '/u01/oracle/archive' ;
======================================================

====================SPFILE============================
SQL> alter database archivelog;
Database altered.

SQL> alter system set log_archive_dest='/u01/oracle/archive' scope=spfile;
====================================================






To enable the database in archive log mode following parameters must be set in init.ora file of instance

log_archive_dest_1=’location=<path of the destination where u want the archive logs to be palced>’

log_archive_dest_state_1=enable

log_archive_start=true  /* this parameter is deprecated in Oracle 10gÂ

log_archive_format=arc_%t_%s_%r.dbf /* to specify the format names of archive logs

After making changes in init.ora file start the database in mount phase from sqlplus

SQL> startup mount;

then issue following command

SQL> alter database archivelog;

Database altered

then open the database

SQL> alter database open;

Database altered

To ensure whether database has put in archive log mode give the following command

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination  /export/home/oracle/temp/oracle/arch
Oldest online log sequence  7
Next log sequence to archive  9
Current log sequence give switch logfile and ensure that log sequenec count has been incremented and archives are also generated at the destination specified by log_archive_dest_1=

SQL> alter system switch logfile;

SQL> archive log list

Database log mode  Archive Mode
Automatic archival  Enabled
Archive destination /export/home/oracle/temp/oracle/arch
Oldest online log sequence 8
Next log sequence to archive  10
Current log sequence  10

##############################################################################################

No comments:

Post a Comment