Nonstop Database, HiRDB Version 9 System Operation Guide

[Contents][Index][Back][Next]

3.11.3 Rearranging the unload log files (creating a time-ordered list)

Create a time-ordered list in which to rearrange the unload log files, from the file recorded in 3.11.1 Acquiring information on the first unload log file to be specified (during backup acquisition) to the file created in 3.11.2 Acquiring information on the last unload log file to be specified (during database recovery). During database restoration, refer to this list and specify the unload log files in order of time in the -l option of the pdrstr command.

Organization of this subsection
(1) When the automatic log unloading facility is used
(2) When the automatic log unloading facility is not used
(3) Notes
(4) Operation example 1
(5) Operation example 2
(6) Deleting unnecessary unload log files

(1) When the automatic log unloading facility is used

The procedure for rearranging the unload log files when the automatic log unloading facility is used is as follows.

Procedure
  1. Execute the pdlogatul -d sys -i command to confirm that the automatic log unloading facility is running. In the case of a HiRDB parallel server configuration, confirm this on all recovery-target servers. If the facility is not running, execute the pdlogatul -b command to restart the automatic log unloading facility.
  2. Execute the pdlogls -d sys command to check the status of the system log files. If any system log file is waiting to be unloaded, wait until there is no system log file waiting to be unloaded.
  3. Check the server name, server run ID, log file group name, and generation number recorded in 3.11.1 Acquiring information on the first unload log file to be specified (during backup acquisition).
  4. For each recovery-target HiRDB server, create an ascending time-ordered list of unload log files.
    Since the unload log file name is determined according to the following format, the unload log files in the directory for unload log files are arranged in order of time:
    server-name_server-run-ID-and-generation-number#_file-group-name
    #
    The generation number consists of the lowest 4 digits only. If the number of digits is fewer than 4, the left side is zero-filled to make the generation number 4 digits long.
    The following figure shows how to create a time-ordered list of unload log files.

    Figure 3-12 Creating a time-ordered list of unload log files

    [Figure]

    Explanation
    Add the file list in the directory for unload log files as is to the time-ordered list of unload log files. If there are two or more directories for unload log files, compare the file names and rearrange them in order of time.
    Note
    In the time-ordered list created in step 4, if the generation numbers begin with 0000 and end with ffff, the unload log files are not lined up in order of time. In such a case, move the files that have the same server run ID and generation number sequence numbers beginning at 0000 below the file that has the same server run ID and a generation number of ffff. An example follows in which the unload log files are not arranged in order of time.

    File list in the directory for unload log files
     
    bes1_3a765d820000_logfg04    [Figure] 0000 is found
    bes1_3a765d820001_logfg01
    bes1_3a765d820002_logfg02
    bes1_3a765d82fffe_logfg02
    bes1_3a765d82ffff_logfg03
     
    In this case, the order in which to create the unload log files is as follows. Create a time-ordered list of unload log files in this order:
    1. bes1_3a765d82fffe_logfg02
    2. bes1_3a765d82ffff_logfg03
    3. bes1_3a765d820000_logfg04
    4. bes1_3a765d820001_logfg01
    5. bes1_3a765d820002_logfg02
  5. From the ascending time-ordered list, extract an ascending list that begins with the unload log file confirmed in step 3. The ascending list extracted here shows the order in which to specify the unload log files during database recovery.

(2) When the automatic log unloading facility is not used

The procedure for rearranging the unload log files when the automatic log unloading facility is not used is as follows.

Procedure
  1. Check whether there is any system log file waiting to be unloaded. If there is one, unload it using the pdlogunld command.
  2. Check the server name, server run ID, log file group name, and generation number recorded in 3.11.1 Acquiring information on the first unload log file to be specified (during backup acquisition).
  3. Execute the pdlogucat command for all unload log files, and check the server name, server run ID, log file group name, and generation number of each unload log file.
  4. Using the server name, server run ID, log file group name, and generation number checked in step 3 as keys, rearrange the unload log files in ascending order, creating a time-ordered list.
  5. From the ascending time-ordered list created in step 4, extract an ascending list that begins with the unload log file confirmed in step 2. The ascending list extracted here shows the order in which to specify the unload log files during database recovery.

(3) Notes

Make sure there are no missing unload log files in the time-ordered list of unload log files. If unload log files have the same server run ID, their generation number is incremented by 1. If unload log files have the same generation numbers, they have different file group names.

If these rules do not hold, there might be missing unload log files. If an unload log file in question is not found, you must unload the system log files again. If the system log file has already been overwritten and unload log files cannot be created, the database cannot be restored to the most recent synchronization point. In this case, the database can be restored only to a backup acquisition point.

(4) Operation example 1

In this example, the back-end server (bes1) is restored while HiRDB is running and while the automatic log unloading facility is being used. Note that the procedure in 3.11.2 Acquiring information on the last unload log file to be specified (during database recovery) is also explained here.

  1. Execute the pdlogswap -d sys command to swap the current system log file.
     
    pdlogswap -d sys -s bes1 -w
     
  2. Execute the pdlogatul -d sys -i command to confirm that the automatic log unloading facility is running.
     
    pdlogatul -d sys -s bes1 -i
     
    HOSTNAME : dbhost1(101653)
    SERVER_NAME:bes1
    AUTO_LOG_UNLOAD  NOW_UNLOAD_LOG_GROUP  CREATE_DIR
             ACTIVE               logfg05  /unload_dir2
    CURRENT LOG GENERATION INFO.
    LOG_GROUP  GEN_NO.  USER_RUN_ID RUN_ID   UNLOAD_FILE_NAME
    logfg01           7 3a7a60ae    3a7a6090 bes1_3a7a60ae0007_logfg01
     
    ACTIVE displayed under AUTO_LOG_UNLOAD confirms that the automatic log unloading facility is running.
  3. Execute the pdlogls -d sys command to check the status of the system log files.
     
    pdlogls -d sys -s bes1
     
    HOSTNAME : dbhost1(101724)
    Group    Type Server   Gen No.  Status  Run ID    Block No.         Ex-Status
    logfg01  sys  bes1            7 oc-d--u 3a7a0690      43f      43f  --------
    logfg02  sys  bes1            2 os----u 3a7a0690       cb      194  --------
    logfg03  sys  bes1            3 os----u 3a7a0690      195      25e  --------
    logfg04  sys  bes1            4 os----u 3a7a0690      25f      328  --------
    logfg05  sys  bes1            5 osu-b-u 3a7a0690      329      3f2  --------
    logfg06  sys  bes1            6 osu---u 3a7a0690      3f3      43e  --------
     
    The above result indicates that logfg05 and logfg06 are waiting to be unloaded, and logfg05 is being unloaded. After waiting for some time, re-execute the pdlogls -d sys command.
     
    pdlogls -d sys -s bes1
     
    HOSTNAME : dbhost1(103519)
    Group    Type Server   Gen No.  Status  Run ID    Block No.         Ex-Status
    logfg01  sys  bes1            7 oc-d--u 3a7a0690      43f      43f  --------
    logfg02  sys  bes1            2 os----u 3a7a0690       cb      194  --------
    logfg03  sys  bes1            3 os----u 3a7a0690      195      25e  --------
    logfg04  sys  bes1            4 os----u 3a7a0690      25f      328  --------
    logfg05  sys  bes1            5 os----u 3a7a0690      329      3f2  --------
    logfg06  sys  bes1            6 os----u 3a7a0690      3f3      43e  --------
     
    The above result confirms that the creation of unload log files has been completed.
  4. From the information on the first unload log file to be specified that was acquired during backup, check the server name, server run ID, log file group name, and generation number. In this example, the information contains the following:
    • Server name: bes1
    • File group name: logfg05
    • Server run ID: 3a765d82
    • Generation number: 17
    From this information, the unload log file to be specified first is bes1_3a765d820017_logfg05.
  5. Create an ascending time-ordered list.
    First, create a file list in the directory for unload log files. Here, it is assumed that there are two directories for unload log files.

    [Figure]

    Since the first unload log file to be specified is bes1_3a765d820017_logfg05, delete the file names with generation numbers that are older than bes1_3a765d820017_logfg05 from the file list in directory for unload log files 1 containing bes1_3a765d820017_logfg05.

    [Figure]

    Rearrange the file lists in the two directories for unload log files in ascending order, and then create a single time-ordered list.

    [Figure]

  6. Specify the unload log files in the order of the time-ordered list created in step 5, and execute the pdrstr command.
     
    pdrstr -m /rdarea/mast_rdarea/mast_rdarea01 -s bes1 -b /pdcopy/backup/bes1bkup01
    -l /unload_dir1/bes1_3a765d820017_logfg05,/unload_dir1/bes1_3a765d820018_logfg06,
    /unload_dir1/bes1_3a765d820019_logfg01,/unload_dir2/bes1_3a7a06ae0001_logfg01,
    /unload_dir2/bes1_3a7a06ae0002_logfg02,/unload_dir2/bes1_3a7a06ae0003_logfg03,
    /unload_dir2/bes1_3a7a06ae0004_logfg04,/unload_dir2/bes1_3a7a06ae0005_logfg05,
    /unload_dir2/bes1_3a7a06ae0006_logfg06
     
    Explanation
    -m: Specifies the name of the first HiRDB file in the master directory RDAREA.
    -s: Specifies the server bes1 to be restored.
    -b: Specifies the backup file to be used for restoration.
    -l: Specifies the unload log files to be used for recovery in order of time.

(5) Operation example 2

In this example, after an error occurs in the master RDAREA, the pdstart -r command is used to start HiRDB and restore the dictionary server (dic) when the automatic log unloading facility is being used.

  1. Before executing the pdstart -r command to start HiRDB, execute the pdlogls -d sys command to check the current system log file.
     
    pdlogls -d sys -s dic
     
    HOSTNAME : dbhost1(103519)
    ***** Off-line Information *****
    Group    Type Server   Gen No.  Status  Run ID    Block No.         Ex-Status
    logfg01  sys  dic             1 cn----u 3a7a6090        1        b  --------
    logfg02  sys  dic             2 cn----u 3a7a6090        c       18  --------
    logfg03  sys  dic             3 cn----u 3a7a6090       19       24  --------
    logfg04  sys  dic             4 cn---cu 3a7a6090       25       2c  --------
    logfg05  sys  dic            11 cn----u 3a765d82      122      130  --------
     
    The above result confirms that all files, except logfg04, are finished unloading.
  2. If HiRDB has not been restarted, files cannot be unloaded using the automatic log unloading facility. Therefore, execute the pdlogunld -d sys command with the -f option specified, and manually unload logfg04.
     
    pdlogunld -d sys -s dic -g logfg04 -o /unload_dir2/dic_unload_logfg04 -f
     
  3. Execute the pdstart -r command to start HiRDB.
     
    pdstart -r
     
  4. From the information on the first unload log file to be specified that was acquired during backup, check the server name, server run ID, log file group name, and generation number. In this example, the information contains the following:
    • Server name: dic
    • File group name: logfg01
    • Server run ID: 3a7a60ae
    • Generation number: 1
    From this information, the unload log file to be specified first is dic_3a7a60ae0001_logfg01.
  5. Create a time-ordered list and rearrange the files in ascending order.
    First, create a file list in the directory for unload log files. Here, it is assumed that there are two directories for unload log files.

    [Figure]

    A comparison of the first files in the file lists of the two directories for unload log files shows that the file in directory for unload log files 1 is older than the file in directory for unload log files 2. Therefore, only the files in directory for unload log files 2 are used.
    Also add the file that was manually unloaded in step 2 to the end of the list, creating a time-ordered list.

    [Figure]

  6. Specify the unload log files in the order of the time-ordered list created in step 5, and execute the pdrstr command.
     
    pdrstr -m /rdarea/mast_rdarea/mast_rdarea01 -r RDMASTER -b /pdcopy/backup/dicbkup01
    -l /unload_dir2/dic_3a7a06ae0001_logfg01,/unload_dir2/dic_3a7a06ae0002_logfg02,
    /unload_dir2/dic_3a7a06ae0003_logfg03,/unload_dir2/dic_unload_logfg04
     
    Explanation
    -m: Specifies the name of the first HiRDB file in the master directory RDAREA.
    -r: Specifies the name of the master RDAREA.
    -b: Specifies the backup file to be used for restoration.
    -l: Specifies the unload log files to be used for recovery in order of time.

(6) Deleting unnecessary unload log files

A time-ordered list can also be used for identifying unnecessary unload log files. Create a descending time-ordered list. Files older than the unload log file to be specified first are unnecessary unload log files. An example of a time-ordered list follows:

[Figure]

Explanation
In this example, since the unload log file to be specified first is bes1_3a765d820017_logfg05, unload log files bes1_3a765d820016_logfg04, bes1_3a765d820015_logfg03, and bes1_3a765d820014_logfg02 are unnecessary.