Tuesday, June 11, 2019

Change noarchivelog mode to archivelog mode in RAC


To check database is in archive log mode or not :

Run the command archive log list;

[oracle@node4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 10 12:29:02 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL>
SQL> archive log list
Database log mode        No Archive Mode
Automatic archival        Disabled
Archive destination        /u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/arch
Oldest online log sequence     2
Current log sequence        3
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

Based on above result database is in  "no archive mode".
This means database is not in archive log mode.

To enable the database in archive log mode in RAC  run the below commands.

1. Stop the database using SRVCTL.
2. Start database in mount state.
3. Run the command to enable the archive mode "alter database archivelog;"
4. Stop the database using SRVCTL.
5. Start database using SRVCTL.
6. Set the archive destination to ASM DISK by running the command
alter system set log_archive_dest_1='LOCATION=+FRADG/' scope=both sid='*';

After that connect to Sql and run  archive log list


Stop the database using SRVCTL :

[oracle@node4 ~]$ srvctl stop database -d racdb
[oracle@node4 ~]$

Start databse in mount state :

[oracle@node4 ~]$ srvctl start database -d racdb -o mount
[oracle@node4 ~]$
[oracle@node4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 10 12:29:02 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select instance_name,status,archiver from gv$instance;

INSTANCE_NAME STATUS       ARCHIVE
---------------- ------------ -------
racdb1 MOUNTED      STOPPED
racdb2 MOUNTED      STOPPED

SQL>

Run the command to enable the archive mode :

SQL> alter database archivelog;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@node4 ~]$

Stop the database using SRVCTL :

[oracle@node4 ~]$ srvctl stop database -d racdb
[oracle@node4 ~]$

Start the database using SRVCTL

[oracle@node4 ~]$ srvctl start database -d racdb
[oracle@node4 ~]$

Set the archive destination to ASM DISK by running the command  :

[oracle@node4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 10 12:32:40 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter system set log_archive_dest_1='LOCATION=+FRADG/' scope=both sid='*';

System altered.

SQL> select instance_name,status,archiver from gv$instance;

INSTANCE_NAME STATUS       ARCHIVE
---------------- ------------ -------
racdb1 OPEN       STARTED
racdb2 OPEN       STARTED

SQL>

Check archive log mode now :
SQL> archive log list
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        +FRADG
Oldest online log sequence     2
Next log sequence to archive   3
Current log sequence        3
SQL>

To check log switch run the command

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> archive log list
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        +FRADG
Oldest online log sequence     4
Next log sequence to archive   5
Current log sequence        5
SQL> 

No comments:

Post a Comment

Thanks for giving comments!!