Thursday, April 19, 2018

Enable & Disable Archive log mode

Enable archivelog mode:

  1. Verify the archive mode and the Archive destination:
a.       Verify that the database is in "No archive mode”
SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     25
Current log sequence           27
SQL>

b.      By default, the archive destination will be flash recovery area.

SQL> show parameter recovery_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/flash_recovery
                                                 _area
db_recovery_file_dest_size           big integer 5000M
SQL>

c.       If you wish to change the archive log location, then edit “LOG_ARCHIVE_DEST_n” parameter to the path needed.
SQL> alter system set log_archive_dest_1='LOCATION=/u02/app/oracle/oradata/orcl/arch' scope = both;

System altered.

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u02/app/oracle/oradata/orcl/arch
Oldest online log sequence     25
Current log sequence           27
SQL>

  1. Shut down the database and bring it up to “mount” mode.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount
ORACLE instance started.

Total System Global Area 4275781632 bytes
Fixed Size                  2235208 bytes
Variable Size            2634024120 bytes
Database Buffers         1627389952 bytes
Redo Buffers               12132352 bytes
Database mounted.
SQL>

  1. Enable the archive log mode.
SQL> alter database archivelog;

Database altered.

SQL>

  1. Open the database.
SQL> alter database open;

Database altered.

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/app/oracle/oradata/orcl/arch
Oldest online log sequence     25
Next log sequence to archive   27
Current log sequence           27
SQL>

  1. Test if the archive logs are generated in the designated location by switching log files.
SQL> alter system switch logfile;

System altered.

SQL>


Disable archivelog mode:

  1. Shut down the database and bring it up to “mount” mode.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount
ORACLE instance started.

Total System Global Area 4275781632 bytes
Fixed Size                  2235208 bytes
Variable Size            2634024120 bytes
Database Buffers         1627389952 bytes
Redo Buffers               12132352 bytes
Database mounted.
SQL>

  1. Disable the archive log mode.
SQL> alter database noarchivelog;

Database altered.

SQL>

  1. Open the database and confirm if the archive log is disabled.

SQL> alter database open;

Database altered.

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u02/app/oracle/oradata/orcl/arch
Oldest online log sequence     30
Next log sequence to archive   31
Current log sequence           31
SQL>






No comments:

Post a Comment