ETERNUS SF AdvancedCopy Manager Operator's Guide 13.0 -Microsoft(R) Windows(R) 2000- -Microsoft(R) Windows Server(TM) 2003-
Contents Index PreviousNext

Appendix A Preprocessing and Postprocessing of Backup and Restoration

This appendix describes preprocessing and postprocessing of backup and restoration.

A.1 Overview 

Preprocessing and postprocessing of backup or restoration are started before and after backup or restoration when a backup or restore execution command is executed.

These processing are executed in processing required by AdvancedCopy Manager to back up or restore a transaction volume.

This chapter describes the content and setup of preprocessing and postprocessing.

A.2 Preprocessing and Postprocessing of Backup 

Backup on AdvancedCopy Manager must be performed basically while access to a transaction volume from other processes is inhibited.

As explained above, the transaction volume is usually locked in preprocessing. By specifying the Xflush option in the backup execution command or setting BufferFlushOnly to on in the transaction volume locking specification file for backups, you can flush the file system buffer without locking the volume.

In addition, the backup volume is locked in preprocessing. The backup volume is locked when the backup synchronous processing or snapshot sequence starts and is unlocked after backup postprocessing is complete.

Preprocessing for synchronous processing
(implemented with the backup synchronous processing start command)

[Default operation]

  1. The backup volume is locked.

Postprocessing for synchronous processing
(implemented with the backup synchronous processing start command in a cluster system)

[Default operations]

  1. The backup volume is dismounted.

  2. The backup volume is unlocked.

Backup preprocessing
(implemented with the backup execution command)

[Default operations]

  1. For a snapshot backup or synchronous backup in a cluster system, the backup volume is locked.

  2. The transaction volume is locked.

[When the Xflush option is specified or BufferFlushOnly is set to on]

  1. For a snapshot backup or synchronous backup in a cluster system, the backup volume is locked.

  2. The file system buffer of the transaction volume is flushed.

Backup postprocessing
(implemented with the backup execution command)

[Default operations]

  1. The transaction volume is unlocked.

  2. The backup volume is dismounted.

  3. The backup volume is unlocked.

[When the Xflush option is specified or BufferFlushOnly is set to on]

  1. The backup volume is dismounted.

  2. The backup volume is unlocked.

To add user-specific processing to the preprocessing or postprocessing, add the processing in the backup preprocessing or postprocessing script.

These scripts are coded in the Jscript language and executed on a Windows Scripting Host (WSH).

When customizing a script, strictly observe the following rules regarding error code:

Error code

Usage

0-99

Unusable (reserved for AdvancedCopy Manager)

100-255

Usable

If post-processing was failed, execute the Resource match command(swstsrsemtch) because the consistency of resource information may be incomplete.

The figure below shows an image of the preprocessing and postprocessing operations:

[[Processing in a synchronous-type backup operation]]

A.2.1 Preprocessing of backup 

The name of a script file for preprocessing of backup is as follows.

In the case of non-cluster operation

"environment-settings-directory\etc\backup\scripts\OpcBackupPre.js"

In the case of cluster operation

<Shared disk>:\etc\opt\swstorage\etc\backup\scripts\OpcBackupPre.js

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

A.2.2 Postprocessing of backup 

The name of a script file for postprocessing of backup is as follows.

In the case of non-cluster operation

"environment-settings-directory \etc\scripts\OpcBackupPost.js"

In the case of cluster operation

<Shared disk>:\etc\opt\swstorage\etc\backup\scripts\OpcBackupPost.js

  1: // AdvancedCopy Manager for Windows
  2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006
  3: //
  4: // OpcBackupPost.js: Post-Processing Script for swstbackup
  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: // (1,3,5-8): 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 SwstBackupPostProc object
 22:     var proc = new SwstBackupPostProc();
 23: 
 24:     // do nothing if postprocessing file exists
 25:     if (fsObj.FileExists(proc.postFileName) == false) {
 26:         SwstQuit(0);
 27:     }
 28: 
 29:     // get postprocessing type
 30:     var postProcType = proc.getPostProcData(proc.postFileName);
 31:     switch(postProcType) {
 32:     case "none":
 33:         proc.doNothing();
 34:         break;
 35:     }
 36: 
 37:     // do nothing if postprocessing file exists
 38:     if (fsObj.FileExists(proc.bdFileName) == true) {
 39:         var bvName = proc.getPostProcData(proc.bdFileName);
 40:         proc.doNothing();
 41:     }
 42: 
 43:     // clear temporary files
 44:     proc.deletePostFile(proc.postFileName);
 45:     proc.deletePostFile(proc.bdFileName);
 46:     SwstQuit(0);
 47: } catch (e) {
 48:     SwstQuit(6);
 49: }
 50: 
 51: function SwstBackupPostProc()
 52: {
 53:     // member variables
 54:     this.tvName       = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume
 55:     this.postFileName = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".pre";   // name of postprocessing file
 56:     this.bdFileName   = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".bd";    // name of postprocessing file
 57: 
 58:     // member functions
 59:     this.getPostProcData     = getPostProcData;             // self-explanatory
 60:     this.doNothing           = doNothing;                   // self-explanatory
 61:     this.deletePostFile      = deletePostFile;              // self-explanatory
 62: }
 63: 
 64: function getPostProcData(postfile)
 65: {
 66:     var iomode = 1;     // means read-only mode
 67:     var create = false; // means not to create a file
 68:     var postFileStream = fsObj.OpenTextFile(postfile, iomode, create);
 69:     var postData = postFileStream.ReadAll();
 70:     postFileStream.Close();
 71:     return postData;
 72: }
 73: 
 74: function doNothing()
 75: {
 76:     // do nothing
 77: }
 78: 
 79: function deletePostFile(postfile)
 80: {
 81:     if (fsObj.FileExists(postfile) == true) {
 82:         fsObj.DeleteFile(postfile);
 83:     }
 84: }
 85: 
 86: function SwstQuit(exitStatus)
 87: {
 88:     switch(exitStatus) {
 89:     case 0:
 90:         WScript.Quit(0);
 91:     case 1:
 92:         WScript.Echo("[Backup Postprocessing] The number of the arguments is incorrect.");
 93:         WScript.Quit(2);
 94:     default:
 95:         WScript.Echo("[Backup Postprocessing] The script exited abnormally.");
 96:         WScript.Quit(4);
 97:     }
 98: }
 99: 
100: function getDataPathName()
101: {
102:     return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT";
103: }
104: 
105: function getBinPathName()
106: {
107:     return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin";
108: }
109: 
110: function getSetupInfoKey()
111: {
112:     var nodeName = WshEnv.Item("SWSTGNODE");
113:     if( nodeName != "" ){
114:         return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName;
115:     }
116:     return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion";
117: }
118: 
119: function getPutFileName(deviceName){
120:     var fileName;
121:     if( isSafeDISKName(deviceName) ){
122:         var re = /(\S+)\/(\S+):(\S+)/;
123:         fileName = deviceName.replace(re, "$1_$2_$3");
124:     }else{
125:         fileName = deviceName;
126:     }
127:     return(fileName);
128: }
129: 
130: function getGXDXPX(deviceName){
131:     var gXdXpX;
132:     if( isSafeDISKName(deviceName) ){
133:         var re = /(\S+)\/(\S+):(\S+)/;
134:         gXdXpX = deviceName.replace(re, "$3");
135:     }else{
136:         gXdXpX = deviceName;
137:     }
138:     return(gXdXpX);
139: }
140: 
141: function isSafeDISKName(deviceName){
142:     var key = ":g";
143:     var s = deviceName.indexOf(key);
144:     if ( s < 0 ) {
145:         return (false);
146:     } else {
147:         return (true);
148:     }
149: }

The transaction volume is locked/unlocked, and the buffer is flushed by the command, not by the script. Therefore, the backup preprocessing script and backup postprocessing script are executed, respectively, immediately before and after the transaction volume is locked/unlocked and the buffer is flushed. The backup preprocessing and postprocessing scripts essentially do not perform any processing.

[[Snapshot-type backup (OPC)]]

[[Synchronous-type backup (EC) in a non-cluster system]]

[[Synchronous-type backup (EC) in a cluster system operation]]

In the preprocessing for synchronous processing and the backup preprocessing, to avoid a temporary access contention 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, locking ends abnormally. If an abnormal end occurs, a process that is using the transaction volume or backup volume remains. 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 can be changed by creating volume locking specification files and re-setting the count (for details on the files, refer Transaction volume locking specification file for backups and Backup volume locking specification file for backups), the files do not need to be created if appropriate measures have been taken to prevent other processes from using the target volumes during backup processing execution.

For a synchronous-type backup in a cluster system operation, to prevent the cluster system from being monitored, the backup volume is locked only while the backup synchronous processing start command is running and the backup execution command is running (refer to the figure above). That is, the backup volume remains unlocked from when the backup synchronous processing start command is executed to when the backup execution command is executed. This may cause a message described in "About the message outputted to an event viewer" in "General notes", in this manual to be output to the event log, but since there is no problem, the message can be ignored.

A.2.2.1 Transaction volume locking specification file for backups

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

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

The resource backup command (swstresback) cannot back up the transaction volume locking specification file for backups. In operations that uses the transaction volume locking specification file for backups, the copy command, etc., must be executed to back up the transaction volume locking specification file for backups.

A.2.2.1.1 Creating a transaction volume locking specification file for backups 

Using a name such as the one below to create a transaction volume locking specification file for backups.

File name

[In the case of non-cluster operation]

"environment-settings-directory\etc\backup\data\BTRANLOCK.INI

[In the case of cluster operation]

<Shared disk>:\etc\opt\swstorage\etc\backup\data\BTRANLOCK.INI


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

[g1d1p1]

BufferFlushOnly=off

LockForceMode=on

LockRetryNumber=10

LockRetryInterval=10

[g1d1p2]

BufferFlushOnly=on

[ANY]

BufferFlushOnly=off

LockForceMode=off

LockRetryNumber=20

LockRetryInterval=100

An explanation of how to create a transaction volume locking specification file for backups is given below.

+BTRANLOCK.INI parameter settings

Key

Explanation

BufferFlushOnly

Specifies flushing the file system buffer of the transaction volume instead of locking the transaction volume:

off (default value) = buffer is not flushed (locking)
on = buffer is flushed (no locking)

If the Xflush option is specified in swstbackup or swstbackup_exchange and BufferFlushOnly=off, then the Xflush option has priority.

If BufferFlushOnly is set to on, all other parameters (LockForceMode, LockRetryNumber, and LockRetryInterval) become invalid.

Before on is set for this parameter, all write processing on the transaction volume must be stopped. (If a replica is created without the write processing stopped, then the transaction volume data is not guaranteed.)

If on is specified for NoPrePost, then this parameter becomes invalid.

LockForceMode

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

off (default value) = no dismounting before locking is retried
on = dismounting 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.

If on is specified for BufferFlushOnly or NoPrePost, then this parameter becomes invalid.

LockRetryNumber

If locking of the transaction volume fails, locking is retried. This parameter specifies the retry count. A numeric value ranging from 1 to 10000 can be specified.

The default value is 20 (times).

If the transaction volume cannot be locked after locking is retried for the specified retry count, then the processing is suspended and the command ends abnormally.

If on is specified for BufferFlushOnly or NoPrePost, then this parameter becomes invalid.

LockRetryInterval

If locking of the transaction volume fails, locking is retried. This parameter specifies the retry interval (in milliseconds). A numeric value ranging from 1 to 600000 (10 minutes) can be specified. The default value is 1000 (1 second).

If on is specified for BufferFlushOnly or NoPrePost, then this parameter becomes invalid.

NoPrePost

Specifies that the backup preprocessing and postprocessing are not to be performed.

off (default) = The backup preprocessing and postprocessing are performed.
on = The backup preprocessing and postprocessing are not performed.

Setting NoPrePost to on disables all the other parameters (BufferFlushOnly, LockForceMode, LockRetryNumber, and LockRetryInterval).


A.2.2.2 Backup volume locking specification file for backups 

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

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

The resource backup command (swstresback) cannot back up the backup volume locking specification file for backups. In operations that uses the backup volume locking specification file for backups, the copy command, etc., must be executed to back up the backup volume locking specification file for backups.

A.2.2.2.1 Creating a backup volume locking specification file for backups 

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

File name

[For a non-cluster operation]

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

[For a cluster operation]

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


Examples of settings in the backup 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 volume locking specification file for backups is given below.

+BBACKLOCK.INI parameter settings

Key

Explanation

LockForceMode

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

off (default value) = no dismounting before locking is retried
on = dismounting 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 volume fails, locking is retried. This parameter specifies the retry count. A numeric value ranging from 1 to 10000 can be specified.

The default value is 20 (times).

If the backup volume cannot be locked after locking is retried for the specified retry count, then the processing is suspended and the command ends abnormally.

LockRetryInterval

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


A.3 Preprocessing and Postprocessing of Restoration 

Restoration with AdvancedCopy Manager requires backup-restored volumes to be inaccessible from other processes.

Therefore, in normal restoration preprocessing, the following processing is executed:

Preprocessing

The backup-restored volume is locked.

The postprocessing determines what needs to be done according to what was done in the preprocessing.

Postprocessing

The backup-restored volume is dismounted.
The backup-restored volume is unlocked.

In addition, if extra preprocessing or postprocessing is needed, add the required operation in the preprocessing script or postprocessing script.

These scripts are coded in the Jscript language and executed on a Windows Scripting Host (WSH).

When customizing a script, strictly observe the following rules regarding error code:

Error code

Usage

0-99

Unusable (reserved for AdvancedCopy Manager)

100-255

Usable

If the postprocessing fails, the resource information may have inconsistencies. Execute swstsrsemtch described in Section, "Resource match command (swstsrsemtch)", in the operation guide.

The figure below shows an image of the preprocessing and postprocessing operations:

[[Operations for restoration]]

A.3.1 Preprocessing of restoration 

The name of a script file for preprocessing of restoration is as follows.

In the case of non-cluster operation

"environment-settings-directory\etc\backup\scripts\OpcRestorePre.js"

In the case of cluster operation

<Shared disk>:\etc\opt\swstorage\etc\backup\scripts\OpcRestorePre.js

  1: // AdvancedCopy Manager for Windows
  2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2005
  3: //
  4: // OpcRestorePre.js: Pre-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: 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 SwstRestorePreProc object
 22:     var proc = new SwstRestorePreProc();
 23: 
 24:     // there is nothing to do if the pre/post-processing is not customized
 25:     proc.doNothingForDriveLetter();
 26: 
 27:     SwstQuit(0);
 28: } catch (e) {
 29:     SwstQuit(4);
 30: }
 31: 
 32: function SwstRestorePreProc()
 33: {
 34:     // member variables
 35:     this.tvName       = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume
 36:     this.postFileName = getDataPathName() + "\\" + getPutFileName(this.tvName) + ".pre";   // name of postprocessing file
 37: 
 38:     // member functions
 39:     this.doNothingForDriveLetter = doNothingForDriveLetter; // self-explanatory
 40:     this.writePostFile           = writePostFile;           // self-explanatory
 41: }
 42: 
 43: function doNothingForDriveLetter()
 44: {
 45:     this.writePostFile("none");
 46: }
 47: 
 48: function writePostFile(type)
 49: {
 50:     var overwrite = true; // means to overwrite a file if it exists.
 51:     var postFileStream = fsObj.CreateTextFile(this.postFileName, overwrite);
 52:     postFileStream.Write(type);
 53:     postFileStream.Close();
 54: }
 55: 
 56: function SwstQuit(exitStatus)
 57: {
 58:     switch(exitStatus) {
 59:     case 0:
 60:         WScript.Quit(0);
 61:     case 1:
 62:         WScript.Echo("[Restore Preprocessing] The number of the arguments is incorrect.");
 63:         WScript.Quit(2);
 64:     default:
 65:         WScript.Echo("[Restore Preprocessing] The script exited abnormally.");
 66:         WScript.Quit(4);
 67:     }
 68: }
 69: 
 70: function getDataPathName()
 71: {
 72:     return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT";
 73: }
 74: 
 75: function getBinPathName()
 76: {
 77:     return WshShell.RegRead(getSetupInfoKey() + "\\PathName") + "\\bin";
 78: }
 79: 
 80: function getSetupInfoKey()
 81: {
 82:     var nodeName = WshEnv.Item("SWSTGNODE");
 83:     if( nodeName != "" ){
 84:         return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName;
 85:     }
 86:     return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion";
 87: }
 88: 
 89: function getPutFileName(deviceName){
 90:     var fileName;
 91:     if( isSafeDISKName(deviceName) ){
 92:         var re = /(\S+)\/(\S+):(\S+)/;
 93:         fileName = deviceName.replace(re, "$1_$2_$3");
 94:     }else{
 95:         fileName = deviceName;
 96:     }
 97:     return(fileName);
 98: }
 99: 
100: function getGXDXPX(deviceName){
101:     var gXdXpX;
102:     if( isSafeDISKName(deviceName) ){
103:         var re = /(\S+)\/(\S+):(\S+)/;
104:         gXdXpX = deviceName.replace(re, "$3");
105:     }else{
106:         gXdXpX = deviceName;
107:     }
108:     return(gXdXpX);
109: }
110: 
111: function isSafeDISKName(deviceName){
112:     var key = ":g";
113:     var s = deviceName.indexOf(key);
114:     if ( s < 0 ) {
115:         return (false);
116:     } else {
117:         return (true);
118:     }
119: }

A.3.2 Postprocessing of restoration 

The name of a script file for postprocessing of 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

  1: // AdvancedCopy Manager for Windows
  2: // All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006
  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: }

The backup volume is locked/unlocked not by the script but by the command. Therefore, the restoration preprocessing script and restoration postprocessing script are respectively executed immediately before and after the backup volume is locked/unlocked.

[[Restoration]]

In the restoration preprocessing, to avoid a temporary access contention 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, locking ends abnormally. If an abnormal end occurs, a process that is using the backup-restored volume remains. 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 can be changed by creating a volume locking specification file and re-setting the count (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.1 Backup-restored volume locking specification file 

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

The maximum number of retries (default value = 20 times) 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 preprocessing:

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

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

Using 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 dismounting before locking is retried
on = dismounting 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. A numeric value ranging from 1 to 10000 can be specified.

The default value is 20 (times).

If the backup volume cannot be locked after locking is retried for the specified retry count, 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 600000 (10 minutes) can be specified. The default value is 1000 (1 second).



Contents Index PreviousNext

All Rights Reserved, Copyright(C) FUJITSU LIMITED 2002-2006