ORACLE 19c standard edition 2 : Active-passive cluster using Oracle clusterware

As we know from ORACLE 19c Oracle RAC is no longer supported within Standard edition 2. In this blog post, we will take a quick look at one of the alternative to configure high availability:  configuring active-passive cluster using Oracle clusterware.

Target platform :

Capture 01

The first step after creating a new database instance is to remove it from the clusterware :


srvctl remove database –d orcl2

I will show two different way for registering our database instance “orcl2” to insure high availability:

Using the “cluster_resource” type and an ACTION_SCRIPT:

  1. Create an ACTION_SCRIPT : db_admin.sh
#!/bin/sh
export ORACLE_SID=${_CRS_NAME}
export ORAENV_ASK=NO

. /usr/local/bin/oraenv >/dev/null 2>&1
case $1 in
'start')
/home/oracle/start_database.sh
/bin/ps -ef |/bin/grep ora_pmon_${ORACLE_SID}|/bin/grep -v grep
RET=$?
;;
'stop')
/home/oracle/stop_database.sh
RET=$?
;;
'clean')
/home/oracle/clean_database.sh
RET=0
;;
'check')
/bin/ps -ef |/bin/grep ora_pmon_${ORACLE_SID}|/bin/grep -v grep
RET=$?
;;
*)
RET=0
;;
esac

if [ $RET -eq 0 ]; then
exit 0
else
exit 1
fi

2. Create a configuration file with the resources parameters “orcl2.config”
ACL=owner:oracle:rwx,pgrp:dba:rwx,other::r–
ACTION_SCRIPT=/home/oracle/db_admin.sh
ACTIVE_PLACEMENT=0
AUTO_START=restore
CARDINALITY=1
CHECK_INTERVAL=10
DEGREE=1
DESCRIPTION=Resource orcl2 DB
ENABLED=1
HOSTING_MEMBERS=rac1 rac2
LOGGING_LEVEL=1
PLACEMENT=restricted
RESTART_ATTEMPTS=5
START_TIMEOUT=600
STOP_TIMEOUT=600
UPTIME_THRESHOLD=1h

3. Copy the action_script , password_file,parameter file to the other server “rac2” and add a new entry for the database in “/etc/oratab”
4. Register the new instance with the clusterware

crsctl add resource orcl2 -type cluster_resource -file /home/oracle/orcl2.config
 

5. Test it !

Check the resource status :

Capture 02

Relocate the resource :

Capture 03

Check the resource parameters

Capture 04

Using the “generic_application” type:

1. Modify the action script line “export ORACLE_SID=${_CRS_NAME}” with “export ORACLE_SID=$2”
2. Register the new instance with the clusterware :

crsctl add resource orcl2 -type generic_application -attr   "START_PROGRAM='/home/oracle/db_admin.sh start orcl2', \
  CHECK_PROGRAMS='/home/oracle/db_admin.sh check orcl2' , \
  STOP_PROGRAM='/home/oracle/db_admin.sh stop orcl2',  \
  CLEAN_PROGRAM='/home/oracle/db_admin.sh stop orcl2' "
 

3. Test it !

Enable STDOUT output display :

crsctl modify res orcl2 -attr "SEND_OUTPUT_ALWAYS=1"

Relocate resource:

Capture 05

That’s it 😀

 

REF :

 

 

2 thoughts on “ORACLE 19c standard edition 2 : Active-passive cluster using Oracle clusterware

  1. Hello Mahmoud,

    Great acticle.

    In my Customer env. this kind of configuration exists for standalone configuration. It is means “cold failover”.
    Database as added to Clusteware as application type to cut cost of licences :). Databases version start from 10 🙂

    Regards,
    Witek

  2. Hi,

    Great article. What’s the pro’s/con’s of using cluster_resource vs generic_application types for an database?

    Kind Regards,
    Chris

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s