Saturday, January 12, 2013

How to enable ARCHIVELOG mode for a database

ARCHIVELOG mode has a number of benefits:
  • Database can be backed up online
  • Backup policy can be managed through RMAN
  • Database can be recovered point-in-time
By default a database is created in NOARCHIVELOG mode. Here is a sequence of steps to perform in order to enable ARCHIVELOG mode for a database:
  1. Connect as sysdba
  2. sqlplus / as sysdba
    
  3. Shut down the database
  4. SHUTDOWN IMMEDIATE;
    
  5. Modify pfile by setting LOG_ARCHIVE_START parameter to true
  6. LOG_ARCHIVE_START=TRUE
    
  7. Startup and mount your database using your parameter file or create spfile from your pfile and then mount
  8. STARTUP MOUNT PFILE='/u01/app/oracle/product/11.2.0.3/dbs/init.ora';
    
    or
    CREATE SPFILE='/u01/app/oracle/product/11.2.0.3/dbs/spfile.ora' FROM PFILE='/u01/app/oracle/product/11.2.0.3/dbs/init.ora';
    STARTUP MOUNT;
    
  9. Enable ARCHIVELOG mode
  10. ALTER DATABASE ARCHIVELOG;
    
  11. Open your database
  12. ALTER DATABASE OPEN;
    
After you ran all the above, check the status of your database with the following command:
ARCHIVE LOG LIST;
The output should look something like that:
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     56
Next log sequence to archive   58
Current log sequence           58

No comments:

Post a Comment