回復の例

索引ファイルの回復ユーティリティを実行した例を図 1 から図 4 に示します。この例では、回復セッションを次のコマンドで開始しています。

recover1 master.inx dropout1

図 1 は、master.inx ファイルに関する情報を示しています。

回復するファイルの名前の下に、ファイルの状態の説明が表示されます。次のいずれかのメッセージが表示される場合があります。

  • This file has not been marked as needing recovery!
  • The Open For Modify Count for this file is not zero: count
  • File has been marked as corrupted due to a previous error.
  • KIB is corrupt. Using template file: template-file
  • KIB is corrupt. Enter a template filename (press Enter for manual entry).

KIB が破損している場合、テンプレート ファイル名が入力されていなければ、recover1 の続行前に必要な KIB の情報を入力するように求められます。

この画面に表示できる上限を超える数のキーが存在する場合は、上限まで表示したうえで、残りのキー記述子を表示するかどうかを尋ねられます。これは、すべてのキーが表示されるまで続きます。その後、このファイルを回復するかどうかの確認が求められます。N を入力すると、プログラムが終了します。Y を入力すると、プログラムが続行されます。

                 Indexed File Recovery Utility
                   Recover1 for Visual COBOL
Indexed File: master.inx

This file has not been marked as needing recovery!

Disk Block Size:        1024   Minimum Record Length:  80
Disk Block Increment:   1024   Maximum Record Length:  80
Number of Index Blocks:  170   Number of Records:     150

  Key  Position Size Remarks
PRIME     1      8
    1     9      8 
    2     17     8   duplicates allowed

Is this the file you wish to recover (y/n)?

図 1:索引ファイルの回復ユーティリティ:ファイルの回復の確認

図 2 は、ファイル整合性スキャンで収集される情報の概要を示しています。

次に、回復プロセスを続行するかどうかを尋ねられます。N を入力すると、プログラムが終了します。Y を入力すると、プログラムが続行されます。「Average record length」は、ファイル内の全レコードの長さの合計をレコード数で割って計算されます。「Average data size」は、レコードがファイル内で実際に占めるサイズの合計をレコード数で割って計算されます。このサイズから、データをどの程度圧縮できるかを判断できます。

                Indexed File Recovery Utility
                  Recover1 for Visual COBOL
Indexed File: master.inx

Drop File: dropout1

This file has not been marked as needing recovery!

Disk Block Size:        1024 Minimum Record Length:  80
Disk Block Increment:   1024 Maximum Record Length:  80
Number of Index Blocks:  170 Number of Records:     150
Phase: Integrity Scan        Estimated Recoverable: 150

           |   Total |   Total |   First |   Last  |
Block Type | Found   | Corrupt | Corrupt | Corrupt |
KIB        |     1   |       0 |         |         |
Data       |   102   |       0 |         |         |
Node       |    61   |       0 |         |         |
Empty      |     6   |       0 |         |         |
Invalid    |     0   |       0 |         |         |
Unreadable |     0   |       0 |         |         |

Average data size: 14, Average record length: 80
Do you wish to proceed with recovery (y/n)?

図 2:索引ファイルの回復ユーティリティ:recover1 の概要

図 3 は、recover1 で主キーのノード ブロックをリビルドするときに表示される情報を示しています。

                Indexed File Recovery Utility
                  Recover1 for Visual COBOL
Indexed File: master.inx

Drop File: dropout1

This file has not been marked as needing recovery!
	
Disk Block Size:        1024 Minimum Record Length:  80
Disk Block Increment:   1024 Maximum Record Length:  80
Number of Index Blocks:  170 Number of Records:     150
Phase: Build Node Blocks     Estimated Recoverable: 150
 
Key being processed:                        PRIME
Records recovered:                            100
Records written to drop file:
Block being processed:                         13
Number of data blocks moved (for truncate):     5

図 3:索引ファイルの回復ユーティリティ:recover1 の統計

図 4 は、recover1 が正常に終了した後に表示される情報を示しています。切り捨てに関する 2 つの行は、T オプションが指定されている場合にのみ表示されます。

             Indexed File Recovery Utility
               Recover1 for Visual COBOL
Indexed File: master.inx 

Drop File: dropped

This file has not been marked as needing recovery!	 

Disk Block Size:        1024 Minimum Record Length: 126
Disk Block Increment:   1024 Maximum Record Length: 126	 
Number of Index Blocks:  120 Number of Records:     100
Phase: Build Node Blocks     Estimated Recoverable: 100

Key being processed:                        PRIME	 	 
Records recovered:                            100
Records written to drop file:
Block being processed:                        120
Truncate option specified - number of data blocks moved:   4
Truncate action successful - new Number of Index Blocks: 112

Recovery successful.

図 4:索引ファイルの回復ユーティリティ:recover1 が正常に終了

図 5 に示す例では、ファイルの KIB が破損しているため、ファイルを回復するにはキー情報を入力する必要があります。ここでは KIB の情報を手動で入力する例を示していますが、KIB の情報の回復にはテンプレート ファイル (-K オプションで指定) を使用することをお勧めします。ユーザーが入力した情報を下線で示してあります。

この回復セッションは次のコマンドで開始しています。

recover1 master.inx dropout1 -k
注: 値の重複を許可するキーやその数について誤った情報を入力すると、予期しない結果になることがあります。
             Indexed File Recovery Utility
                Recover1 for Visual COBOL
Indexed File: master.inx

Last error was 98,38 at 9:29 on 03-21-2008	
 
Are any of the keys in this file segmented (split) (y/n)? y
Key #: PRIME Segment #: 2 Starting Position? 10 Length? 5
             Another Segment (y/n)? n
             Total Key Length = 13 Duplicates Permitted (y/n)? n
Another Key (y/n)? n

図 5:索引ファイルの回復ユーティリティ:キー情報の入力

図 6 は、KIB の残りの情報を入力する例を示しています。ユーザーが入力した情報を下線で示してあります。

              Indexed File Recovery Utility
                 Recover1 for Visual COBOL
Indexed File: master.inx

Last error was 98,38 at 9:29 on 03-21-2008

Minimum Record Length (in bytes)? 80
Maximum Record Length (in bytes)? 80	 	 	 
Disk Block Size (in bytes)? 1024
User Block Size (1=none/2=in bytes/3=in records)? 1	 
Data Compression (y/n)? y    Space Character Value? 32   Zero Character Value? 48
Key Compression  (y/n)? y    Space Character Value? 32
File Version Number (0/2/3/4)? 4   Atomic I/O Enabled (y/n) y	 	 
File Lock Limit (in GB)? 2
Disk Block Increment (in bytes)?  1024	 
Allocation Increment (in blocks)? 8
Force Write Data Blocks (y/n)? n    Force Write Index Blocks (y/n)? n	 
Force to Disk (y/n)? n              Force File Closed (y/n)? n
Code Set (1=none/2=ASCII/3=EBCDIC)? 1
Collating Sequence (1=none/2=ASCII/3=EBCDIC)? 1	 
	 
Is this information correct (proceed with recovery) (y/n)? y

図 6:索引ファイルの回復ユーティリティ:KIB の情報の入力

キーと KIB の情報の入力が完了すると、回復プロセスが上記と同じように図 1 から順番に進んでいきます。コマンド ラインでテンプレート ファイルを指定した場合、またはプロンプトでテンプレート ファイル名を入力した場合は、キーと KIB の情報を要求する画面は表示されません。KIB が破損していて、列挙されたコード セットまたは列挙された照合順序のいずれかがファイルで使用されている場合は、テンプレート ファイルを指定する必要があります。