4 Configuring Oracle Site Guard
Configure Oracle Site Guard and create your own configuration scripts, auxiliary hosts, and database lag checks.
Overview
Configure Oracle Site Guard before creating disaster recovery operation plans.
Before you create an operation plan for disaster recovery, you must configure Oracle Site Guard. All operation plans that you create use this configuration.
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
![Configuration workflow Configuration workflow](img/guard_dt_004_sg_config.png)
Note:
-
Before you configure Oracle Site Guard, ensure that you complete the tasks described in Preparing Oracle Site Guard for Operation.
-
You must login using the
EM_SG_ADMINISTRATOR
role privilege to perform configuration tasks. Ensure that you have created the required user credentials as described in Creating Credentials.
Configuring Sites
Configure sites and designate a site as a primary or secondary site.
As the first step towards setting up a disaster recovery operation, you must configure sites and assign roles to those sites. Then you designate a configured site as a primary (production) sites or a standby site.
Configuring Sites with Enterprise Manager Cloud Control Console
Learn how to configure sites with Enterprise Manager Cloud Control Console.
To create an Oracle Site Guard configuration and to associate a standby system with a primary system with Enterprise Manager Cloud Control Console:
Configuring Sites with EMCLI Commands
Learn how to use EMCLI commands to configure primary and secondary sites.
To configure primary and standby sites:
Note:
For information about logging in to emcli
, see EM CLI Overview and Concepts.
emcli create_siteguard_configuration -primary_system_name="system_name1" -standby_system_name="system_name2"
Parameter | Description |
---|---|
|
Enter the name of your system, which is associated with the primary site. |
|
Enter the name of your system, which is associated with the standby site. |
To display information about the association between configured primary and standby sites:
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.
Configuring Site Properties with EMCLI Commands
Site Properties allows user to associate user-defined properties to a site. Use Site Properties to group and search for sites that share common attributes. Each property consists of a name and value associated with a site. Site Properties is an EMCLI-only feature.
To configure a Site Property:
Note:
For information about logging in to emcli
, see EM CLI Overview and Concepts.
emcli add_site_properties -system_name="Name of the system (site)" -properties="property name=value pairs separated by ;"
Parameter | Description |
---|---|
|
Name of the generic system (site). |
|
Semicolon (;) separated list of property name=value pairs to be added to the site. |
To list Site Properties , or list sites that match the specified property names and values:
emcli get_site_properties -system_name="Name of the system (site)" -properties="property names list or name=value pairs separated by ;"
Parameter | Description |
---|---|
|
Name of the generic system (site). |
|
Semicolon (;) separated list of property names or name=value pairs to search for. |
For more information on how to update or delete a Site Property, see Oracle Site Guard Command Line Interface.
Updating Site Configuration
Designate the role of a site as Primary, Standby, or Validate Standby site with EMCLI commands or Enterprise Manager Cloud Control Console.
You can update the role of a site after a site has been created and set it up as a primary or standby site. In this way, you designate a site's role as Primary, Standby, or Validate Standby. This is useful when you have performed actions outside Oracle Site Guard that modify or reverse the roles of sites in a Site Guard configuration and you want to update the Oracle Site Guard configuration to correctly reflect the site's new role.
You can update a site configuration using Enterprise Manager Cloud Control Console or EMCLI commands:
Updating Site Configuration with Enterprise Manager Cloud Control Console
Learn how to update the role of a site with Enterprise Manager Cloud Control Console.
To update a site's role with Enterprise Manager Cloud Control Console:
Note:
Reversing site roles cancels all configured health checks for the sites involved in the role reversal.
Updating Site Configuration with EMCLI Commands
Learn how to update the role of a site with EMCLI commands.
Note:
For information about logging in to the Enterprise Manager Command-Line Interface, see Oracle Enterprise Manager Command Line Interface Guide.
To update a site's role, use the update_siteguard_configuration
EMCLI command:
Parameter | Description |
---|---|
|
The name of your system associated with the primary site. |
|
The name of your system associated with the standby site. |
|
Reverse roles between primary and standby systems. Optional. If this option is specified, only one standby system can be specified in the |
|
The new role for the site. Optional. Specify one of the following:
|
Creating Credential Associations
Credentials are associated with targets and used by Oracle Site Guard operation plans when they are executing.
The credentials to associate are the ones that you created in Creating Credentials.
Note:
-
If you are using Named Credentials or Preferred Credentials, ensure that you have created all the necessary credentials for managing targets as described in Creating Credentials.
-
Ensure that you have created a user with
EM_SG_ADMINISTRATOR
privileges, as described in Creating Oracle Site Guard Administrator Users, and granted credential privileges to that user as described in Granting Credential Privileges to Oracle Site Guard Administrator Users.
You must 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
To associate credentials to targets, use any of the following tasks:
Creating Named or Preferred Credential Associations
Credentials must be created and associated with targets, such as Oracle WebLogic Servers, hosts where Oracle Fusion Middleware is installed, Oracle Databases, and Oracle WebLogic Node Manager.
Creating Named or Preferred Credential Associations with Enterprise Manager Cloud Control Console
Learn how to create a named or preferred credential association with Enterprise Manager Cloud Control Console.
To create and associate credentials with Enterprise Manager Cloud Control Console:
-
Login to Enterprise Manager as an
EM_SG_ADMINISTRATOR
user. -
From the Targets menu, click Systems.
-
On the Systems page, click the name of the system for which you want to configure credential associations.
-
On the system's home page, from the Generic System menu, select Site Guard > Configure.
-
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:
-
In the Credential tab, in the Normal Host Credentials section, click Add.
The Add Normal Host Credentials dialog appears.
-
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.
-
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:
-
In the Credential tab, in the Privileged Host Credentials section, click Add.
The Add Privileged Host Credentials dialog appears.
-
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.
-
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:
-
In the Credential tab, in the Oracle Node Manager Credentials section, click Add.
The Add Oracle Node Manager Credentials dialog appears.
-
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.
-
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:
-
In the Credential tab, in the Oracle WebLogic Administration Credentials section, click Add.
The Add Oracle WebLogic Administration Credentials dialog appears.
-
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.
-
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:
-
In the Credential tab, in the SYSDBA Database Credentials section, click Add.
The Add Database Credentials dialog appears.
-
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.
-
Click Save.
-
Creating Named or Preferred Credential Associations with EMCLI Commands
Learn how to create named or preferred credential associations with EMCLI commands.
Note:
For information about logging in to the Enterprise Manager Command-Line Interface, see Oracle Enterprise Manager Command Line Interface Guide.
To create named or preferred credential associations for targets, use the create_siteguard_credential_association
EMCLI command:
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 |
---|---|
|
The name of the system. |
|
The name of the target. This parameter is optional and required to associate the credential with a specific target only. |
|
The type of the credential. Example: |
|
The name of the credential. If the value for |
|
The owner of the credential. |
|
If you are using Preferred Credentials, then specify |
Configuring Scripts
Oracle Site Guard provides a mechanism for you to configure 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 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 on various scripts, see Extensibility.
-
Mount and Unmount scripts
Mount and Unmount scripts as described in 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 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.
The following topics explain how to configure different kinds scripts:
Configuring Custom Precheck Scripts, Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts
Learn how to customize pre and post checks.
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 |
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
|
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 |
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 |
To configure Custom Precheck Scripts, Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts use any of the following tasks:
Configuring Custom Precheck Scripts, Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts with Enterprise Manager Cloud Control Console
Learn how to configure pre and post scripts for the primary site.
To configure Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts for the primary site:
-
Login to Enterprise Manager as an
EM_SG_ADMINISTRATOR
user. -
From the Targets menu, click Systems.
The Systems page is displayed.
-
Select the system name (Generic System) for which the script must be configured.
The Generic System page for that site is displayed.
-
Click Generic System > Site Guard > Configure.
The Site Guard Configuration page is displayed.
-
Click the Pre/Post Scripts tab.
-
Click Add.
The Add Pre/Post Scripts page is displayed.
-
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,
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.
-
-
Click Save.
Configuring Custom Precheck Scripts, Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts with EMCLI Commands
Learn how to configure pre and post scripts with EMCLI commands.
To configure Pre Scripts, Post Scripts, Global Pre Scripts, and Global Post Scripts with EMCLI commands:
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 |
---|---|
|
The name of the system. |
|
The name of the operation: |
|
The type of the script. It can be |
|
The name of the host where this script will be executed. This parameter is optional and can be specified more than once. |
|
The path to the script. |
|
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. |
|
The value as 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 This parameter is optional. |
|
Whether the script needs to be executed on only one of the available hosts (enter This parameter is optional and default value is all. |
|
Optional flag to allow the script to run on all the hosts in the system. This parameter overrides the |
|
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: |
|
|
|
The name of the credential that is used to execute this script. If the value for the parameter |
|
The owner of the credential. If |
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 pass credentials to a script, first configure the script and then configure the credentials to pass as parameters, as described in Configuring Credentials as Parameters for Scripts.
Configuring Mount and Unmount Scripts
The mount and unmount scripts are scripts used in storage operations to mount and unmount file systems.
These scripts are storage scripts that come in two flavors:
-
Bundled
Oracle Site Guard provides a bundled script for handling file system 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.
To mount and unmount file systems, you can use the following bundled script:
mount_umount.sh
Learn how to use the mount_umount.sh
script to mount or unmount file systems and directories.
The script has the following syntax:
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:
sh mount_umount.sh -o mount -f '/u02/oracle/config,/u02/oracle/product,/u02/oracle/stage'
To mount a single directory:
sh mount_umount.sh -o mount -f /u01/app/oracle/product/test
To unmount multiple directories:
sh mount_umount.sh -o umount -f '/u02/oracle/config,/u02/oracle/product,/u02/oracle/stage'
To unmount a single directory:
sh mount_umount.sh -o umount -f /u01/app/oracle/product/test
To configure mount or unmount scripts, use one of the following options:
Configuring Mount or Unmount Scripts with Enterprise Manager Cloud Control Console
Learn how to configure mount and unmount scripts with Enterprise Manager Cloud Control Console.
Note:
For information about logging in to the Enterprise Manager Command-Line Interface, see Oracle Enterprise Manager Command Line Interface Guide.
To configure a mount or unmount script with Enterprise Manager Cloud Control Console:
-
Login to Enterprise Manager as an
EM_SG_ADMINISTRATOR
user. -
From the Targets menu, click Systems.
The Systems page is displayed.
-
Select the system name (Generic System) on which the script must be configured.
The Generic System page for that site is displayed.
-
Click Generic System > Site Guard > Configure.
The Site Guard Configuration page is displayed.
-
Click the Storage Scripts tab.
-
Click Add.
The Add Storage Scripts page is displayed.
-
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.
-
-
Click Save.
Configuring Mount or Unmount Scripts with EMCLI Commands
Learn how to configure mount and unmount scripts with EMCLI commands.
Note:
For information about logging in to the Enterprise Manager Command-Line Interface, see Oracle Enterprise Manager Command Line Interface Guide.
To configure a mount or unmount script use, the create_siteguard_script
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 |
---|---|
|
The system for which the script is being configured. |
|
The function of the operation. Example: |
|
The type of script. Depending on the function you want to perform, enter one of the following options:
|
|
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 Note: Ensure that all hosts are part of the system specified in |
|
Enter the path to the script. If you are configuring the bundled For example:
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:
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:
|
|
The path to the entity in the software library. If the component is specified, the |
|
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 |
|
Whether the script needs to be executed on only one of the available hosts (enter |
|
Optional flag to enable the script to run on all the hosts in the system. This parameter overrides the |
|
This option is not applicable for scripts of type |
|
|
|
An alternate named credential to use when executing this script. If the values for |
|
The owner of the credential. This argument need not be specified if the owner of the credential is same as logged in user. |
To pass credentials to a script, first configure the script and then configure the credentials you want to pass as parameters as described in Configuring Credentials as Parameters for Scripts .
Configuring Storage Scripts
Storage scripts are used in 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 (notSTRIPPED
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.
-
zfs_storage_role_reversal.sh
The zfs_storage_role_reversal.sh
script is a script used to perform role-reversal operations.
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 besas
and there must not be any further filters.
Configure these roles with the ZFS appliance BUI or with EMCLI commands.
Run the bundled zfs_storage_role_reversal.sh
script:
zfs_storage_role_reversal.sh [options]
The operation types available are:
-
switchover
-
switchover_prechecks
-
failover
-
failover_prechecks
-
create_clone
-
create_clone_prechecks
-
delete_clone
-
delete_clone_prechecks
Option | Description | Mandatory? |
---|---|---|
|
Maximum ZFS Lag will be calculated based on replication schedule. |
No |
|
The host name of the target ZFS appliance. For example:
|
Yes |
|
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: |
No |
|
The host name of the source ZFS appliance. For example:
|
Yes |
|
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: |
No |
|
The name of the replicated ZFS project. For example: |
Yes |
|
The name of the storage pool on the target ZFS appliance. For example: |
Yes |
-- |
The name of the storage pool on the source ZFS appliance. For example: |
Yes |
|
The operation for which this script is being configured. For example: |
Yes |
|
Whether the replication package should be updated or synchronized before starting the role reversal. Applicable values are If not provided, the default value is |
No |
|
Whether the role reversal should continue if the update or synchronization fails. Applicable values are This option only applies if the parameter |
No |
|
The timeout value (in seconds) before declaring that the update or synchronization has failed. This option only applies if For example: |
No |
|
Whether the script should send output to a log file. Applicable values are If not specified, the default is N (no log output will be sent to log file). |
No |
|
The ZFS replication lag threshold value (in seconds). If the replication lag exceeds this value, do not reverse storage roles.Example: |
No |
|
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 If not specified, the default value is |
No |
|
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:
|
No |
|
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:
|
No |
To configure storage scripts, use one of the following options:
Configuring Storage Scripts with Enterprise Manager Cloud Control Console
Learn how to configure storage scripts with Enterprise Manager Cloud Control Console.
To configure storage scripts with Enterprise Manager Cloud Control Console:
-
Login to Enterprise Manager as an
EM_SG_ADMINISTRATOR
user. -
From the Targets menu, click Systems.
The Systems page is displayed.
-
Select the system name (Generic System) on which the script must be configured.
The Generic System page for that site is displayed.
-
Click Generic System > Site Guard > Configure.
The Site Guard Configuration page is displayed.
-
Click the Storage Scripts tab.
-
Click Add.
The Add Storage Scripts page is displayed.
-
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 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.
-
-
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.
-
-
Click Save.
Configuring Storage Scripts with EMCLI Commands
Learn how to create and configure a storage script with EMCLI commands.
To configure a storage script, use with the create_siteguard_script
EMCLI command:
emcli create_siteguard_script -system_name="name_of_the_system" -operation="name_of_the_operation" -script_type="type_of_the_script" -path="path_of_the_script" [-host_name="name_of_the_host_where_the_script_will_be_run"] [-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. |
---|---|
|
The system for which the script is being configured. |
|
The function of the operation. Example: |
|
The type of script depending on the operation you want to perform. For example: |
|
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 |
|
Enter the path to the script. If you are configuring the bundled For example:
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:
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:
|
|
The path to the entity in software library. If component is specified, the |
|
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 |
|
Whether the script needs to be executed on only one of the available hosts (enter This parameter is optional and default value is |
|
Optional flag to enable the script to run on all the hosts in the system. This parameter overrides the |
|
This option is not applicable for scripts of type Storage Switchover and Storage Failover. |
|
The |
|
An alternate named credential to use when executing this script. If the values for the parameter |
|
The owner of the named credential for |
To pass credentials to a script, first configure the script and then configure the credentials that you want to pass as parameters to the scrip, as explained in Configuring Credentials as Parameters for Scripts.
Configuring Credentials as Parameters for Scripts
Learn how to pass credentials to a script
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 EMCLI commands, you must use separate additional EMCLI 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 Creating Credentials. Also, ensure that you have configured the script to which you want to pass credentials as described in Configuring Scripts.
To configure credentials as script parameters, perform any of the following tasks:
Adding Credential Parameters to a Script
Learn how to add credentials to a script with EMCLI commands.
To add credentials parameters to a configured script, run the EMCLI add_siteguard_secript_credential_params
command. 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 |
---|---|
|
The script ID. |
|
The name of the credential. Use a comma-separated list enclosed in double quotes to specify more than one credential. |
|
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. |
Deleting Credential Parameters with a Script
Learn how to delete configured credentials with EMCLI commands.
To delete one or more credentials parameters already configured for a script:
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 |
---|---|
|
The ID associated with the script. |
|
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. |
|
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. |
Getting Credential Parameters for a Script
Learn how to obtain the list of credentials configured for a script with EMCLI commands.
To get a list of one or more credentials parameters configured for a script:
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 |
---|---|
|
The ID associated with the script. |
|
The name of the credential. If this argument is not specified, all credentials associated with the script will be deleted. This parameter is optional. |
|
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. |
Cloning a Script with Existing Scripts
Learn how to clone (copy) a script of any kind with Enterprise Manager Cloud Control Console.
To clone a script with the Enterprise Manager Cloud Control Console:
-
Login to Enterprise Manager as an
EM_SG_ADMINISTRATOR
user. -
From the Targets menu, click Systems.
The Systems page is displayed.
-
Select the system name (Generic System) on which the script must be configured. The Generic System page for that site is displayed.
-
Click Generic System > Site Guard > Configure.
The Site Guard Configuration page is displayed.
-
Click the Pre/Post Scripts tab or the Storage Scripts tab.
The Pre/Post Scripts page or the Storage Scripts page is displayed.
-
Select a configured script from the Scripts table and click Add Like.
-
Modify any pre-configured values that you want to change.
-
Click Save.
Configuring Auxiliary Hosts
You can configure one or more hosts managed by Oracle Enterprise Manager as an auxiliary host to a site.
An auxiliary host to a site must be managed by Oracle Enterprise Manager. A host can be an auxiliary host for one or more sites. These hosts are used to run Pre Scripts, Post Scripts, or Storage Scripts on a site.
To manage auxiliary hosts, use the following tasks:
Adding an Auxiliary Host with EMCLI Commands
Learn how to add an auxiliary host to a site with EMCLI commands.
Note:
For information about logging in to the Enterprise Manager Command-Line Interface, see Oracle Enterprise Manager Command Line Interface Guide.
To add an auxiliary host on a site, run the following EMCLI command:
emcli add_siteguard_aux_hosts -system_name="system_name" -host_name="host_name"
Parameter | Description |
---|---|
|
The system on which you are performing the operation. |
|
The name of the host where the script will be executed. Note: Ensure that the hostname is part of the system specified in |
Deleting an Auxiliary Host with EMCLI Commands
Learn how to delete an auxiliary host on a site with EMCLI commands.
Note:
For information about logging in to the Enterprise Manager Command Line Interface, see Oracle Enterprise Manager Command Line Interface Guide.
To delete a auxiliary host on a site, use the delete_siteguard_aux_host
EMCLI command:
emcli delete_siteguard_aux_host -system_name="system_name" [-host_name="name_of_the_host"]
Note:
[ ]
indicates that the parameter is optional.
Parameter | Description |
---|---|
|
The system on which you are performing the operation. |
|
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 |
Listing Auxiliary Targets with EMCLI Commands
Learn how to view the list of auxiliary hosts for a system.
Note:
For information about logging in to the Enterprise Manager Command Line Interface, see Oracle Enterprise Manager Command Line Interface Guide.
To view a list of all auxiliary targets for a system, run the following EMCLI command:
emcli get_siteguard_aux_hosts
-system_name="system_name"
Parameter | Description |
---|---|
|
The name of the system for which you want the list of auxiliary hosts. |
Configuring Database Lag Checks with EMCLI Commands
Learn how to configure database lags for databases in Oracle Site Guard operation plans.
Note:
For information about logging in to the Enterprise Manager Command Line Interface, see Oracle Enterprise Manager Command Line Interface Guide.
Configuring Database Lag Checks with EMCLI Commands
Learn how to configure lags with EMCLI commands.
To configure values of Apply Lag and Transport Lag for databases, run the following EMCLI command:
emcli configure_siteguard_lag -system_name="system_name" -property_name="lag_type" -value="max_limit" [-target_name="database_target_name"]
Note:
[ ]
indicates that the parameter is optional.
Parameter | Description |
---|---|
|
The system on which you want to configure the threshold limit. |
|
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. |
|
The property name. Valid values are |
|
The threshold value to be configured (in seconds). |
Updating Threshold Value for Database Lag with EMCLI Commands
Learn how to update lag thresholds 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 EMCLI command:
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 |
---|---|
|
The system for which you want to configure the threshold limit. |
|
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. |
|
The property name. Valid values are |
|
The threshold value to be updated (in seconds). |
Deleting Threshold Value for Database Lag with EMCLI Commands
Learn how to delete lag thresholds 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 command:
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 |
---|---|
|
The system for which you want to configure the threshold limit. |
|
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. |
|
The property name. Valid values are |
Listing Database Lag Thresholds with EMCLI Commands
Learn how to list 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 EMCLI 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 |
---|---|
|
The system for which you want to retrieve the threshold limit. |
|
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. |
|
The property name. Valid values are |