Enable Archivelog Mode Oracle 12c



  1. Step by step enable Archive log and Flashback in Oracle 12c R2 RAC Database -Check Archive log is enabled or not-SQL archive log list Database log mode No.
  2. Recall from the discussion earlier in my blog that archive redo logs are created only if your Oracle database 12C is in archivelog mode.If you want to preserve your database transaction history to facilitate point-in-time and other types of recovery, you need to enable that mode.

An Oracle database can run in one of two modes. By default, the database is created in NOARCHIVELOG mode. This command will check to see if you have altered your database to run in ARCHIVELOG mode. $ sqlplus /nolog SQL connect sys/xxx as sysdba; connected. SQL archive log list; You can also query to see if you are in ARCHIVELOG mode. If you haven’t already done so, enabling your system to archive your Oracle 12c is a very simple process. However, keep these things in mind: You have to shut down and restart the database. You must have enough space to store your archive logs.

8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

ArchivelogEnable Archivelog Mode Oracle 12c

Home » Articles » Rac » Here

This article highlights the differences between resetting the archive log mode on a single node instance and a Real Application Clusters (RAC).

  • Single Instance
  • Real Application Clusters (RAC)

Single Instance

Oracle 9i

On a single node 9i instance the archive log mode is reset as follows.

Oracle 10g Upward

In Oracle 10g the LOG_ARCHIVE_START parameter and ARCHIVE LOG START command have been deprecated, so you will use the following code.

Real Application Clusters (RAC)

The ALTER DATABASE ARCHIVELOG command can only be performed if the database in mounted in exclusive mode. This means the whole clustered database must be stopped before the operation can be performed.

Oracle 9i

First we set the relevant archive parameters.

Since we need to mount the database in exclusive mode we must also alter the following parameter.

From the command line we can stop the entire clustered database using the following.

With the cluster down we can connect to a single node and issue the following commands.

Notice that the CLUSTER_DATABASE parameter has been reset to it's original value. Since the datafiles and spfile are shared between all instances this operation only has to be done from a single node.

From the command line we can now start the clustered database again using the following.

The current settings place all archive logs in the same directory. This is acceptable since the thread (%t) is part of the archive format preventing any name conflicts between instances. If node-specific locations are required the LOG_ARCHIVE_DEST_1 parameter can be repeated for each instance with the relevant SID prefix.

Oracle 10gR1

If the LOG_ARCHIVE_DEST_n parameters are not set, the archived redo logs will be placed in the FRA. If you want to specify their location and the file name format manually, you can do it as follows.

Since we need to mount the database in exclusive mode we must also alter the following parameter.

From the command line we can stop the entire clustered database using the following.

With the cluster down we can connect to a single node and issue the following commands.

Notice that the CLUSTER_DATABASE parameter has been reset to it's original value. Since the datafiles and spfile are shared between all instances this operation only has to be done from a single node.

From the command line we can now start the clustered database again using the following.

Oracle 10gR2

From 10gR2, you no longer need to reset the CLUSTER_DATABASE parameter during the process.

Oracle

If the LOG_ARCHIVE_DEST_n parameters are not set, the archived redo logs will be placed in the FRA. If you want to specify their location and the file name format manually, you can do it as follows.

From the command line we can stop the entire clustered database and start it in mount mode using the following.

With the database mounted issue the following commands.

Oracle Enable Archivelog

Since the datafiles and spfile are shared between all instances this operation only has to be done from a single node.

From the command line we stop and start the clustered database again using the following commands.

Oracle 11g

The process is exactly the same in 11g as in the previous Oracle 10gR2 section.

Oracle 12c

The process is exactly the same in 12c as in the previous Oracle 10gR2 section.

For more information see:

Hope this helps. Regards Tim...

Enable Archivelog Mode

---Check Archive log is enabled or not--------
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /d01/app/oracle/product/12.2.0.1/db_1/dbs/arch
Oldest online log sequence 16
Current log sequence 17
SQL>
------Check Database Configuration------------
-bash-4.4$ srvctl config database -d cdbpr
Database unique name: cdbpr
Database name: cdbpr
Oracle home: /d01/app/oracle/product/12.2.0.1/db_1
Oracle user: oracle
Spfile: +CDATA/CDBPR/PARAMETERFILE/spfile.269.1037317075
Password file: +CDATA/CDBPR/PASSWORD/pwdcdbpr.260.1037316549
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: CDATA,ADATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: cdbpr1,cdbpr2
Configured nodes: badc-cdbpr01,badc-cdbpr02
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
-bash-4.4$
SQL> show parameter recovery
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
recovery_parallelism integer 0
remote_recovery_file_dest string
SQL>
----Change Flashback retention period--------
SQL> show parameter db_flashback_retention_target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 1440 -----------> (Minutes)
SQL>
SQL> alter system set db_flashback_retention_target=2880 scope=both sid='*';
System altered.
SQL> show parameter db_flashback_retention_target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 2880 -------------> (Minutes ---48 Hours)
SQL>
----Set db_recovery_file_dest_size and db_recovery_file_dest system parameter for total size limit for flashback recovery.
SQL> alter system set db_recovery_file_dest_size=900G scope=both sid='*';
System altered.
SQL> alter system set db_recovery_file_dest='+FRA' scope=both sid='*';
System altered.
SQL>
SQL> show parameter recovery
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string +FRA
db_recovery_file_dest_size big integer 900G
recovery_parallelism integer 0
remote_recovery_file_dest string
SQL>
-----Shutdown Database for both instance---

-bash-4.4$ srvctl stop database -d cdbpr
-bash-4.4$
-bash-4.4$ sqlplus
SQL*Plus: Release 12.2.0.1.0 Production on Fri Apr 24 14:40:08 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 5.3687E+11 bytes
Fixed Size 30051944 bytes
Variable Size 5.0251E+11 bytes
Database Buffers 3.3286E+10 bytes
Redo Buffers 1043685376 bytes
Database mounted.
SQL>
-------------Enable Archive log first then enable Flashback--------
SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-38706: Cannot turn on FLASHBACK DATABASE logging.
ORA-38707: Media recovery is not enabled.
SQL> alter database archivelog;
Database altered.
SQL> alter database flashback on;
Database altered.
SQL>
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
SQL>
SQL> alter database open;
Database altered.
SQL>
-------Shutdown Instance------
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
-------Start Database with both instance simultaneously-------
-bash-4.4$ srvctl start database -d cdbpr
-bash-4.4$
----Check Archive Log and Flashback enable from both instance -------
SQL> select INST_ID,FLASHBACK_ON,NAME from GV$DATABASE;
INST_ID FLASHBACK_ON NAME
---------- ------------------ ---------
1 YES CDBPR
2 YES CDBPR
SQL>