db2cklog - Check archive log file validity command
Authorization
Anyone can run the command, but you must have read permission on the archive log files.
Required connection
None
Command syntax
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 numeric identifier of the log file to validate. For example, the numeric 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 numeric 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.
- KSPASSWORD keystore-password
- Specifies the password to use when opening the keystore.
- KSPASSARG fd:file_descriptor | filename:filepath
- Specifies the keystore password arguments. The file_descriptor parameter specifies a file descriptor that identifies an open and readable file or pipe that contains the password to use. The filepath parameter specifies the path of the file that contains the password to use.
- KSPROMPT
- Specifies that the user is to be prompted for a password.
Examples
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".
The following example shows how validating an encrypted log file without a keystore password 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. Use one of the keystore password options to specify the password and retry validation.
$ db2cklog 0 TO 1
____________________________________________________________________
_____ D B 2 C K L O G _____
Db2 Check Log File tool
...
DBT7079E The db2cklog command failed because of an internal error.
Failed to get cipher ticket from header dek for log file "S0000000.LOG"!
Reason code: -2141452064, sqlcode: -1728.
The following example shows the successful validation of encrypted log file (S0000000.LOG; output is abridged) with the KSPASSWORD option. The keystore password is Str0ngPassw0rd. Successful validation is indicated in the output. This file can be used during rollforward recovery.
$ db2cklog 0 KSPASSWORD Str0ngPassw0rd
____________________________________________________________________
_____ D B 2 C K L O G _____
Db2 Check Log File tool
...
"db2cklog": Finished processing log file "S0000000.LOG". Return code: "0".
Usage notes
The db2cklog utility can be used to determine what Db2® version a recovery log file is from. If the recovery log file is not from the current version then a DBT warning message will be returned.