HP OpenView Storage Mirroring User Guide (360226-002, May 2004)

A - 43
Basic restore script
The following script will restore the data in the Exchange replication set from the target machine to the source machine.
Basic getting started script with variables
The following script uses variables to identify the source, target, and replication set. These variables are then used in the
DTCL commands. The $connectionID variable will contain the connection ID for the connection established. This variable
can then be used to establish a verification schedule.
Basic flow control script
The following script uses the IF conditional, FOR loop, and WHILE loop commands. In the following examples the FOR loop
will start a mirror for all connections between 1 and 10. The IF conditional will return the error command “mirror failed to
start” if a value of 0 is not obtained. The WHILE loop will wait for a mirror to end and disconnect as long as the returned
value is less than 10. The IF conditional will return the error message “failed to disconnect” if a value of 0 is not obtained.
source indy;
restore Exchange to jersey nooverwritenewer, usetargetdb;
$TheTarget = “jersey”;
$TheSource = “indy”;
$TheRepset = “Exchange”;
source $TheSource;
repset create $TheRepset;
repset rule add c:\exchsrvr include, recursive;
repset rule add c:\exchsrvr\bin exclude;
repset rule add d:\exchsrvr include, recursive;
repset save;
$ConnectionID = connect $TheRepset to $TheTarget map exact;
verify $ConnectionID sync, newer, checksum, every 12 hr;
#Start mirror for all connections 1-10. #
#Notify user of any errors. #
SOURCE indy;
FOR $x = 1 TO 10 DO
$ret = MIRROR START $x;
IF $ret != 0 THEN
WRITE “Mirror failed to start”;
WRITE $x;
WRITE $ret;
END
END
#Wait for mirror to end and disconnect all connections 1-10. #
#Notify user of any errors. #
SOURCE indy;
$x = 1;
WHILE $x <= 10 DO
waitonmirror $x;
$ret = disconnect $X;
IF $ret != 0 THEN
WRITE “Failed to disconnect”;
WRITE $x;
WRITE $ret;
END
$x = $x + 1;
END