ヘッダーをスキップ
Oracle® Fusion Middlewareディザスタ・リカバリ・ガイド
11g リリース1(11.1.1)
B61394-04
  目次へ移動
目次
索引へ移動
索引

前
 
次
 

B Oracle Site Guardのサンプル・スクリプト

この付録は、Oracle Site Guardのサンプル・スクリプトを示しています。次が含まれています。

例B-1 Oracle Site Guard構成スクリプト

#Login to emcli
 
emcli login -username="sysman" -password="sysman"
 
#Create site definitions
 
emcli create_siteguard_configuration -primary_system_name="NetappServer1System" -standby_system_name="NetappServer2System"
 
emcli get_siteguard_configuration
 
#Create credential associations
 
#Host credentials
 
emcli create_siteguard_credential_association -system_name="NetappServer1System" -credential_type="HostNormal" -credential_name="SG_CRED_HOST" -credential_owner="sysman"
emcli create_siteguard_credential_association -system_name="NetappServer1System" -credential_type="HostPrivileged" -credential_name="SG_CRED_HOST-PRIV" -credential_owner="sysman"
 
emcli create_siteguard_credential_association -system_name="NetappServer2System" -credential_type="HostNormal" -credential_name="SG_CRED_HOST" -credential_owner="sysman"
emcli create_siteguard_credential_association -system_name="NetappServer2System" -credential_type="HostPrivileged" -credential_name="SG_CRED_HOST-PRIV" -credential_owner="sysman"
 
#WLS credentials
 
emcli create_siteguard_credential_association -system_name="NetappServer1System" -credential_type="WLSAdmin" -credential_name="SG_CRED_WLS" -credential_owner="sysman"
emcli create_siteguard_credential_association -system_name="NetappServer2System" -credential_type="WLSAdmin" -credential_name="SG_CRED_WLS" -credential_owner="sysman"
 
#Database credentials
 
emcli create_siteguard_credential_association -system_name="NetappServer1System" -credential_type="DatabaseSysdba" -credential_name="SG_CRED_DB" -credential_owner="sysman"
emcli create_siteguard_credential_association -system_name="NetappServer2System" -credential_type="DatabaseSysdba" -credential_name="SG_CRED_DB" -credential_owner="sysman"
 
emcli get_siteguard_credential_association -system_name="NetappServer1System"
emcli get_siteguard_credential_association -system_name="NetappServer2System"
 
#Create operation plans
 
#Start/Stop NetappServer1System
 
emcli create_operation_plan -system_name="NetappServer1System" -operation="Start" -name="start-NetappServer1System"
emcli create_operation_plan -system_name="NetappServer1System" -operation="Stop" -name="stop-NetappServer1System"
 
#Start/Stop NetappServer2System
 
emcli create_operation_plan -system_name="NetappServer2System" -operation="Start" -name="start-NetappServer2System"
emcli create_operation_plan -system_name="NetappServer2System" -operation="Stop" -name="stop-NetappServer2System"
 
emcli get_operation_plans
 
#Switchover sites
 
#Swithover to NetappServer2System
 
emcli create_operation_plan -primary_system_name="NetappServer1System" -standby_system_name="NetappServer2System" -operation="Switchover" -name="switchover-to-NetappServer2System"
 
#Switchback to NetappServer2System
 
emcli create_operation_plan -primary_system_name="NetappServer2System" -standby_system_name="NetappServer1System" -operation="Switchover" -name="switchback-to-NetappServer1System"
 
#Failover sites
 
#Failover to NetappServer2System
 
emcli create_operation_plan -primary_system_name="NetappServer1System" -standby_system_name="NetappServer2System" -operation="Failover" -name="failover-to-NetappServer2System"
 
#Failover to NetappServer1System
 
emcli create_operation_plan -primary_system_name="NetappServer2System" -standby_system_name="NetappServer1System" -operation="Failover" -name="failover-to-NetappServer1System"
 
emcli get_operation_plans

例B-2 Sun Storage ZFS Storage Applianceのロール・リバース・スクリプト

1: # This script executes the switchover script of S7000 by doing role-reversal
2: # 
3: #
4: ## Get the confirmation..
5: echo "Status at the source [ $CURRENT_PRIMARY ] "
6: ssh -T $CURRENT_PRIMARY < s7000_status_repl_src.aksh
7:
8: echo " Status at the target [$CURRENT_STANDBY]
9: ssh -T $CURRENT_STANDBY < s7000_status_repl_tgt.aksh
9:
10:echo "Going to failover from the source : $CURRENT_PRIMARY to the target : 11:CURRENT_STANDBY ."
12:
13:# Stop the replication
14:echo "Suspending the continuous replication at the source :  $CURRENT_PRIMARY "
15:
16:ssh -T $CURRENT_PRIMARY < s7000_stop_repl_at_source.aksh
17:
18:echo "Performing the role reversal at the target : $CURRENT_STANDBY "
19:
20:ssh -T $CURRENT_STANDBY < s7000_role_reverse_at_target.aksh
21:
22:echo "Status at the new source [$CURRENT_STANDBY ]"
23:
24: ssh -T $CURRENT_STANDBY < s7000_status_repl_src.aksh
25:
26:echo "Status at the new target [$CURRENT_PRIMARY_S7000 ]"
27:ssh -T $CURRENT_PRIMARY_S7000 < s7000_status_repl_tgt.aksh
28:

例B-3 NetAppストレージのロール・リバース・スクリプト

# Perform SnapMirror Update from the target storage system site
rsh BIHOST1 snapmirror update -S BIHOST2:VOLFMW1  BIHOST1:VOLFMW1
sleep 100
rsh BIHOST1 snapmirror update -S BIHOST2:VOLFMW2  BIHOST1:VOLFMW2
sleep 100
rsh BIHOST1 snapmirror update  -S BIHOST2:VOLADMIN  BIHOST1:VOLADMIN
sleep 100
rsh BIHOST1 snapmirror update  -S BIHOST2:VOLBI1  BIHOST1:VOLBI1
sleep 100
rsh BIHOST1 snapmirror update  -S BIHOST2:VOLBI2  BIHOST1:VOLBI2
rsh BIHOST1 snapmirror update -S BIHOST2:VOLBIINST1  BIHOST1:VOLBIINST1
sleep 100
rsh BIHOST1 snapmirror update -S BIHOST2:VOLBIINST2  BIHOST1:VOLBIINST2
rsh BIHOST1 snapmirror update -S BIHOST2:VOLWEB1 BIHOST1:VOLWEB1
sleep 100
rsh BIHOST1 snapmirror update -S BIHOST2:VOLWEB2 BIHOST1:VOLWEB2
sleep 100
rsh BIHOST1 snapmirror update -S BIHOST2:VOLWEBINST1 BIHOST1:VOLWEBINST1
sleep 100
rsh BIHOST1 snapmirror update -S BIHOST2:VOLWEBINST2  BIHOST1:VOLWEBINST2
sleep 100
rsh BIHOST1 snapmirror update  -S BIHOST2:VOLDATA1  BIHOST1:VOLDATA1
sleep 30
rsh BIHOST1 snapmirror update  -S BIHOST2:VOLDATA2  BIHOST1:VOLDATA2
sleep 30
rsh BIHOST1 snapmirror update  -S BIHOST2:VOLDATA3  BIHOST1:VOLDATA3
sleep 30
rsh BIHOST1 snapmirror update  -S BIHOST2:VOLDATA4  BIHOST1:VOLDATA4
sleep 100
 
# Make Netapp volumes on the new primary storage writable
 
rsh BIHOST1 snapmirror break BIHOST1:VOLWEB1
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLWEB2
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLWEBINST1
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLWEBINST2
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLFMW1
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLFMW2
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLADMIN
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLBI1
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLBI2
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLBIINST1
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLBIINST2
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLDATA1
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLDATA2
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLDATA3
sleep 30
rsh BIHOST1 snapmirror break BIHOST1:VOLDATA4
sleep 100
 
# Reverse Storage Roles
 
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLWEB1 -w BIHOST2:VOLWEB1
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLWEB2 -w BIHOST2:VOLWEB2
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLWEBINST1 -w BIHOST2:VOLWEBINST1
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLWEBINST2 -w BIHOST2:VOLWEBINST2
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLBIINST1 -w BIHOST2:VOLBIINST1
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLBIINST2 -w BIHOST2:VOLBIINST2
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLFMW1 -w BIHOST2:VOLFMW1
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLFMW2 -w BIHOST2:VOLFMW2
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLADMIN -w BIHOST2:VOLADMIN
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLBI1 -w BIHOST2:VOLBI1
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLBI2 -w BIHOST2:VOLBI2
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLDATA1 -w BIHOST2:VOLDATA1
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLDATA2 -w BIHOST2:VOLDATA2
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLDATA3 -w BIHOST2:VOLDATA3
sleep 20
rsh BIHOST2 snapmirror resync -f -S BIHOST1:VOLDATA4 -w BIHOST2:VOLDATA4
sleep 20

例B-4 akshスクリプト

script
/**********************************************************
* Script to role reverse the target Sun Storage Appliance *
* Written By ABC                                   *
* 2 Feburary 2011                                          *
**********************************************************/
 
function deleteExistingProject(projectName, poolName)
{
        printf("Making sure project: '" + projectName  + "' do not exist before on the standby appliance\n");
 
        run ('cd /');
        run ('shares');
        run ('set pool=' + poolName);
        try {
                run ('select ' + projectName);
                run ('confirm destroy');
        } catch (err) { 
                printf("No Project to to delete.. \n"); 
        }
}
 
function getSourcePackages(poolName, sourceId)
{
        printf("Selecting the packages for source: " + sourceId + "\n");
        run ('cd /');
        run ('shares');
        run ('set pool=' + poolName);     
        run('replication sources select ' + sourceId);
        var packages = list();
        return packages;
}
 
function roleReverseProject(projectName, poolName, sourceId)
{
        deleteExistingProject(projectName, poolName);
        var packages = getSourcePackages(poolName, sourceId);
        for (var i = 0; i < packages.length; i++) {
                run('select ' + packages[i]);
                var projName = list();
                if (projName == projectName) {
                        package = packages[i] ;
                        run('confirm reverse');
                        printf("Project Details after reversal \n");
                        run('show');
                        printf("Source and the target roles are reversed now..\n");
                        reverseReplication(projectName, poolName);
                        printf("Replication direction is reversed also\n");
                        break;
                }//EOF if
                run('cd ..');
        }//EOF for
        printf("The package chosen to role reverse : %s \n", package);
        return package;
}
 
function reverseReplication(projectName, poolName)
{
        run('cd /');
        run('shares');
        run('set pool=' + poolName);
        run('select ' + projectName + ' replication');
        run('select action-000');
        run('set continuous=true');
        run('commit');
}
 
roleReverseProject('SiteGuard','pool-0','source-000');