Prepare Your Scripts

You must provide custom scripts to Oracle Cloud Infrastructure Full Stack Disaster Recovery Service for certain actions in the switchover and failover plans.

About Scripts for Replicating the Oracle WebLogic Server for OCI Configuration

If you're using “OCI File Storage with rsync” or “Database File System (DBFS)” methods and configuration replication scripts to copy the Oracle WebLogic domain to the standby site, then you can add them as a “user step” to the switchover plan.

Note:

This applies to Disaster Recover models based on “OCI File Storage with rsync” and “Database File System (DBFS)” methods for configuration replication.

This step does NOT apply to Disaster Recovery model based on Oracle Cloud Infrastructure Block Volumes cross-region replica.

If you're using configuration replication scripts to copy the Oracle WebLogic Domain to the standby site, then you can add them as a user step to the switchover plan.

If the Oracle WebLogic configuration in standby is already up-to-date with primary, then running them is not mandatory. If not, you can run the scripts right before the switchover to get the latest configuration from primary in the standby’s Oracle WebLogic domain.

For Oracle WebLogic Server for OCI and Oracle SOA Suite on Marketplace disaster recovery cases, you must run the scripts first in the Administration host 0 of the site that has the primary role, and then in the Administration host of the site that has the standby role.

For the scripts, see Oracle WebLogic Server for Oracle Cloud Infrastructure, Disaster Recovery Production and DR in the Oracle Cloud Infrastructure (OCI) and SOA Suite on Oracle Cloud Infrastructure Marketplace Disaster Recovery, Production and Disaster Recovery in the Oracle Cloud Infrastructure (OCI).

Locate the path of the script in the Administration hosts. For example, /u01/scripts/config_replica.sh.

About the Script to Update the Database Connect String

If you're using the disaster recovery model based on OCI Block Volumes cross-region replica, then you must perform a replacement on the Oracle WebLogic Domain configuration after a switchover or failover operation.
The Oracle WebLogic Domain configuration is a copy from primary. Because the database connect string in the Oracle WebLogic configuration files points to primary database, you need to replace it with the secondary database connection details after a switchover or failover. And conversely when there is a switchback or failback.

Note:

This task only applies to the Disaster Recovery model based on OCI Block Volumes cross-region replication. This task does NOT apply to Disaster Recovery models based on “OCI File Storage with rsync” and “Database File System (DBFS)” methods for configuration replication.

To automate this replacement, use the script replacement_script_BVmodel.sh. This script is provided in Oracle WebLogic Server for Oracle Cloud Infrastructure, Disaster Recovery Production and DR in the Oracle Cloud Infrastructure (OCI) and SOA Suite on Oracle Cloud Infrastructure Marketplace Disaster Recovery, Production and Disaster Recovery in the Oracle Cloud Infrastructure (OCI) for the Block Volume cross-region DR model. You place this script in all of the WebLogic nodes, in primary and standby, in a folder that is not in a Block Volume that is replicated. The script must be customized with the appropriate values in each region.

Locate the path of the script in the hosts. For example, /u01/scripts/replacement_script_BVmodel.sh.

When you define the switchover and failover plans, you'll add this script to the plans as a user-defined step.

Create Scripts to Start and Stop Oracle WebLogic Processes

Create custom scripts to invoke to stop and start Oracle WebLogic processes. If you already have custom scripts to stop and start the Oracle WebLogic processes, then you can use them in your OCI Full Stack Disaster Recovery Service plans. Alternatively, use the wls_stop.sh and wls_start.sh scripts provided in the Download Code section. These scripts are valid for Oracle WebLogic Server for OCI and Oracle SOA Suite on Marketplace. These scripts start and stop all of the Oracle WebLogic processes (administration server, managed server, and node manager) or each process separately.

For switchover and failover operations performed by OCI Full Stack Disaster Recovery Service, Oracle recommends using the following scripts. These example scripts make use of the provided wls_stop.sh and wls_start.sh scripts (they invoke them with specific options), and will be called from custom plan groups when you define the DR plans later:

  1. Create a script to start the Oracle WebLogic Administration server in the mid-tier administration host. It will also start the node manager, in the event it is stopped.
    The following is an example script: custom_start_aserver.sh. Place this custom script in a folder in the mid-tier host, for example, in /opt/scripts. The full path to the script is provided in the DR plans.
    # Remove .pid, .lck and .state files (that could have been left behind if a previous crash) before starting
    rm -f ${DOMAIN_HOME}/servers/*/data/nodemanager/*.lck
    rm -f ${DOMAIN_HOME}/servers/*/data/nodemanager/*.state
    rm -f ${DOMAIN_HOME}/servers/*/data/nodemanager/*.pid
    # Call to the script that starts the Node Manager (if not already up) and Admin server in this node
    /opt/scripts/restart/wls_start.sh aserver
  2. Create a script to start the Oracle WebLogic managed server in every mid-tier host. It will also start the node manager in the host, in the event it is stopped.
    The following is an example script: custom_start_mserver.sh. Place this custom script in a folder in the mid-tier host, for example, in /opt/scripts. The full path to the script is provided in the DR plans.
    # Remove .pid, .lck and .state files (that could have been left behind if a previous crash) before starting
    rm -f ${DOMAIN_HOME}/servers/*server_*/data/nodemanager/*.lck
    rm -f ${DOMAIN_HOME}/servers/*server_*/data/nodemanager/*.state
    rm -f ${DOMAIN_HOME}/servers/*server_*/data/nodemanager/*.pid
    # Call to the script that starts the Node Manager (if not already up) and managed server in this node
    /opt/scripts/restart/wls_start.sh mserver
  3. Create a script to stop the Oracle WebLogic processes in the host (Administration server if it is the administration host and the managed server) in every mid-tier host. The node manager will remain up.
    The following is an example script: custom_stop.sh. Place this custom script in a folder in the mid-tier host, for example, in /opt/scripts. The full path to the script is provided in the DR plans.
    • If you're using “OCI File Storage with rsync” or “Database File System (DBFS)” methods to replicate the configuration, then you can keep the Node Manager up.
      # Call to the script that stops WLS processes but leave the node manager up
      /opt/scripts/restart/wls_stop.sh servers
    • If you're using Block Volume cross-region replica model, then you must stop all the WebLogic Server related processes to unmount the block volume during a switchover. After stopping the WebLogic Server process, you must stop the node manager process. Use the following in the custom_stop.sh script:
      # Call to the script that stops WLS processes and node manager in this host
      /opt/scripts/restart/wls_stop.sh all

Create a Script to Change the DNS Front-end Name

You can add a custom plan group and steps to automate changing DNS to change the front-end DNS record in your DNS provider.

If you're using Oracle Cloud Infrastructure DNS, then example of scripts for this are available in the Download Scripts section of this document.

  • When switching over to Region 2, you must run the script that updates the front-end name DNS record to point to Load Balancer’s IP of Region 2. Place the script for this in one of the Region 2 mid-tier hosts.
  • When switching over to Region 1, run the script that updates the fronted name DNS record to point to Load Balancer’s IP of Region 1. Place the script for this in one of the Region 1 mid-tier host.
  • Alternatively, you can create an Oracle Cloud Infrastructure function in each site that runs the appropriate script in a serverless mode.

Identify Additional Custom Scripts

Identify and locate any additional scripts that you need to run in your systems when you perform a switchover or failover operation. These scripts will be called from your custom plan groups when you define your disaster recovery plans.