UPGRADE DATABASE command

The UPGRADE DATABASE command converts a Db2® database of the previous version to the formats corresponding to the release run by the instance.

The db2ckupgrade command must be issued before upgrading the instance to verify that your databases are ready for upgrade. The db2iupgrade command implicitly calls the db2ckupgrade. Backup all databases before upgrading, and before the installation of the current version of Db2 database product on Windows operating systems.

For Db2 Version 10.5 Fix Pack 7 or later HADR databases, the db2iupgrade command calls the db2ckupgrade command to verify that the primary's log shipping position matches the standby's log replay position. The UPGRADE DATABASE command also validates the log positions on start up and fails if they do not match.

Authorization

SYSADM

Required connection

This command establishes a database connection.

Command syntax

Read syntax diagramSkip visual syntax diagramUPGRADEDATABASEDBdatabase-aliasUSERusernameUSINGpasswordREBINDALL

Command parameters

DATABASE database-alias
Specifies the alias of the database to be upgraded to the currently installed version of the database manager.
USER username
Identifies the user name under which the database is to be upgraded.
USING password
The password used to authenticate the user name. If the password is omitted, but a user name was specified, the user is prompted to enter it.
REBINDALL
Specifies that a REBIND of all packages is performed during upgrade. Performing the REBINDs automatically during the upgrade ensures that the step is not missed and will help ensure that other applications are not started before the REBINDs are complete.

Examples

The following example upgrades the database cataloged under the database alias sales:
db2 UPGRADE DATABASE sales

Usage notes

This command will only upgrade a database to a newer version, and cannot be used to convert an upgraded database to its previous version.

The database must be cataloged before upgrade.

If you enable Health Monitor while running the UPGRADE DATABASE command, it may try to connect during the upgrade, resulting in the SQL1035N message. To avoid this problem, disable Health Monitor before you run the command.

If an error occurs during upgrade, it might be necessary to issue the TERMINATE command before attempting the suggested user response. For example, if a log full error occurs during upgrade (SQL1704: Database upgrade failed. Reason code "3".), it will be necessary to issue the TERMINATE command before increasing the values of the database configuration parameters logprimary and logfilsiz. The CLP must refresh its database directory cache if the upgrade failure occurs after the database has already been relocated (which is likely to be the case when a "log full" error returns).

For Db2 Version 10.5 Fix Pack 7 or later HADR databases, see Upgrading DB2® High Availability Disaster Recovery (HADR) environments for details.

If users want to create incremental backups of the upgraded database, a full database backup is required following the database upgrade. This serves as the new starting point for the incremental backups.