ARCHIVE LOG MANAGEMENT:
A database has ARCHIVE LOG and NO ARCHIVE LOG modes. We can can query “archive log list” to know your database archive log mode. When the database is in NO ARCHIVE LOG mode, redo log files will get overwritten each time all the redo groups are switched and we cannot have backups of those redo logs. Hence, we use ARCHIVELOG mode, where each logfile gets archived as backups before log writer (LGWR) overwrites the logfile. When the database is ARCHIVELOG mode, we can assure complete recovery using archived log files.
Switching ARCHIVE LOG and NO ARCHIVE LOG modes
Use below commands to switch database to ARCHIVELOG or NOARCHIVELOG mode. Remember that, we need to open database in mount stage to change the archivelog mode as we cannot change it when the database is open.
To check database current mode:
SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 45 Next log sequence to archive 46 Current log sequence 46
To switch the database to NOARCHIVELOG mode:
SQL> shutdown; SQL> startup mount; SQL> alter database noarchivelog; SQL> alter database open;
To switch the database to ARCHIVELOG mode:
SQL> shutdown; SQL> startup mount; SQL> alter database archivelog; SQL> alter database open;
To enable automatic archiving of redo logs set log_archive_start=true in init.ora file.
To enable automatic archiving after instance startup:
SQL> alter system archive log start;
To switch the logs:
SQL> alter system switch logfile;
Destination of archive logs:
To change the destination of archive files shutdown the instance, change the parm in init.ora and then restart the instance
Format of archive file names:
%s is the sequence number
%t is the thread number