Hitachi

JP1 Version 12 JP1/Automatic Job Management System 3 Administration Guide


B.2 Backup and recovery when an unload log is used

If an error occurs, backup files and unload log files are used to restore the database.

Organization of this subsection

(1) How to create backup files

When an unload log is used, you can use the following two methods to create backup files:

The following table describes the advantages and disadvantages of each backup method.

Table B‒1: Advantages and disadvantages of each backup method

Backup method

Advantages

Disadvantages

Creating a backup file when the JP1/AJS3 service is not running

  • The scheduler database can be restored regardless of whether unload log files exist.

  • The scheduler database can be restored to the state existing at the time the backup file was created.

  • By using unload log files, you can also restore the updates made to the scheduler database after creation of the backup file.

JP1/AJS3 operation must be stopped before a backup file is created.

Creating backup files when the JP1/AJS3 service is running

Backup files can be created while JP1/AJS3 is running.

  • If the unload log files that were created after the creation of a backup file are lost, the scheduler database cannot be restored from the backup files created with this method.

  • The scheduler database cannot be restored to the state existing at the time a backup file was created.

(2) When backup files are created

If an error occurs in the JP1/AJS3 environment, you must synchronize the JP1/AJS3 environment and the scheduler database environment during the restore processing. If you are able to stop JP1/AJS3 operation to do this, in addition to the JP1/AJS3 backup file that is created, execute the ajsembdbbackup command without the -s option to create a backup file of the scheduler database. When JP1/AJS3 is running, periodically execute the ajsembdbbackup command with the -s option specified to create a backup file of the scheduler database.

A backup file must be created before the disk that contains the directory where unload log files are created becomes full. When this disk is full, an attempt to create a backup file fails. Free space for at least one unload log file is required for a backup file to be created.

Note that no problem occurs if a backup file is created earlier than the time described above.

After a backup file has been created, you can delete the unload log files created before the backup file was created and the previously created backup files. For details about how to delete unload log files and backup files, see (3) Managing backup files and unload log files.

The following figure shows the timing for creating backup files.

Figure B‒2: Timing for creating backup files (when an unload log used)

[Figure]

(3) Managing backup files and unload log files

You need to save and manage the backup files and unload log files because you will need them to restore the database.

The following describes how to manage both types of files.

(a) Unload log files

As JP1/AJS3 operation continues, the number of unload log files created continues to grow, risking a shortage of free space on the disk containing the directory where unload log files are created. The following describes how to prevent this problem.

  • Delete old unload log files

    Because restoration of the scheduler database uses unload log files created after the backup file was created, unload log files created before the backup file was created are no longer required. You must create a backup file before the disk containing the directory where unload log files are created becomes full, and then use any method to delete the unload log files created before the backup file was created. To decide which unload log files to delete, compare the time the ajsembdbbackup command was executed and the time each unload log file was created, and delete the unload log files that were created before the command was executed.

  • Move unload log files to another disk

    Use any method to move unload log files to another disk to increase the amount of free space on the disk that contains the directory where unload log files are created. When you move the unload log files, do not move the directory where unload log files are created.

    Note that the problem with this method is that restoration using the ajsembdbrstr command takes a long time because many unload log files are used. Therefore, use this method as a temporary solution when, for example, a backup file cannot be created quickly.

(b) Backup files

If unload log files can no longer be used, the database cannot be restored from a backup file created while the JP1/AJS3 service was running. You must also save the backup file that was created when the JP1/AJS3 service was inactive.

(4) Procedure for creating backup files

The following describes how to create a backup file for each of the backup methods.

(a) Creating a backup file when the JP1/AJS3 services are not running

To create a backup file when the JP1/AJS3 services are not running:

  1. Stop the scheduler service that uses the target scheduler database, and stop all JP1/AJS3 services that access the scheduler database.

  2. Start the embedded database.

    • In Windows

      Confirm that the target JP1/AJS3 Database _JFn service (where n is a value from 0 to 9, or A to Z) is running. If the target service is not running, start it. Next, execute the ajsembdbstatus command with the -s ust -id _JFn option (where n is a value from 0 to 9, or A to Z) specified and confirm that the embedded database is running (that is, UNIT-STAT indicates ONLINE). If the embedded database is not running, execute the ajsembdbstart command with the -id _JFn option specified.

    • In UNIX

      Execute the ajsembdbstart command with the -id _JFn option (where n is a value from 0 to 9, or A to Z) specified. Then execute the ajsembdbstatus command with the -s ust -id _JFn option (where n is a value from 0 to 9, or A to Z) specified and confirm that the embedded database is running (that is, UNIT-STAT indicates ONLINE).

  3. Execute the ajsembdbbackup command to create a backup file.

    Do not specify the -s option in the ajsembdbbackup command.

  4. Execute the ajsembdbstop command to stop the embedded database.

  5. Start the services you stopped in step 1.

For details about the ajsembdbbackup command, see ajsembdbbackup in 3. Commands Used for Normal Operations in the manual JP1/Automatic Job Management System 3 Command Reference.

Note that if you attempt to create a backup file while the scheduler service is running or the scheduler database is being referenced or updated, the ajsembdbbackup command might result in an error.

(b) Creating a backup file when the JP1/AJS3 services are running

Execute the ajsembdbbackup command with the -s option specified.

You can use this backup method while JP1/AJS3 is running. However, because the ajsembdbbackup command and jobs are executed at the same time, there will be some degradation in performance of the command and the jobs. When you execute the command, make sure that as few jobs as possible are being executed.

For details about the ajsembdbbackup command, see ajsembdbbackup in 3. Commands Used for Normal Operations in the manual JP1/Automatic Job Management System 3 Command Reference.

(5) Procedures for restoring the database if an error occurs

The following describes the procedures for restoring the database by type of error.

For details about the ajsembdboplog, ajsembdbbackup, and ajsembdbrstr commands used to restore the database, see 3. Commands Used for Normal Operations in the manual JP1/Automatic Job Management System 3 Command Reference. For details about the ajsembdbbuild, ajsembdbsetup, and ajsembdbunset commands, see 2. Commands Used during Setup in the manual JP1/Automatic Job Management System 3 Command Reference.

(a) Procedure when a disk error occurred in the data area

The following describes the procedure for restoring the database when a disk error has occurred in the data area.

When you restore the database in a cluster environment, perform the procedure below in an environment in which the primary node has been set up. Do not perform the procedure on the secondary node.

To restore the database:

  1. Create an unload log file.

    To restore the database to the state existing before the error occurred, you must create an unload log file from the system log file containing the last updates made to the database before the error occurred.

    You can create the unload log file by executing the ajsembdboplog command.

    The following shows an example of specifying the ajsembdboplog command:

    ajsembdboplog -f -g log4#1 -o /unloadlog/unloadlog_file#2

    Before you execute the ajsembdboplog command to create an unload log file, back up all unload log files that have been created in the unload log file directory since the backup file used to restore the database was created.

    #1

    To determine the value to be specified in the -g option, execute the ajsembdbstatus command with the -l option specified.

    If the embedded database is running, specify a system log group for which the second character (from the left) in the Status column is c. If the embedded database is not running, specify a system log group for which the sixth character (from the left) in the Status column is c. If the second character is n and the sixth character is a hyphen (-) in the Status column for all system log groups, back up the unload log files that have been output, but do not execute the ajsembdboplog command.

    The following shows an example of executing the ajsembdbstatus command when the _JF0 embedded database is running.

    [Figure]

    In the Status column (underlined part), find the item whose second character is c. In the above example, this item is on line log4 under the Group column. Thus, the value you need to specify in the -g option is log4.

    #2

    This example assumes that the output destination file name (unload log file name) is /unloadlog/unloadlog_file.

    Note that this step is unnecessary if you want to restore the database to the state existing at the time the backup file was created.

  2. On the physical host and all logical hosts, stop all JP1/AJS3 services that access the scheduler database.

  3. Execute the ajsembdbunset command to delete the database environment.

    Specify the -e option in the ajsembdbunset command.

  4. Correct the error.

  5. Execute the ajsembdbbuild command to re-create the database environment.

    When executing the ajsembdbbuild command, make sure that you specify the same information in it that was specified to create the database environment before the error occurred. If the specified information is different, an error occurs during the restore processing for the scheduler database and the database cannot be restored.

  6. Execute the ajsembdbsetup command to set up the scheduler database.

    When executing the ajsembdbsetup command, make sure that you specify the same information in it that was specified for migration to the embedded database before the error occurred. If the specified information is different, an error occurs during the restore processing for the scheduler database and the database cannot be restored.

  7. Execute the ajsembdbstop command to stop the embedded database.

  8. Execute the ajsembdbstart command with the -r option specified to start the embedded database in the mode for restoring system areas.

  9. Execute the ajsembdbrstr command with the -M option specified to restore the embedded database system area.

  10. Execute the ajsembdbstop command to stop the embedded database.

  11. Execute the ajsembdbstart command to start the embedded database.

  12. Execute the ajsembdbrstr command to restore the scheduler database.

    To restore the database to the state existing before the error occurred, use the -l or -ld option of the ajsembdbrstr command to specify either the unload log files you backed up in step 1 or the directory containing these files.

    Do not specify any unload log file that was created after the database environment was re-created.

    Note that if you want to restore the database to the state existing at the time the backup file was created while the JP1/AJS3 service was not running, you do not need to specify the -ld or -l option.

  13. Execute the ajsembdbbackup command.

    Execute the ajsembdbbackup command to create the backup file.

  14. Execute the ajsembdbstop command to stop the embedded database.

  15. Start the services you stopped in step 2.

(b) Procedure when a disk error occurred in the system log file for the database

You need to re-create the database as described in (a) Procedure when a disk error occurred in the data area.

In the procedure in (a) Procedure when a disk error occurred in the data area, step 1 can be performed only if system log files are duplicated.

(c) Procedure when errors occurred simultaneously in JP1/AJS3 and the database

Below is the procedure for restoring the database when simultaneous errors have occurred in JP1/AJS3 and the database.

When you restore the database in a cluster environment, perform the procedure below in an environment in which the primary node has been set up. Do not perform the procedure on the secondary node.

To restore the database:

  1. Correct the errors.

  2. Recover JP1/AJS3 from the backup file.

    For details about how to recover JP1/AJS3, see 2. Backup and Recovery.

  3. Stop the scheduler service that uses the target scheduler database, and stop all JP1/AJS3 services that access the scheduler database.

  4. Start the embedded database.

    • In Windows

      Confirm that the target JP1/AJS3 Database _JFn service (where n is a value from 0 to 9, or A to Z) is running. If the target service is not running, start it. Next, execute the ajsembdbstatus command with the -s ust -id _JFn option (where n is a value from 0 to 9, or A to Z) specified and confirm that the embedded database is running (that is, UNIT-STAT indicates ONLINE). If the embedded database is not running, execute the ajsembdbstart command with the -id _JFn option specified.

    • In UNIX

      Execute the ajsembdbstart command with the -id _JFn option (where n is a value from 0 to 9, or A to Z) specified. Then execute the ajsembdbstatus command with the -s ust -id _JFn option (where n is a value from 0 to 9, or A to Z) specified and confirm that the embedded database is running (that is, UNIT-STAT indicates ONLINE).

  5. Execute the ajsembdbstop command to stop the embedded database.

  6. Execute the ajsembdbstart command with the -r option specified to start the embedded database in the mode for restoring system areas.

  7. Execute the ajsembdbrstr command with the -M option specified to restore the embedded database system area.

  8. Execute the ajsembdbstop command to stop the embedded database.

  9. Execute the ajsembdbstart command to start the embedded database.

  10. Execute the ajsembdbrstr command to restore the scheduler database.

    In this case, you need the backup file created when the JP1/AJS3 service was stopped.

    Do not specify the -ld or -l option in the ajsembdbrstr command.

  11. Execute the ajsembdbstop command to stop the embedded database.

  12. Start the services you stopped in step 3.

    If necessary, cold-start the JP1/AJS3 services.

When this procedure has been completed, you can restore the database to the state existing at the time the backup file was created in synchronization with JP1/AJS3.

(d) Procedure when a disk error occurred in JP1/AJS3

Use the procedure in (c) Procedure when errors occurred simultaneously in JP1/AJS3 and the database to restore the database.