beautypg.com

Sample xp disk array job using windows batch file – HP P6000 Continuous Access Software User Manual

Page 20

background image

// Assign some variables that will be used in this job.

$source_host1 = SetVariable ( " Production Server IP " )

$mount_host = SetVariable ( " Backup Server IP " )

$source_hostvol_unc1 = SetVariable ("\\ProductionServerHostName\W:\")

//

// Validate that resources are as expected.

ValidateHost ( $source_host1 )

ValidateHost ( $mount_host )

ValidateHostVolume ( $source_hostvol_unc 1 )

ValidateHostVolumeMirrorclones ( $source_hostvol_unc 1 )

//

WaitHostVolumeNormalization ( $source_hostvol_unc 1 )

//

// Begin flushing the cache on the host volume(s).

SetHostVolumeWriteCacheMode ( $source_hostvol_unc1, WRITE_CACHE_DISABLED, NOWAIT )

one rror pauseat E1:

//

// Wait for the cache flush to complete.

WaitForHostVolumeWriteCacheFlush ( $source_hostvol_unc 1 ) onerror pauseat E2:

//

// Suspend the host application.

Launch ( $source_host1, " c:\pre.bat ", "", WAIT, "" ) onerror pauseat E2:

/ /

DO {

// Perform the replication.

$Rep1 = FractureHostVolumeMirrorclones ( $source_hostvol_unc1, WAIT ) onerror pauseat E3:

//

} ALWAYS {

//

// Resume the host application.

Launch ( $source_host1, " c:\post.bat ", "", WAIT, "" )

//

17

// Restore the writeback cache on the host volume(s).

SetHostVolumeWriteCacheMode ( $source_hostvol_unc1, WRITE_CACHE_ENABLED, NOWAIT )

onerror continue

//

}

//

// Mount the replicated volume(s) on a host.

PresentStorageVolumes ( $Rep1, $ mount_host ) onerror pauseat E4:

DiscoverDiskDevices ( $mount_host, $Rep1 ) onerror continue

$HV1 = CreateHostVolumeFromDiskDevices ( $source_hostvol_unc1, $Rep1, $mount_host ) onerror

pauseat E4:

$MP1 = MountHostVolume ( $HV1, "L" ) onerror pauseat E5:

//

// Add the replica(s) to the repository.

$ Repository 1 = CreateRepl icaRepository ( HOST_VOLUME, $source_hostvol_u nc 1,

INSTANT_RESTORE, "" )

AddReplicasToReplicaRepository ( $Repository1, $Rep1 )

//

// Wait for user to initiate rollback.

Pause ( )

//

//

// Rollback.

DeleteReplicaRepository ( $Repository1, FALSE )

E6: UnmountHostVolume ( $MP1 ) onerror pauseat E6:

E5: DeleteHostVolume ( $HV1 ) onerror pauseat E5:

E4: ResyncMirrorclones ( $Rep1 ) onerror pauseat E4:

E3: Exit ( SUCCESS )

E2: SetHostVolumeWriteCacheMode ( $source_hostvol_unc1, WRITE_CACHE_ENABLED, NOWAIT )

onerror continue

Exit ( SUCCESS )

//

// Failure exit - no rollback needed.

E1: Exit ( FAILURE )

Sample XP disk array job using Windows batch file

The following example is a Windows batch file to stop database I/O, mirror a volume group, split
the group, and resume database I/O for an XP Disk Array.

@echo off

@SETLOCAL

Creating snapshot backups using HP DButil

20