IBM Support

The upgrade database command returns SQL0220N when variable DB2_SQLROUTINE_PREPOPTS is set

Troubleshooting


Problem

When query compiler variable "DB2_SQLROUTINE_PREPOPTS" is set, after instance upgrade, the "upgrade database" command will failed with error SQL0220N, which complains the explain tables do not have the proper definition or are missing.

Symptom

(The following sample output is an upgrade from V9.7 fp6 to V10.5 fp3)

> db2 upgrade database sample
SQL0220N The Explain table "db2inst1.EXPLAIN_INSTANCE", column "25"
does not have the proper definition or is missing. LINE NUMBER=14.
SQLSTATE=55002


Even if you try to run "db2exmig" to migrate the explain tables, it will return error SQL5035N, because the database has not been successfully upgraded yet:

> db2exmig -d sample -e db2inst1
DB2 Universal Database Version 10.5, 5622-044 (c) Copyright IBM Corp. 1999, 2012
Licensed Material - Program Property of IBM
IBM DATABASE 2 Explain Table Migration Tool

Connecting to the Database.
Error in Connect to Database.

Error Message =
SQL5035N The database must be upgraded to the current release.
SQLSTATE=55001


SQLCA
Size = 136
SQLCODE = -5035
Tokens =
Function= SQLELOST
RC = 0x0000 = 0
Reason = 0x0000 = 0
Reason2 = 0x0000 = 0
Warning flags =

Press ENTER to Continue ...
Migration of the explain tables to Version 10.05.3 format has failed.

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Install\/Migrate\/Upgrade - Database","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"10.1;10.5;9.5;9.7;9.8","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
30 April 2025

UID

swg21683761