DB2 Version 9.7 for Linux, UNIX, and Windows

db2cklog - Check archive log files command

You use the db2cklog command to check the validity of archive log files in order to determine whether or not the log files can be used during rollforward recovery of a database or table space. Either a single archive log file or a range of archive log files can be checked.

Archive log files that pass validation by the db2cklog command without any DBT error messages or warnings can be used during a rollforward recovery operation. If an archive log file fails validation with an error message or if a warning is returned, then you must not use that log file during rollforward recovery. A log file that returns an error during validation by the db2cklog command will cause the recovery operation to fail. If the validation of a log file returns a warning, then that log file might be invalid, unless the log file is still active. Only log files that are closed, such as archive log files, can be validated successfully.

Authorization

Anyone can run the command, but you must have read permission on the archive log files.

Required connection

None

Command syntax

Read syntax diagramSkip visual syntax diagram
             .-CHECK-.                                               
>>-DB2CKLOG--+-------+--log-file-number1--+----------------------+-->
                                          '-TO--log-file-number2-'   

>--+-------------------------------+---------------------------><
   '-ARCHLOGPATH--archive-log-path-'   

Command parameters

CHECK
Validates the archive log file or the range of archive log files by performing checks on the internal validity of the files. This is the default action.
log-file-number1
Specifies the numerical identifier of the log file to validate. For example, the numerical identifier of the S0000001.LOG log file is 1. If the TO log-file-number2 parameter is also specified, then log-file-number1 represents the first numerical identifier in a range of log files to check.
TO log-file-number2
Specifies that a range of numbered log files is to be validated (ranging from log-file-number1 to log-file-number2). If log-file-number2 is numbered lower than log-file-number1, then only log-file-number1 is checked.
ARCHLOGPATH archive-log-path
Specifies a relative or an absolute path where the archive log files are stored. The default path is the current directory.

Example

The following example shows the successful validation of the archive log file S0000003.LOG in the path tests (output is abridged). This file can be used during rollforward recovery.

$ db2cklog CHECK 3 ARCHLOGPATH tests

      ____________________________________________________________________

                      _____     D B 2 C K L O G     _____

                            DB2 Check Log File tool

...

"db2cklog": Finished processing log file "S0000003.LOG". Return code: "0".

The following example shows the successful validation of a range of archive log files (S0000003.LOG to S0000005.LOG; output is abridged). Successful validation of each file is indicated in the output. These files can be used during rollforward recovery.

$ db2cklog 3 TO 5

      ____________________________________________________________________

                      _____     D B 2 C K L O G     _____

                            DB2 Check Log File tool

...

"db2cklog": Finished processing log file "S0000003.LOG". Return code: "0".

...

"db2cklog": Finished processing log file "S0000004.LOG". Return code: "0".

...

"db2cklog": Finished processing log file "S0000005.LOG". Return code: "0".

The following example shows how the first log file in a range of archive log files returns an error and fails validation (output is abridged). Once an error is encountered, a DBT error message is returned, and the db2cklog command exits without processing further log files. This log file should not be used for rollforward recovery, because it will cause the recovery operation to fail.

$ db2cklog 0 TO 1 

      ____________________________________________________________________

                      _____     D B 2 C K L O G     _____

                            DB2 Check Log File tool

...

 DBT7053E  Log file validation failed because the specified log file contains an invalid log page followed by another invalid log page.

 DBT7048E  The db2cklog utility determined that the current log file is invalid.

"db2cklog": Finished processing log file "S0000000.LOG". Return code: "-2000".