4 Configuring Oracle Site Guard

This chapter explains how to configure Oracle Site Guard, including the configuration of scripts, auxiliary hosts, and database lag checks.

This chapter includes the following sections:

4.1 Overview

Before you create operation plans for disaster recovery, you must first configure Oracle Site Guard. After configuring Oracle Site Guard, you can create operation plans that use the configuration you have created.

Figure 4-1 shows the roadmap for configuring Oracle Site Guard. Steps marked optional are required if the site topology and operation plans require a specific type of configuration. However, since most enterprise deployments are large and complex, they typically require all the configuration steps listed in the figure.

Figure 4-1 Workflow of Oracle Site Guard Configuration

Surrounding text describes Figure 4-1 .

Note:

4.2 Configuring Sites

As the first step towards setting up a disaster-recovery configuration, you must configure sites, and designate roles to the configured sites. The configured sites must be designated as the primary (production) sites and standby sites.

To configure sites, use one of the following methods:

4.2.1 Configuring Sites with Enterprise Manager Cloud Control Console

To create an Oracle Site Guard configuration and associate a standby system with the primary system, complete the following steps:

  1. Log in to Enterprise Manager as an EM_SG_ADMINISTRATOR user.

  2. From the Targets menu, click Systems.

    The Systems page is displayed.

  3. Click the name of the system (Generic System) for the primary site created as described in Section 3.2.3, "Creating Primary and Standby Sites".

    The Generic System page for the primary site is displayed.

  4. On the system's home page, from the Generic System menu, select Site Guard > Configure.

    The Site Guard Configuration page is displayed.

  5. On the General tab, in the Standby System(s) section, click Add.

    The Search and Select: Standby Systems page is displayed.

  6. Choose the standby system, and click Select.

  7. Click Create. Or, if an Oracle Site Guard configuration already exists, click Save.

  8. Click OK to confirm the action.

    Site Guard saves the standby system configuration.

4.2.2 Configuring Sites with EMCLI Commands

To add the configuration for the primary and standby sites, you must run the following emcli commands in the command-line interface:

Note:

For information about logging in to emcli, see chapter "Command Line Interface Concepts and Installation" in the Oracle Enterprise Manager Command Line Interface Guide.
emcli create_siteguard_configuration 
      -primary_system_name="system_name1"
      -standby_system_name="system_name2"
Parameter Description
-primary_system_name Enter the name of your system, which is associated with the primary site.
-standby_system_name Enter the name of your system, which is associated with the standby site.

To display information about the association between existing primary and standby sites, run the following emcli commands in the command-line interface:

emcli get_siteguard_configuration
         [-primary_system_name="name_of_the_primary_system"]
         [-standby_system_name="name_of_the_standby_system"]

Note:

[ ] indicates that the parameter is optional.

4.3 Updating Site Configuration

You can update site configuration (role) after a site has been created and set up as a primary or standby site. In this way, you designate a site's role as Primary, Standby, or ValidateStandby. This is useful when you have performed actions outside Site Guard that modify or reverse the roles of sites in a Site Guard configuration and you want to update the Site Guard configuration to correctly reflect the site's new role.

You can update site configuration with Enterprise Manager Cloud Control Console or with EMCLI commands, as explained in the following sections:

4.3.1 Updating Site Configuration with Enterprise Manager Cloud Control Console

To update a site's role with Enterprise Manager Cloud Control Console:

  1. Log in to Enterprise Manager as an EM_SG_ADMINISTRATOR user.

  2. From the Targets menu, click Systems.

    The Systems page is displayed.

  3. 3. Click the name of the system (Generic System) for the standby site created as described in Section 3.2.3, "Creating Primary and Standby Sites."

    The Generic System page for the standby site is displayed.

  4. On the system's home page, from the Generic System menu, select Site Guard > Configure.

    The Site Guard Configuration page is displayed.

  5. On the General tab, click the Set as Primary button on the upper right.

  6. Click Yes to acknowledge the confirmation dialog.

    This designates the standby site as the new primary site and will automatically designate it's paired primary site as the new standby site. Effectively, the site roles are reversed.

Note:

Reversing site roles cancels all configured health checks for the sites involved in the role reversal.

4.3.2 Updating Site Configuration with EMCLI Commands

To update a site's role with EMCLI commands:

  1. Login to emcli. For information about how login to emcli, see chapter "Using EM CLI" in Oracle Enterprise Manager Command Line Interface Guide.

  2. Run the update_siteguard_configuration command. The syntax and parameter description of this command follows:

    emcli update_siteguard_configuration 
          -primary_system_name="system_name1"
          -standby_system_name="system_name2"
          -reverse_role="flag specifying whether system roles should be reversed"
          -role="new role of the standby system"
    

Table 4-1

Parameter Description

-primary_system_name

The name of your system associated with the primary site.

-standby_system_name

The name of your system associated with the standby site.

-reverse_role

Reverse roles between primary and standby systems. Optional.

If this option is specified, only one standby system can be specified in the -standby_system_name parameter.

-role

The new role for the site. Optional. Specify one of the following:

  • Primary - the roles of the primary and standby are swapped.

  • Standby - the role of the standby site is changed from ValidateStandby to Standby.

  • ValidateStandby - the role of the standby site is changed from Standby to ValidateStandby.


4.4 Creating Credential Associations

This section describes how to associate credentials for use in Site Guard operation plans. These credentials are the ones that you created in Section 3.2.4, "Creating Credentials."

Note:

It is essential that you set up named or preferred credential associations for the following targets:

  • Each host, where Oracle Fusion Middleware and Oracle Database are installed and configured (for normal user and users with root privileges)

  • Oracle WebLogic Administration Server

  • Oracle Database

  • Oracle WebLogic Node Manager

4.4.1 Creating Named or Preferred Credential Associations

To create Named or Preferred Credential associations, use one of the following methods:

4.4.1.1 Creating Named or Preferred Credential Associations with Enterprise Manager Cloud Control Console

To create named credentials with Enterprise Manager Cloud Control Console:

  1. Log in to Enterprise Manager as an EM_SG_ADMINISTRATOR user.

  2. From the Targets menu, click Systems.

  3. On the Systems page, click the name of the system for which you want to configure credential associations.

  4. On the system's home page, from the Generic System menu, select Site Guard > Configure.

  5. Click the Credentials tab.

    Associate the different types of credentials as described:

    Associate Normal Host Credentials

    Associate normal host credentials to run specific commands or scripts on the target host.

    To associate normal host credentials, follow these steps:

    1. In the Credential tab, in the Normal Host Credentials section, click Add.

      The Add Normal Host Credentials dialog appears.

    2. Select the target for which you want to associate normal host credentials. Select All to select all the systems in the list.

      You can select the credentials set, by default, by selecting the Preferred option on the page. On selecting Preferred, the Named Credentials section is disabled. To select named credentials, deselect Preferred.

    3. Click Save.

    Associate Privileged Host Credentials

    Associate privileged host credentials to mount or unmount storage on the target host.

    To associate privileged host credentials, follow these steps:

    1. In the Credential tab, in the Privileged Host Credentials section, click Add.

      The Add Privileged Host Credentials dialog appears.

    2. Select the target for which you want to associate privileged host credentials. Select All to select all the targets in the list.

      You can select the credentials set, by default, by selecting the Preferred option on the page. On selecting Preferred, the Named Credentials section is disabled. To select named credentials, deselect Preferred.

    3. Click Save.

    Associate Oracle Node Manager Credentials

    Associate Oracle Node Manager credentials to connect node manager targets. You must associate Oracle Node Manager credentials for each site that has a Oracle Weblogic Server target.

    To associate Oracle Node Manager credentials, follow these steps:

    1. In the Credential tab, in the Oracle Node Manager Credentials section, click Add.

      The Add Oracle Node Manager Credentials dialog appears.

    2. Select the target host for which you want to associate Oracle Node Manager credentials. Select All to select all the target hosts in the list.

      You can select the credentials set, by default, by selecting the Preferred option on the page. On selecting Preferred, the Named Credentials section is disabled. To select named credentials, deselect Preferred.

    3. Click Save.

    Associate Oracle WebLogic Administration Credentials

    Associate Oracle WebLogic Administration credentials to connect to the administration server, or to start or stop managed servers.

    To associate Oracle WebLogic administration credentials, follow these steps:

    1. In the Credential tab, in the Oracle WebLogic Administration Credentials section, click Add.

      The Add Oracle WebLogic Administration Credentials dialog appears.

    2. Select the target for which you want to associate Oracle WebLogic administration credentials. Select All to select all the targets in the list.

      You can select the credentials set, by default, by selecting the Preferred option on the page. On selecting Preferred, the Named Credentials section is disabled. To select named credentials, deselect Preferred.

    3. Click Save.

    Associate SYSDBA Database Credentials

    Associate SYSDBA database credentials to perform switchover or failover operations through Data Guard Broker.

    To associate database credentials, follow these steps:

    1. In the Credential tab, in the SYSDBA Database Credentials section, click Add.

      The Add Database Credentials dialog appears.

    2. Select the target for which you want to associate SYSDBA Database credentials. Select All to select all the targets in the list.

      You can select the credentials set, by default, by selecting the Preferred option on the page. On selecting Preferred, the Named Credentials section is disabled. To select named credentials, deselect Preferred.

    3. Click Save.

4.4.1.2 Creating Named or Preferred Credential Associations with EMCLI Commands

To reate a named or preferred credential associations for targets with EMCLI, run the following command in the command-line interface:

emcli create_siteguard_credential_association
         -system_name="name_of_the_system"
         [-target_name="name_of_the_target"]
         -credential_type="type_of_credential"
         [-credential_name="name"]
         [–use_preferred_credential="true_or_false"]
         -credential_owner="owner"

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-system_name The name of the system.
-target_name The name of the target. This parameter is optional and required to associate the credential with a specific target only.
-credential_type The type of the credential. Example: HostNormal, HostPrivileged, NodeManager, WLSAdmin, or DatabaseSysdba.
-credential_name The name of the credential.

If the value for credential_name is not specified, then use_preferred_credential has to be set to true.

-credential_owner The owner of the credential.
–use_preferred_credential If you are using Preferred Credentials, then specify true. The default value is false. If you do not specify the use of preferred credentials, then to use named credentials you must specify the credential_name parameter.

4.5 Configuring Scripts

Oracle Site Guard provides a mechanism for users to configure different types of scripts for managing disaster-recovery operations. Depending on their function, these scripts either come bundled with Oracle Site Guard, or you can be provided them. You must configure these scripts while configuring Oracle Site Guard. Note that you must add these scripts to the Enterprise Manager software library so that they can be automatically staged (deployed) on the hosts where they need to run. Scripts that are not part of the software library are manually staged (deployed) on each host where they are defined to run.

You can configure the following scripts with Oracle Site Guard:

  • Custom Precheck Scripts

    Custom Precheck scripts are used to extend the Precheck and Health Check functionality that Oracle Site Guard provides. For information about Precheck and Health Check functionality of Oracle Site Guard, see Section 2.3.1, "Extensibility."

  • Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts

    Pre scripts, Post Scripts, Global pre scripts, and Global Post Scripts are used for extending the functionality of Oracle Site Guard when executing operation plans. For more information, see Section 2.3.1, "Extensibility."

  • Mount and Unmount scripts

    Mount and Unmount scripts as described in Section 2.3.3, "Storage Integration," are needed for Filesystem mount and unmount operations that are performed during operations. You can use the mount_unmount.sh script or provide your own scripts.

  • Storage scripts

    Storage scripts as described in Section 2.3.3, "Storage Integration", are needed for storage management that must be performed during operations. You can use the scripts bundled with Oracle Site Guard or provide your own scripts.

Note:

  • A user-defined script must be an executable script, and must have clearly defined return codes. The script must return 0 on success, and non-zero values on failure.

  • Ensure that you configure the required privileges to run all user-defined scripts.

This section contains the following topics:

4.5.1 Configuring Custom Precheck Scripts, Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts

The following attributes are available for customizing a Pre Script, Post Script, Global Pre Script, and Global Post Script:

Parameter Description
script path The location where the script resides. Note that the script must reside at the same path location on each host specified in the target hosts parameter.
software library path (component) Path to the entity in software library. If component is specified, path should contain only the file name and its parameters. This parameter is optional.
target hosts The list of hosts where the script will run.
run on Whether the script should run on Any or All of the hosts specified in the target hosts parameter. The first available host in the target_hosts list is chosen.

Any executes the script on any one of the available hosts specified in the target_hosts parameter.

All executes the script on each and every host specified in the target_hosts parameter.

operation type The operation type that the script is configured for (switchover, failover, start, or stop).
role The role of the site during which the script will run (primary or standby). For example, a script configured for a primary role will only run when the site has a primary role.
runtime Whether the script is a runtime script. Runtime scripts are not expected to be available before operation execution begins. Using this flag tells Site Guard not to check for the script existence during the Precheck phase.
credential type The type of credential to use to execute the script on the specified hosts (Normal Host Credentials or Privileged Host Credentials).

For information about various types of credentials, see Creating Credential Associations.

credential parameters One or more sets of credentials to pass to the script.

This option is only available in the Cloud Control Console. To configure credential parameters with EMCLI, use the command add_siteguard_script_credential_params.


To configure Custom Precheck Scripts, Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts, follow one of these methods:

4.5.1.1 Configuring Custom Precheck Scripts, Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts with Enterprise Manager Cloud Control Console

To configure Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts for the primary site:

  1. Log in to Enterprise Manager as an EM_SG_ADMINISTRATOR user.

  2. From the Targets menu, click Systems.

    The Systems page is displayed.

  3. Select the system name (Generic System) for which the script must be configured.

    The Generic System page for that site is displayed.

  4. Click Generic System > Site Guard > Configure.

    The Site Guard Configuration page is displayed.

  5. Click the Pre/Post Scripts tab.

  6. Click Add.

    The Add Pre/Post Scripts page is displayed.

  7. Enter the following details:

    • Software Library Path: Enter the path to the software library entity that contains the script. Alternately, browse for the entity in the software library by clicking on the icon. This only applies if the script has already been added to the Enterprise Manager software library.

      The entity in the Software Library must be present in a folder which is not locked. The symbol, Symbol indicating that Software Library is locked, indicates that the folder is locked.

    • Script Path: Enter the path to the script, or click the search icon and browse the Filesystem for the script. You can also browse Filesystems on the remote host after specifying the login credentials.

    • Target Hosts: Select one or more target hosts, or select All to configure the script to run on all hosts.

    • Script Type: Select one of the following options depending on the type of script being configured:

      • Custom Precheck Script

      • Pre Script

      • Post Script

      • Global Pre Script

      • Global Post Script

    • Operation Type: The operation during which this script will run. Choose from the options - Switchover, Failover, Start, Stop, Open for Validation, or Revert to Standby.

    • Role: Select Primary, Standby, or Stanby (Open for Validation) based on the system role. The script only runs when the system has the specified role.

      Note:

      For Global Pre-Script and Global Post-Script script types, the site Role cannot be changed.

      For Pre-Script, Post-Script and Custom Precheck Script the Role cannot be changed when the operation type is Start or Stop.

    • To configure additional options, click the arrow next to Advanced Options region. The following advanced options are available:

      • Runtime Script: Select if this is a Runtime script that will only be available during operation execution. Normally, scripts that are part of the Software Library should be designated as Runtime scripts, however any user script may be designated a Runtime script.

        Note that during a Precheck or Health Check, Oracle Site Guard checks the existence of runtime scripts that have been added to the Software Library. However, if the scripts are not part of the Software Library, Oracle Site Guard does not check for their existence before an operation plan is executed

      • Run On: Select All Hosts to run the script on all selected hosts, or to run the script on any one of the selected target hosts, select Any Host.

    • Credential Type: Select one of the following credential types for executing the script:

      • Normal Host Credentials

        Select the Normal (non-root) privileges configured for the script host

      • Privileged Host Credentials

        Select the Privileged (root) privileges configured for the script host

      • Custom Host Credentials

        Select an alternate set of named credentials. If this option is chosen, select the named credential from the Named Credential drop-down menu.

    • Named Credential: Select the named credential to use when executing the script. This selection is only applicable if Credential Type is set to Custom Host Credentials.

    • Credential Parameters: Select one or more configured credentials to pass as parameters to this script. To select the credentials to pass to the script, move those credentials from the Available Values column to the Selected Values column. The selected credential parameters will be passed to this script in the order selected. This credential order is important for scripts that expect a list of credentials in a specified order.

  8. Click Save.

4.5.1.2 Configuring Custom Precheck Scripts, Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts with EMCLI Commands

To configure Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts with Oracle Site Guard, run the following emcli commands in the command-line interface:

emcli create_siteguard_script
         -system_name=name_of_the_system
         -operation=name_of_the_operation
         -script_type=type_of_the_script
         [-host_name=name_of_the_host_where_the_scripts_are_run]
         -path=path_of_the_script
         [-component="path_of_the_entity_in_software_library"] 
         [-runtime_script="flag_to_specify_if_prechecks_to_check_availability_of_this_script"]
         [-run_on=flag_specifying_the_host]
         [-all_hosts=flag_to_run_script_on_all_the_hosts_in_the_system]
         [-role=role_associated_with_the_system]
         [-credential_type=type_of_the_credential]
         [-credential_name="name_of_the_credential"] 
         [-credential_owner=credential_owner]

Note:

  • A parameter enclosed in [ ] indicates that the parameter is optional.

  • You can specify the -host_name parameter more than once.

  • Specifying the value true for the parameter -all_hosts=true overrides any host selected using the -host_name option.

Parameter Description
-system_name The name of the system.
-operation The name of the operation: Switchover, Failover, Start, Stop, Open for Validation, or Revert to Standby.
-script_type The type of the script. It can be Custom Precheck Script, Global-Pre-Script, Global-Post-Script, Pre-Script, or Post-Script.
-host_name The name of the host where this script will be executed.

This parameter is optional and can be specified more than once.

-path The path to the script.
-component The path to the entity in the software library. If component is specified, path should contain only the file name and its parameters.

This parameter is optional.

-runtime_script The value as true or false. If the script is designated as a runtime script, Precheck will not verify the existence of script. This parameter is used when the script is dynamically mounted or generated as part of execution of operation plan.

By default, all scripts staged from the software library are designated as runtime scripts. The default value for scripts that are not staged from software library is false.

This parameter is optional.

-run_on Whether the script needs to be executed on only one of the available hosts (enter any) or on all hosts (enter all).

This parameter is optional and default value is all.

-all_hosts Optional flag to allow the script to run on all the hosts in the system. This parameter overrides the host_name. Enter true or false.
-role Optional flag to configure script based on the system role. By default, the script is configured for both primary and standby roles for a given system. For example: Primary or Standby.
–credential_type HostNormal or HostPrivileged if you have root privileges.
-credential_name The name of the credential that is used to execute this script.

If the value for the parameter credential_name is not specified, then the value for the parameter credential_type needs to be specified.

-credential_owner The owner of the credential. If target_storage_credential_name and source_storage_credential_name are specified then the attribute credential_owner must be specified. This argument need not be specified if the owner of the credential is same as logged in user.

Note:

  • [ ] indicates that the parameter is optional.

  • You may specify the option host_name more than once.

  • -all_hosts=true overrides any hosts specified with the -host_name option.

  • The -role option is only applicable for Pre-Script or Post-Script.

To configure credentials to be passed to a script, first configure the script and then refer to Configuring Credentials as Parameters for Scripts to configure one or more credentials to be passed as parameters to the configured script.

4.5.2 Configuring Mount and Unmount Scripts

Mount and Unmount scripts are storage scripts that come in two flavors:

  • Bundled

    Oracle Site Guard provides a bundled script for handling Filesystem mount and unmount operations. The mount_umount.sh script is part of the Enterprise Manager Software Library. Oracle Site Guard automatically deploys bundled scripts on all hosts on which the scripts are defined to run.

  • User-defined

    You can define your own custom script for the Filesystem mount and unmount operations.

    You can add your own scripts to the Enterprise Manager software library. If you do this, Oracle Site Guard will deploy your scripts to all configured hosts at runtime. This is similar to how Oracle Site Guard automatically deploys bundled scripts such as mount_umount.sh. However, if your scripts are not part of the software library, then you must deploy them on all hosts where they need to run.

4.5.2.1 mount_umount.sh

This section provides the syntax and usage for the mount_umount.sh script.

For mounting and unmounting Filesystems, configure the bundled mount_umount.sh script as shown in Example 4-1.

Example 4-1 Usage of the mount_umount.sh Script

sh mount_umount.sh [-o operation_type ][-f directories_to_mount_or_unmount]

Note:

  • If there are multiple directories to be mounted or unmounted, use commas to separate the directories. Ensure that there are no spaces between the directory names.

  • Ensure that the /etc/fstab file is updated with the entries that you want to mount or unmount.

  • Ensure that you have the privileges to mount or unmount Filesystems.

To mount multiple directories, run the following command:

sh mount_umount.sh -o mount -f '/u02/oracle/config,/u02/oracle/product,/u02/oracle/stage'

To mount a single directory, run the following command:

sh mount_umount.sh -o mount -f /u01/app/oracle/product/test

To unmount multiple directories, run the following command:

sh mount_umount.sh -o umount -f '/u02/oracle/config,/u02/oracle/product,/u02/oracle/stage'

To unmount a single directory, run the following command:

sh mount_umount.sh -o umount -f /u01/app/oracle/product/test

To configure mount or unmount scripts, use one of the following options:

4.5.2.1.1 Configuring Mount or Unmount Scripts with Enterprise Manager Cloud Control Console

To configure a mount or unmount script with Enterprise Manager Cloud Control Console:

  1. Log in to Enterprise Manager as an EM_SG_ADMINISTRATOR user.

  2. From the Targets menu, click Systems.

    The Systems page is displayed.

  3. Select the system name (Generic System) on which the script must be configured.

    The Generic System page for that site is displayed.

  4. Click Generic System > Site Guard > Configure.

    The Site Guard Configuration page is displayed.

  5. Click the Storage Scripts tab.

  6. Click Add.

    The Add Storage Scripts page is displayed.

  7. Enter the following details:

    • Software Library Path: Enter the path to the software library entity that contains the script. Alternately, browse for the entity in the software library by clicking the search icon. This only applies if the script has already been added to the Enterprise Manager software library.

    • Script Path: the bundled mount_umount.sh script with the appropriate options (see mount_umount.sh), or provide a path to your own user-defined script.

      To enter a user-defined script you can click the search icon, and browse the Filesystem. You can also browse Filesystems on the remote host after specifying login credentials.

    • Target Hosts: Select one or more target hosts, or select All to configure the script to run on all hosts.

    • Script Type: Select one of the following options:

      • Mount

      • UnMount

    • Run On: This option is disabled. The value is set to All Hosts.

    • Operation Type: The operation during which this script will run. Choose from the options - Switchover, Failover, Open for Validation, or Revert to Standby.

    • To configure additional options, click the arrow next to Advanced Options region. The following advanced options are available:

      • Runtime Script: Select whether this is a Runtime script that will only be available during operation execution. Normally, scripts that are part of the Software Library should be designated as Runtime scripts, however any user script may be designated a Runtime script.

        Note:

        During a Precheck or Health Check, Oracle Site Guard checks the existence of runtime scripts that have been added to the Software Library. However, if the scripts are not part of the Software Library, Oracle Site Guard does not check for their existence before an operation plan is executed.
    • Credential Type: Select one of the following credential types while executing the script:

      • Normal Host Credentials: Select these credentials to use the Normal (non-root) privileges configured for that script host.

      • Privileged Host Credentials: Select these credentials to use the Privileged (root) privileges configured for that script host.

      • Custom Host Credentials: Select these credentials to use an alternate set of named credentials. If this option is chosen, select the named credential from the Named Credential drop-down menu.

    • Named Credential: the named credential to be used when executing the script. This selection is only applicable if Credential Type is set to Custom Host Credentials.

    • Credential Parameters: Select one or more configured credentials to be passes as parameters for this script. To select the credentials to be passed to the script, move those credentials from the Available Values column to the Selected Values column.

  8. Click Save.

4.5.2.1.2 Configuring Mount or Unmount Scripts with EMCLI Commands

To configure a mount or unmount script, run the following emcli command:

emcli create_siteguard_script
        -system_name="system_name"
        -operation="operation_name"
        -script_type="type_of_script"
        [-host_name="name_of_the_host"]
        -path="path_of_the_script"
        [-component="path_of_the_entity_in_software_library"]
        [-runtime_script="flag_to_specify_if_prechecks_should_check_availability_of_this_script"]
        [-run_on="flag_specifying_hosts_that_will_run_the_script"]
        [-all_hosts="flag_to_run_the_script_on_all_the_hosts_on_the_system"]
        [-role="role_associated_with_the_system"]
        [-credential_type="type_of_credential"]
        [-credential_name="name_of_the_credential"]
        [-target_storage_credential_name="target_storage_credential"]
        [-source_storage_credential_name="source_storage_credential"]
        [-credential_owner="credential_owner"]

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-system_name The system for which the script is being configured.
-operation The function of the operation. Example: Switchover, Failover, Open for Validation, or Revert to Standby.
-script_type The type of script. Depending on the function you want to perform, enter one of the following options:
  • Mount

  • UnMount

-host_name The name of the host where the script will be run.

To specify a list of hosts, separate host names with semi-colons, or provide the -host_name option multiple times.

Note: Ensure that all hosts are part of the system specified in system_name.

-path Enter the path to the script.

If you are configuring the bundled mount_umount.sh script specify the path as described in mount_umount.sh.

For example:

sh mount_umount.sh -o mount -f /u02/oracle/config,/u02/oracle/product,/u02/oracle/stage

If you are configuring a user-defined script that you have added to the Enterprise Manager software library, provide only the name of the script and any additional arguments that the script requires.

For example:

sh example_script.sh -a value1 -b value2 -c value3

If you are configuring a user-defined script that you will deploy on all the configured hosts, provide the full path to the script location and any additional arguments that the script requires.

Note: The script must reside at the same path location on each host.

For example:

/path_to_the_script/example_script.sh -a value1 -b value2 -c value3

-component The path to the entity in the software library. If the component is specified, the -path option should contain only the script name and its parameters.
-runtime Whether the script is a runtime script. If the script is a runtime script, Prechecks will not verify the existence of script. This option can be used when the script is dynamically mounted or generated as part of execution of operation plan. By default, all scripts staged from the software library are designated as runtime scripts. For scripts that are not staged from the software library, the default value is false.
-run-on Whether the script needs to be executed on only one of the available hosts (enter any) or on all hosts (enter all).
-all_hosts Optional flag to enable the script to run on all the hosts in the system. This parameter overrides the -host_name parameter.
-role This option is not applicable for scripts of type Mount and UnMount.
-credential_type HostNormal credentials or HostPrivileged credentials for users with root privileges. If values for credential_type are not specified, then the values for credential_name must be specified.
-credential_name An alternate named credential to use when executing this script. If the values for credential_name are not specified, then the values for credential_type must be specified.
-credential_owner The owner of the credential. This argument need not be specified if the owner of the credential is same as logged in user.

To configure credentials to be passed to a script, first configure the script and then refer to Configuring Credentials as Parameters for Scripts to configure one or more credentials to be passed as parameters to the configured script.

4.5.3 Configuring Storage Scripts

Storage scripts are used for Storage Switchover and Storage Failover operations. There are two types of storage scripts:

  • Bundled

    Oracle Site Guard provides a bundled script for handling Filesystem mount and unmount operations. The script, zfs_storage_role_reversal.sh, is part of the Enterprise Manager Software Library. Oracle Site Guard automatically deploys bundled scripts on all hosts on which the scripts are defined to run.

  • User-defined

    You can define your own custom script for the Filesystem mount and unmount operations.

    You can add your own scripts to the Enterprise Manager software library. If you do this, Oracle Site Guard will deploy your scripts to all configured hosts at runtime. This is similar to how Oracle Site Guard automatically deploys bundled scripts like zfs_storage_role_reversal.sh. However, if your scripts are not part of the software library, you must deploy them on all hosts where they need to run.

    When configuring replication between ZFS storage appliances for a Site Guard disaster recovery configuration, follow these guidelines:

    • Ensure that you do not use private interface names as source and target appliance parameters when configuring the Site Guard ZFS storage role reversal script.

    • When replicating to a target appliance from a clustered source appliance, configure replication on each head of the source appliance head using different replication targets.

    • During replication configuration both source cluster heads should be in a CLUSTERED state (not STRIPPED for example).

    • Do not use private interfaces for replication configuration. Creating static routes and verifying them on the source and target before setting up replication configuration will ensure that you use public interfaces, not private interfaces.

    • Ensure that storage pools and IP addresses maintain their cluster node assignment.

4.5.3.1 zfs_storage_role_reversal.sh

This section explains the usage of the zfs_storage_role_reversal.sh script. This script comes bundled with Oracle Site Guard and can be used to perform storage role-reversal operations as part of a switchover or failover operation plan.

Note:

The ZFS administrator account used for performing storage operations must have the following roles granted for the ZFS pool or project that is part of the Site Guard disaster recovery operation:
  • rrsource, a role that allows administrators to create, edit, and destroy replication targets and actions, and send and cancel updates for replication actions.

  • rrtarget, a role that allows administrators to manage replicated packages, including disabling replication at the package level, cloning a package or its members, modifying properties of received datasets, and severing or reversing replication. Other authorizations may be required for some of these operations, such as setting properties or cloning individual shares. See the available authorizations in the Projects and Shares scope for details.

  • destroy, a role that you can configure at the project or pool level. Either level will work provided you assign it the pool or project being reversed. This role allows deleting an empty project right before attempting 'confirm reverse' on a package on the target appliance.

  • rename, a role you can configure at the project or pool level. Either level will work provided you assign it to the pool or project being reversed. This role allows renaming non-empty project right before attempting 'confirm reverse' on a package on the target appliance.

  • changeProtocolProps, this role is optional. If assigned, the scope must be sas and there must not be any further filters.

Configure these roles with the ZFS appliance BUI or CLI.

Configure the bundled zfs_storage_role_reversal.sh script as shown in Example 4-2 and the table following it. The operation types available are:

  • switchover

  • switchover_prechecks

  • failover

  • failover_prechecks

  • create_clone

  • create_clone_prechecks

  • delete_clone

  • delete_clone_prechecks

Example 4-2 Usage of zfs_storage_role_reversal.sh Script

zfs_storage_role_reversal.sh  [options]

Option Description Mandatory?
--target_appliance or -t The host name of the target ZFS appliance.

For example:

zfssite1.example.com

Yes
--target_user or -w The username on the target ZFS appliance with privileges to execute the script. If not specified, the username of the user executing the script will be used.

For example: root

No
--source_appliance or -h The host name of the source ZFS appliance.

For example:

zfsite2.example.com

Yes
--source_user or -u The user name on the source ZFS appliance with privileges to execute the script. If not specified, the user name of the user executing the script will be used.

For example: root.

No
--project_name or -j The name of the replicated ZFS project.

For example: ZFS-DR-Project.

Yes
--target_pool_name or -p The name of the storage pool on the target ZFS appliance.

For example: zfssite1-pool-0

Yes
--source_pool_name or -q The name of the storage pool on the source ZFS appliance.

For example: zfssite2-pool-0

Yes
--operation_type or -o The operation for which this script is being configured.

For example: switchover, switchover_prechecks, failover, failover_prechecks, create_clone, create_clone_prechecks, delete_clone, or delete_clone_prechecks.

Yes
--is_sync_needed or -c Whether the replication package should be updated or synchronized before starting the role reversal. Applicable values are Y or N.

If not provided, the default value is Y for switchover and N for failover operations.

No
--continue_on_sync_failure or -f Whether the role reversal should continue if the update or synchronization fails. Applicable values are Y or N.

This option only applies if the parameter -is_sync_needed is enabled.The default value is N.

No
--sync_timeout or -e The timeout value (in seconds) before declaring that the update or synchronization has failed. This option only applies if -is_sync_needed is enabled.

For example: 600 (equivalent to ten minutes)

No
--keep_log_file or -l Whether the script should send output to a log file. Applicable values are Y or N.

If not specified, the default is N (no log output will be sent to log file).

No
--zfs_lag_in_seconds or -z The ZFS replication lag threshold value (in seconds). If the replication lag exceeds this value, do not reverse storage roles.Example: 300 (equivalent to five minutes) No
--is_source_reachable or -x Whether Site Guard should check whether the source appliance is reachable. This option only applies to the failover case and should be used to prevent the script from trying to check source appliance reachability. Applicable values are Y or N.

If not specified, the default value is Y.

No
--source_user_equivalence or -m The SSH user name to use when establishing an SSH connection to the source appliance. If this is not specified, the script attempts an SSH connection without specifying an alternate user name.

For example:

--source_user_equivalence user1

No
--target_user_equivalence or -n The SSH username to use when establishing an SSH connection to the target appliance. If this is not specified, the script attempts an SSH connection without specifying an alternate username.

For example:

--target_user_equivalence user2

No

To configure storage scripts, use one of the following options:

4.5.3.2 Configuring Storage Scripts with Enterprise Manager Cloud Control Console

To configure storage scripts with Enterprise Manager Cloud Control Console:

  1. Log in to Enterprise Manager as an EM_SG_ADMINISTRATOR user.

  2. From the Targets menu, click Systems.

    The Systems page is displayed.

  3. Select the system name (Generic System) on which the script must be configured.

    The Generic System page for that site is displayed.

  4. Click Generic System > Site Guard > Configure.

    The Site Guard Configuration page is displayed.

  5. Click the Storage Scripts tab.

  6. Click Add.

    The Add Storage Scripts page is displayed.

  7. Enter the following details:

    • Software Library Path: The path to the software library entity that contains the script. Alternately, browse for the entity in the software library by clicking the search icon. This only applies if the script has already been added to the Enterprise Manager software library.

    • Script Path: The bundled zfs_storage_role_reversal.sh script with the appropriate options (see Section 4.5.3.1, "zfs_storage_role_reversal.sh"), or provide a path to your own user-defined script. To browse for a user-defined script you can click the search icon and browse the Filesystem. You can also browse Filesystems on the remote host after specifying login credentials.

      For example:

      sh zfs_storage_role_reversal.sh -t zfssite1.mycompany.com -h zfssite2.mycompany.com -j ZFS-DR-Project -p zfssite1-pool-0 -q zfssite2-pool-0 -c N -f Y -z 300 -l Y -o switchover
      
    • Target Hosts: Select one or more target hosts, or select All to configure the script to run on all hosts.

    • Script Type: Select one of the following options depending on the function that Oracle Site Guard needs to perform:

      • Storage Switchover

      • Storage Failover

      • Storage CreateClone

      • Storage DeleteClone

    • Operation Type: The operation during which this script will run. Selecting the Script Type automatically sets the Operation Type. This field cannot be modified.

    • Run On: For mount or unmount operations this field is automatically set to All Hosts. For storage scripts, this field is automatically set to Any Host. This field cannot be modified.

  8. Click the arrow next to the Advanced Options region to configure additional options if required. The following advanced options are available:

    • Runtime Script: Select to specify that this is a Runtime script that will only be available during operation execution. Normally, scripts that are part of the Software Library should be designated as Runtime scripts, however any user script may be designated a Runtime script.

      Note:

      During a Precheck or Health Check, Oracle Site Guard checks the existence of runtime scripts that have been added to the Software Library. However, if the scripts are not part of the Software Library, Oracle Site Guard does not check for their existence before an operation plan is executed.
    • Credential Type: Select one of the following credential types while executing the script:

      • Normal Host Credentials: Select to use the Normal (non-root) privileges configured for that script host.

      • Privileged Host Credentials: Select these credentials to use the Privileged (root) privileges configured for that script host.

      • Custom Host Credentials: Select to use an alternate set of named credentials. If you select this option, also select the named credential from the Named Credential drop-down menu.

    • Named Credential: The named credential to use when executing the script. This selection is only applicable if Credential Type is set to Custom Host Credentials.

    • Credential Parameters: Select one or more configured credentials to pass as parameters for this script, by moving credentials from the Available Values column to the Selected Values column.

      Note:

      For ZFS storage scripts, you must pass the source and target appliance credentials as credential parameters to the configured script.

      The order of credentials passed to the script is important. You must pass the source credential first, followed by that target credential.

  9. Click Save.

4.5.3.3 Configuring Storage Scripts with EMCLI

To configure a storage script with EMCLI, run the following command:

emcli create_siteguard_script
        -system_name="name_of_the_system"
        -operation="name_of_the_operation"
        -script_type="type_of_the_script"
        [-host_name="name_of_the_host_where_the_script_will_be_run"]
        -path="path_of_the_script"
        [-component="path_of_the_entity_in_software_library"]
        [-runtime_script="flag_to_specify_if_prechecks_should_check_availability_of_this_script"]
        [-run_on="flag_specifying_which_hosts_will_run_the_script"]
        [-all_hosts="flag_to_run_the_script_on_all_the_hosts_in_the_system"]
        [-role="role_associated_with_the_system"]
        [-credential_type="type_of_the_credential"]
        [-credential_name="name_of_the_credential"]
        [-target_storage_credential_name="target_storage_credential"]
        [-source_storage_credential_name="source_storage_credential"]
        [-credential_owner="credential_owner"]

Note:

[ ] indicates that the parameter is optional.
Parameter Description.
-system_name The system for which the script is being configured.
-operation The function of the operation. Example: Switchover, Failover, Start, Stop, Open for Validation, or Revert to Standby.
-script_type The type of script depending on the operation you want to perform.

For example: Storage-Switchover, Storage-Failover, Storage-CreateClone, or Storage-DeleteClone..

-host_name The name of the host where the script will be run.

This option can be specified more than once to configure multiple hosts.

Ensure that each host is part of the system specified in the parameter system_name.

-path Enter the path to the script.

If you are configuring the bundled zfs_storage_role.sh script specify the path as described in "zfs_storage_role_reversal.sh".

For example:

sh zfs_storage_role_reversal.sh -t zfssite1.mycompany.com -h zfssite2.mycompany.com -j ZFS-DR-Project -p zfssite1-pool-0 -q zfssite2-pool-0 -c N -f Y -z 300 -o switchover

If you are configuring a user-defined script that you have added to the Enterprise Manager software library, provide only the name of the script and any additional arguments that the script requires.

For example:

sh example_script.sh -a value1 -b value2 -c value3

If you are configuring a user-defined script that you will deploy on all the configured hosts, provide the full path to the script location and any additional arguments that the script requires.

Note: The script must reside at the same path location on each host.

For example:

/path_to_the_script/example_script.sh -a value1 -b value2 -c value3

-component The path to the entity in software library. If component is specified, the -path option should contain only the script name and its parameters.
-runtime_script Whether script is a runtime script. If the script is designated a runtime script, Prechecks will not verify the existence of script. This option can be used when the script is dynamically mounted or generated as part of execution of operation plan. By default, all scripts staged from software library are designated as runtime scripts. The default value is false for scripts that are not staged from software library.
-run_on Whether the script needs to be executed on only one of the available hosts (enter any) or on all hosts (enter all).

This parameter is optional and default value is all.

-all_hosts Optional flag to enable the script to run on all the hosts in the system. This parameter overrides the host_name.
-role This option is not applicable for scripts of type Storage Switchover and Storage Failover.
–credential_type The HostNormal credentials or HostPrivileged credentials for users with root privileges. If the values for the parameter credential_type are not specified, then the values for credential_name must be specified.
-credential_name An alternate named credential to use when executing this script. If the values for the parameter credential_name are not specified, then the values for the parameter credential_type must be specified.
-credential_owner The owner of the named credential for target_storage_credential and source_storage_credential.

To configure credentials to be passed to a script, first configure the script and then refer to Configuring Credentials as Parameters for Scripts to configure one or more credentials to be passed as parameters to the configured script.

4.5.4 Configuring Credentials as Parameters for Scripts

When you configure Site Guard scripts with Enterprise Manager Cloud Control Console, you can configure the credentials to pass as a parameter to the script. However, if you configure scripts with the Enterprise Manager CLI, you must use separate additional CLI commands to add, delete or get credential parameters for scripts. Before you configure a script to receive credentials as parameters, ensure that you have created these credentials as described in Section 3.2.4, "Creating Credentials." Also, ensure that the script for which you will configure credential parameters for, is already configured as described in Configuring Scripts.

To configure credentials as script parameters, perform any of the following tasks:

4.5.4.1 Adding Credential Parameters to a Script

To add credentials parameters to a configured script, run the add_siteguard_secript_credential_params command using the command-line interface. You can either execute the command once for each set of credentials that need to be configured as parameters to a script, or provide all the credentials in one invocation in a comma-separated list:

emcli add_siteguard_script_credential_params
        -script_id="id_associated_with_the_script" 
        -credential_name="name_of_the_credential" 
        [-credential_owner="credential_owner"]

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-script_id The script ID.
-credential_name The name of the credential. Use a comma-separated list enclosed in double quotes to specify more than one credential.
-credential_owner The credential owner details. You need not specify the values of this parameter if the owner of the credential is same as that of the logged-in user.

4.5.4.2 Deleting Credential Parameters with a Script

To delete one or more credentials parameters already configured for a script, run the following EM CLI command using the command-line interface:

emcli delete_siteguard_script_credential_params
        -script_id="Id associated with the script" 
        [-credential_name="name of the credential"] 
        [-credential_owner="credential owner"]

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-script_id The ID associated with the script.
-credential_name The name of the credential. Use a comma-separated list enclosed in double-quotes to specify more than one credential. This parameter is optional. If unspecified, all credentials associated with the script are deleted.
-credential_owner The owner of the credential. This parameter need not be specified if the owner of the credential is the same as the logged-in user.

4.5.4.3 Getting Credential Parameters for a Script

To get a list of one or more credentials parameters configured for a script, run the following EM CLI command using the command-line interface:

emcli get_siteguard_script_credential_params
        -script_id="Id_associated_with_the_script" 
        [-credential_name="name_of_the_credential"] 
        [-credential_owner="credential_owner"]

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-script_id The ID associated with the script.
-credential_name The name of the credential. If this argument is not specified, all credentials associated with the script will be deleted.

This parameter is optional.

-credential_owner The owner of the credential. This parameter need not be specified if the owner of the credential is the same as the logged-in user.

4.5.5 Cloning a Script with Existing Scripts

You can create and configure new scripts by cloning (copying) an existing script. This applies to all types of scripts.

To clone a script with the Enterprise Manager Cloud Control Console:

  1. Log in to Enterprise Manager as an EM_SG_ADMINISTRATOR user.

  2. From the Targets menu, click Systems.

    The Systems page is displayed.

  3. Select the system name (Generic System) on which the script must be configured. The Generic System page for that site is displayed.

  4. Click Generic System > Site Guard > Configure.

    The Site Guard Configuration page is displayed.

  5. Click the Pre/Post Scripts tab or the Storage Scripts tab.

    The Pre/Post Scripts page or the Storage Scripts page is displayed.

  6. Select a configured script from the Scripts table and click Add Like.

  7. Modify any pre-configured values that you want to change.

  8. Click Save.

4.6 Configuring Auxiliary Hosts

You can configure one or more hosts managed by Enterprise Manager, as an auxiliary host to the site. An auxiliary host needs to be managed by Enterprise Manager. It can be part of one or more sites. These hosts can be used to run Pre Scripts, Post Scripts, or Storage Scripts on a site.

The following actions can be performed:

4.6.1 Adding an Auxiliary Host with EMCLI Commands

To add an auxiliary host on a site, run the following EMCLI command in the command-line interface:

emcli add_siteguard_aux_hosts 
          -system_name="system_name" 
          -host_name="host_name" 
Parameter Description
-system_name The system on which you are performing the operation.
-host_name The name of the host where the script will be executed.

Note: Ensure that the hostname is part of the system specified in system_name.


4.6.2 Deleting an Auxiliary Host with EMCLI Commands

To delete a auxiliary host on a site, run the following EMCLI command in the command-line interface:

emcli delete_siteguard_aux_host
        -system_name="system_name"
        [-host_name="name_of_the_host"]

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-system_name The system on which you are performing the operation.
-host_name The name of the auxiliary host to delete. If unspecified, then all auxiliary hosts associated with the system are deleted. Optional.

Note: Ensure that the host name is part of the system specified in system_name.


4.6.3 Listing Auxiliary Targets with EMCLI Commands

To view a list of all auxiliary targets for a system, run the following command:

emcli get_siteguard_aux_hosts
          -system_name="system_name"
Parameter Description
-system_name The system on which you are performing the operation.

4.7 Configuring Database Lag Checks

This section describes how to configure values of Apply Lag and Transport Lag for one or more Data Guard enabled databases.

It contains the following topics:

4.7.1 Configuring Database Lag Checks with EMCLI Commands

You can configure values of Apply Lag and Transport Lag for one or more Data Guard enabled databases by running the following commands:

emcli configure_siteguard_lag
        -system_name="system_name"
        [-target_name="database_target_name"]
        -property_name="lag_type"
        -value="max_limit"

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-system_name The system on which you want to configure the threshold limit.
-target_name The database target name for which the threshold limit is configured. If this parameter is not specified, then the threshold value is applied to all databases of the system.
-property_name The property name. Valid values are ApplyLag and TransportLag.
-value The threshold value to be configured (in seconds).

4.7.2 Updating Threshold Value for Database Lag with EMCLI Commands

To update the values of Apply Lag and Transport Lag threshold for one or more Data Guard enabled database, run the following commands:

emcli update_siteguard_lag
        -system_name="system_name"
        [-target_name="database_target_name"]
        -property_name="lag_type"
        -value="max_limit"

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-system_name The system for which you want to configure the threshold limit.
-target_name The database target name for which the threshold limit is configured. If this parameter is not specified, then the threshold value is applied to all databases of the system.
-property_name The property name. Valid values are ApplyLag and TransportLag.
-value The threshold value to be updated (in seconds).

4.7.3 Deleting Threshold Value for Database Lag with EMCLI Commands

To delete the values of Apply Lag and Transport Lag threshold configured for one or more Data Guard enabled databases, run the following EMCLI commands:

emcli delete_siteguard_lag
         -system_name="system_name"
         [-target_name="database_target_name"]
         -property_name="lag_type"

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-system_name The system for which you want to configure the threshold limit.
-target_name The database target name for which the threshold limit is configured. If the database name is not specified, the configured lag limit is deleted for all databases in the system.
-property_name The property name. Valid values are ApplyLag and TransportLag.

4.7.4 Listing Database Lag Thresholds with EMCLI Commands

To view values of the configured database Apply Lag and Transport Lag threshold limits of a system, run the following command:

emcli get_siteguard_lag
        -system_name="system name"
        [-target_name="database_target_name"]
        -property_name="lag_type"

Note:

[ ] indicates that the parameter is optional.
Parameter Description
-system_name The system for which you want to retrieve the threshold limit.
-target_name The database target name for which the threshold limit is to be retrieved. If the database name is not specified, the property is obtained for all databases in the system.
-property_name The property name. Valid values are ApplyLag and TransportLag.