Top
ETERNUS SF AdvancedCopy Manager 14.1 Operator's Guide

A.3.2 Post-processing of restoration

The name of a script file for post-processing of a restoration is as follows.

In the case of non-cluster operation
environment-settings-directory\etc\backup\scripts\OpcRestorePost.js 
In the case of cluster operation
<Shared disk>:\etc\opt\swstorage\etc\backup\scripts\OpcRestorePost.js

A.3.2.1 Post-processing script for restoration

  1: // AdvancedCopy Manager for Windows
  2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
  3: //
  4: // OpcRestorePost.js: Post-Processing Script for swstrestore
  5: //
  6: // [Parameters]
  7: // 1st argument: device name of transaction volume
  8: //
  9: // [Return Values]
 10: // 0: The script ended normally.
 11: // 2: The number of the arguments is incorrect.
 12: // (3,5): not used, but must not be used because older versions use these values.
 13: // 4: An error other than the above occurred.
 14: 
 15: try {
 16:    // create global objects
 17:    var WshShell = WScript.CreateObject("WScript.Shell");           // create Shell object
 18:    var WshEnv = WshShell.Environment("PROCESS");                     // create Environment object
 19:    var fsObj    = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object
 20: 
 21:    // create SwstRestorePostProc object
 22:    var proc = new SwstRestorePostProc();
 23: 
 24:    // do nothing if postprocessing file exists
 25:    if (fsObj.FileExists(proc.postFileName) == false) {
 26:  proc.doNothing();
 27:    }
 28:    // get postprocessing type
 29:    else {
 30:  var postProcType = proc.getPostProcType();
 31:  switch(postProcType) {
 32:  case "none":
 33:     proc.doNothing();
 34:     break;
 35:       }
 36:    }
 37: 
 38:    // clear temporary file
 39:    proc.deletePostFile();
 40:    SwstQuit(0);
 41: } catch (e) {
 42:    SwstQuit(6);
 43: }
 44: 
 45: function SwstRestorePostProc()
 46: {
 47:    // member variables
 48:    this.tvName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume
 49:    this.postFileName = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".pre";   // name of postprocessing file
 50: 
 51:    // member functions
 52:    this.getPostProcType= getPostProcType;                // self-explanatory
 53:    this.doNothing       = doNothing;                       // self-explanatory
 54:    this.deletePostFile = deletePostFile;                 // self-explanatory
 55: }
 56: 
 57: function getPostProcType()
 58: {
 59:    var iomode = 1;    // means read-only mode
 60:    var create = false; // means not to create a file
 61:    var postFileStream = fsObj.OpenTextFile(this.postFileName, iomode, create);
 62:    var postProc = postFileStream.ReadAll();
 63:    postFileStream.Close();
 64:    return postProc;
 65: }
 66: 
 67: function doNothing()
 68: {
 69:    // do nothing
 70: }
 71: 
 72: function deletePostFile()
 73: {
 74:    if (fsObj.FileExists(this.postFileName) == true) {
 75:  fsObj.DeleteFile(this.postFileName);
 76:    }
 77: }
 78: 
 79: function SwstQuit(exitStatus)
 80: {
 81:    switch(exitStatus) {
 82:    case 0:
 83:  WScript.Quit(0);
 84:    case 1:
 85:  WScript.Echo("[Restore Postprocessing] The number of the arguments is incorrect.");
 86:  WScript.Quit(2);
 87:    default:
 88:  WScript.Echo("[Restore Postprocessing] The script exited abnormally.");
 89:  WScript.Quit(4);
 90:    }
 91: }
 92: 
 93: function getDataPathName()
 94: {
 95:    return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT";
 96: }
 97: 
 98: function getBinPathName()
 99: {
100:    return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin";
101: }
102: 
103: function getSetupInfoKey()
104: {
105:    var nodeName = WshEnv.Item("SWSTGNODE");
106:    if( nodeName != "" ){
107:  return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName;
108:    }
109:    return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion";
110: }
111: 
112: function getPutFileName(deviceName){
113:    var fileName;
114:    if( isSafeDISKName(deviceName) ){
115:  var re = /(\S+)\/(\S+):(\S+)/;
116:  fileName = deviceName.replace(re, "$1_$2_$3");
117:    }else{
118:  fileName = deviceName;
119:    }
120:    return(fileName);
121: }
122: 
123: function getGXDXPX(deviceName){
124:    var gXdXpX;
125:    if( isSafeDISKName(deviceName) ){
126:  var re = /(\S+)\/(\S+):(\S+)/;
127:  gXdXpX = deviceName.replace(re, "$3");
128:    }else{
129:  gXdXpX = deviceName;
130:    }
131:    return(gXdXpX);
132: }
133: 
134: function isSafeDISKName(deviceName){
135:    var key = ":g";
136:    var s = deviceName.indexOf(key);
137:    if ( s < 0 ) {
138:  return (false);
139:    } else {
140:  return (true);
141:    }
142: }

Point

The backup volume is locked/unlocked not by the script but by the command. Therefore, the restoration pre-processing and post-processing scripts are executed immediately before and after the backup volume is locked/unlocked.

Figure A.6 Restoration

Note

In the restoration pre-processing, to avoid a temporary access conflict with other applications, locking is retried if it cannot complete its operation. If the number of times the command is executed reaches the specified retry count limit, locking ends abnormally. If an abnormal end occurs, a process that is using the backup-restored volume remains active. Stop all applications and services involved or take other appropriate measures so that the volume cannot be used by another process.
Although the retry count limit can be changed by creating a volume locking specification file and resetting the count limit (for details on the file, refer to Backup-restored volume locking specification file), the files do not need to be created if appropriate measures have been taken to prevent other processes from using the target volume during restoration processing execution.


A.3.2.2 Backup-restored volume locking specification file

If locking fails in the backup-restored volume restore pre-processing, locking is retried to avoid a temporary access conflict with other applications. The standard retry operations are as follows:

The maximum number of retries (the default value = 20 attempts) and retry interval (default value = 1 second) can be changed by creating a setting file called the backup-restored volume locking specification file for backups. In this setting file, the following instructions can be specified for the backup-restored volume backup pre-processing:

Note

swstresback (Resource backup command) cannot back up this file . In operations that use this file , the copy command, etc., must be executed to back up the backup-restored volume locking specification file for backups.


A.3.2.2.1 Creating a backup-restored volume locking specification file

Use a name such as the one below to create a backup-restored volume locking specification file for backups.

File name

For a non-cluster operation

environment-setting-directory\etc\backup\data\RDSTLOCK.INI

For a cluster operation

<shared-disk>:\etc\opt\swstorage\etc\backup\data\RDSTLOCK.INI

Examples of settings in the backup-restored volume locking specification file for backup are listed below.

[g1d1p1]
LockForceMode=on
LockRetryNumber=10
LockRetryInterval=10
[ANY]
LockForceMode=off
LockRetryNumber=20
LockRetryInterval=100

An explanation of how to create a backup-restored volume locking specification file for restores is given below.

RDSTLOCK.INI parameter settings

Key

Explanation

LockForceMode

If locking of the backup-restored volume fails, locking is retried. This parameter specifies that the volume be dismounted before locking is retried.

off (default value) = no dismount before locking is retried

on = dismount before locking is retried

When the volume is dismounted, all handles opened for the volume become invalid.

* If the volume is set in the used state immediately after it is dismounted, then locking may be impossible.

LockRetryNumber

If locking of the backup-restored volume fails, locking is retried. This parameter specifies the retry count limit. A numeric value ranging from 1 to 10,000 can be specified.
The default value is 20 (retries).
If the backup volume cannot be locked after locking is retried for the specified retry count limit, then the processing is suspended and the command ends abnormally.

LockRetryInterval

If locking of the backup-restored volume fails, locking is retried. This parameter specifies the retry interval in milliseconds. A numeric value ranging from 1 to 600,000 (ie, 10 minutes) can be specified. The default value is 1,000 (ie, 1 second).