Philip Howe’s Oracle Blog

Just another WordPress.com weblog

Archivelog Mode

Posted by philiphowe on February 19, 2020

We can see whether archivelog mode is enabled (works on just about all versions of oracle database:

[oracle@myserver]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 8 12:02:52 2010
Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     62
Current log sequence           64
SQL>

In this database, the archivelog destination in this database is currently set to use the DB_RECOVERY_FILE_DEST parameter. Note, yours may be pointing to another location:

SQL> show parameter db_recovery_file_dest
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /oracle/archivelogs
db_recovery_file_dest_size           big integer 1000M
SQL>

ENABLING ARCHIVELOG MODE:

SQL> shutdown immediate
...
SQL> startup mount
...
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enaabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     62
Current log sequence           64
SQL>

Now, switch the logfile, and an archivelog will be written:

SQL> alter system switch logfile;

System altered.

SQL>!ls /oracle/archivelogs/
1_01_23444412.dbf

SQL>

Recap: Comands to enable:

[oracle@myserver]$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL>
SQL> archive log list 
Database log mode Archive Mode 
Automatic archival Enabled 
Archive destination USE_DB_RECOVERY_FILE_DEST 
Oldest online log sequence 62 
Current log sequence 64 
SQL>

DISABLING ARCHIVELOG MOD is basically the same commands in reverse:

[oracle@myserver]$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup mount
SQL> alter database noarchivelog;
SQL> alter database open;
SQL>
SQL> archive log list 
Database log mode No Archive Mode 
Automatic archival Disabled 
Archive destination USE_DB_RECOVERY_FILE_DEST 
Oldest online log sequence 62 
Current log sequence 64 
SQL>

 

Leave a comment