Technical Blog Post
Abstract
Upgrade database failed with SQL1704N Database upgrade failed. Reason code "2"
Body
It is important to check database is eligible to be upgraded BEFORE actually issuing upgrade database command:
db2ckupgrade YourDB -l /tmp/db2ckupgrade.log
If you find any errors returned by the above command, fix the errors found until db2ckupgrade reports you can upgrade database.
If you have already issued upgrade database command and errors are returned in the process of database upgrade,
chances are database files such as database configuration file, history file, or log control files(LFHs) are already modified.
You may need to restore the database in the previous version and correct the error before you can upgrade database.
The following is a case that upgrade database failed with error SQL1704N(Reason Code "2"):
$ db2 upgrade database YourDB
SQL1704N Database upgrade failed. Reason code "2".
Diagnostic log file "db2diag.log" reports detailed reason for the failure. The following is an example:
<timestamp> LEVEL: Error
PID : 12345 TID : 1234 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : DBNAME
APPHDL : 0-7 APPID: *LOCAL.db2inst1.xxxx
AUTHID : DB2INST1 HOSTNAME: host1
EDUID : 1234 EDUNAME: db2agent (DBNAME) 0
FUNCTION: DB2 UDB, data protection services, sqlpgint, probe:1830
MESSAGE : ZRC=0x80100075=-2146434955=SQLP_RECOVERY
"The database requires crash recovery."
DIA8128C Database recovery error.
The above message shows database was not consistent and needs Crash Recovery before it can be upgraded.
To resolve the problem, restore the database in the previous version and restart the database to finish
Crash Recovery, then proceed to check whether database can be upgraded before upgrading the
database again.
UID
ibm13285921