| ETERNUS SF AdvancedCopy Manager 運用手引書 テープバックアップ連携編 13.3 -Microsoft(R) Windows(R) 2000/Microsoft(R) Windows Server(R) 2003/Microsoft(R) Windows Server(R) 2008-, -Solaris-, -HP-UX-, -Linux-, -AIX- |
目次
索引
![]()
|
| 付録A バックアップ/リストア/テープコピーの前後処理 | > A.4 テープコピーの前後処理 |
テープコピー実行時の後処理のスクリプトファイル名は、以下のとおりです。
非クラスタ運用の場合
“環境設定ディレクトリ”\etc\backup\scripts\TapeCopyPost.js |
クラスタ運用の場合
<共有ディスク>:\etc\opt\swstorage\etc\backup\scripts\TapeCopyPost.js |
スクリプトファイルの内容は、以下のとおりです。
1 // AdvancedCopy Manager for Windows
2 // All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2006
3 //
4 // TapeCopyPost.js: Post-Processing Script for tape copy
5 //
6 // [Parameters]
7 // 1st argument: device name of backup volume
8 //
9 // [Return Values]
10 // 0: The script ended normally.
11 // 2: The number of the arguments is incorrect.
12 // 4: An error other than the above occurred.
13
14 try {
15 // create global objects
16 var WshShell = WScript.CreateObject("WScript.Shell"); // create Shell object
17 var WshEnv = WshShell.Environment("PROCESS"); // create Environment object
18 var fsObj = WScript.CreateObject("Scripting.FileSystemObject"); // create FileSystemObject object
19
20 // create SwstTapeCopyPostProc object
21 var proc = new SwstTapeCopyPostProc();
22
23 // do nothing if postprocessing file exists
24 if (fsObj.FileExists(proc.postFileName) == false) {
25 SwstQuit(0);
26 }
27
28 // get postprocessing type
29 var postProcType = proc.getPostProcData(proc.postFileName);
30 switch(postProcType) {
31 case "none":
32 proc.doNothing();
33 break;
34 }
35
36 // clear temporary files
37 proc.deletePostFile(proc.postFileName);
38 SwstQuit(0);
39 } catch (e) {
40 SwstQuit(6);
41 }
42
43 function SwstTapeCopyPostProc()
44 {
45 // member variables
46 this.bvName = WScript.Arguments.length!=1?SwstQuit(1):WScript.Arguments.Item(0); // device name of transaction volume
47 this.postFileName = getDataPathName() + "\\" + getPutFileName(this.bvName) + ".pre"; // name of postprocessing file
48
49 // member functions
50 this.getPostProcData = getPostProcData; // self-explanatory
51 this.doNothing = doNothing; // self-explanatory
52 this.deletePostFile = deletePostFile; // self-explanatory
53 }
54
55 function getPostProcData(postfile)
56 {
57 var iomode = 1; // means read-only mode
58 var create = false; // means not to create a file
59 var postFileStream = fsObj.OpenTextFile(postfile, iomode, create);
60 var postData = postFileStream.ReadAll();
61 postFileStream.Close();
62 return postData;
63 }
64
65 function doNothing()
66 {
67 // do nothing
68 }
69
70 function deletePostFile(postfile)
71 {
72 if (fsObj.FileExists(postfile) == true) {
73 fsObj.DeleteFile(postfile);
74 }
75 }
76
77 function SwstQuit(exitStatus)
78 {
79 switch(exitStatus) {
80 case 0:
81 WScript.Quit(0);
82 case 1:
83 WScript.Echo("[Tape copy Postprocessing] The number of the arguments is incorrect.");
84 WScript.Quit(2);
85 default:
86 WScript.Echo("[Tape copy Postprocessing] The script exited abnormally.");
87 WScript.Quit(4);
88 }
89 }
90
91 function getDataPathName()
92 {
93 return WshShell.RegRead(getSetupInfoKey() + "\\etcPathName") + "\\etc\\backup\\data\\DEFAULT";
94 }
95
96 function getSetupInfoKey()
97 {
98 var nodeName = WshEnv.Item("SWSTGNODE");
99 if( nodeName != "" ){
100 return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion\\" + nodeName;
101 }
102 return "HKEY_LOCAL_MACHINE\\SOFTWARE\\Fujitsu\\AdvancedCopy Manager\\CurrentVersion";
103 }
104
105 function getPutFileName(deviceName){
106 var fileName;
107 fileName = deviceName;
108 return(fileName);
109 } |

バックアップボリュームのロック/ロック解除処理はスクリプトではなく、プログラム内で実施されています。したがって、テープコピーの前処理スクリプト、テープコピーの後処理スクリプトは、ボリュームのロック/ロック解除処理の直前、直後にそれぞれ実行されます。テープコピーの前後処理スクリプトでは、実質的に何も処理を実施していません。


テープコピーの前処理では、他アプリケーションとの一時的なアクセス競合を回避するために、ロック処理に失敗した場合、ロック処理のリトライを実施します。既定のリトライ回数を超えた場合、コマンドは異常終了します。この場合、バックアップボリュームを使用しているプロセスが存在していますので、アプリケーションやサービスの停止を行う等の対処を実施して、他のプロセスからボリュームが使用されていない状態にしてください。なお、ボリュームロック動作指定ファイルと呼ばれる設定ファイルを作成することにより、規定のリトライ回数の変更を行うことが可能です(詳細については、「Windowsのテープコピー用バックアップボリュームロック動作指定ファイル」を参照してください)。
ただし、テープコピー処理実行時に他のプロセスが処理対象ボリュームを使用しないための対策が適切に行われている場合は、通常はこのファイルを作成する必要はありません。
目次
索引
![]()
|