Install DB2 Express-C 10.5 on Ubuntu Trusty 64 bit/(Upgrading from DB2 9.7 32 bit)

DB2 Express-C is a fully functional and very powerful database offering from IBM, that can be used for free. Currently it’s limited to two cores and 4GB RAM, that’s enough to be used in small-medium applications.

DB2 plays well with LXC, and I had no problem using it for years in a hosted server environment.

It’s been a while since my last post in this subject.  I’ve been running DB2 9.7 in a Debian based LXC container without a glitch for about 5 years. After a distribution upgrade of the Ubuntu host, the 9.7 gave up and I was left with the dilemma of either staying on an old and insecure core distribution, or upgrading the entire stack.

Installing the DB2 Express-C 10.5 is a breeze when compared to previous versions. A couple of simple commands and you’re done. Upgrading from a previous version is almost as simple. Still it does take some preparation, and I advise anyone trying to do it to exercise caution.

Preparation

In this article I assume you already have a single database instance you want to upgrade. The database is installed using the standard locations and users.

My host installation is done in a fresh amd64  LXC install from the Ubuntu template. The DB I’m upgrading from has been copied from it’s original 32bit container to the corresponding locations (/opt/ibm/db2, /home/dbsinst1, /home/dasusr1) in the fresh host. The users, groups, services are added to the corresponding /etc files, the /opt/ibm/db2 folders and the /var/lib/db2 folders are copied.

Before copying make sure the original container is shut down properly!

Installation

Download the installer for your architecture from IBM. Extract the files to /opt/ibm/db2 folder in your target machine.

Add prerequisites for the latest version that DB2 installer complains about.

./db2prereqcheck -l
Requirement not matched for DB2 database "Server" . Version: "10.5.0.4". 
Summary of prerequisites that are not met on the current system: 
 DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/i386-linux-gnu/libpam.so*". 

DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6". 

Requirement not matched for DB2 database "Server" with pureScale feature. Version: "10.5.0.4". 
Summary of prerequisites that are not met on the current system: 
 DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/i386-linux-gnu/libpam.so*". 

DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".

Start adding the missing requirements.  DB2 still requires 32 bit libs for running.

apt-get install binutils libaio1
dpkg --add-architecture i386
apt-get update
apt-get install libpam0g:i386 libstdc++6:i386

Start DB2 installation.

./db2_install
DBI1324W Support of the db2_install command is deprecated. For more information, see the DB2 Information Center.

Default directory for installation of products - /opt/ibm/db2/V10.5

***********************************************************
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no] 
yes

DB2 installation is being initialized.

Total number of tasks to be performed: 36 

Total estimated time for all tasks to be performed: 1370 second(s) 
...
<SNIP>
...
Task #38 start
Description: Updating global profile registry 
Estimated time 3 second(s) 
Task #38 end 

The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/db2_install.log.14621".

You can now remove the installation folder if you want to.

Migration

Add the libs to run 32 bit DB2 9.7

apt-get install libaio1:i386

Check to see if the upgrade can be completed on the databases

# su - db2inst1
$ db2start
$ /opt/ibm/db2/expc/db2ckupgrade -e -l /tmp/upgrade_v10.5.log
DBT5508I  The db2ckupgrade utility completed successfully. The database or databases can be upgraded.
$ cat /tmp/upgrade_v10.5.log
Version of DB2CKUPGRADE being run: VERSION "10.5"

Database: "MYDB"

DBT5537I  The db2ckupgrade utility has completed processing for database "MYDB".

DBT5508I  The db2ckupgrade utility completed successfully. The database or databases can be upgraded.
$ db2 force application all
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.
$ db2 terminate
DB20000I The TERMINATE command completed successfully.
$ db2stop
SQL1064N DB2STOP processing was successful.
$ exit
#

Upgrade databases see the infocenter

# /opt/ibm/db2/V10.5/instance/db2iupgrade -u db2fenc1 db2inst1
DBI1446I The db2iupgrade command is running.


DB2 installation is being initialized.

 Total number of tasks to be performed: 4 
Total estimated time for all tasks to be performed: 309 second(s) 

Task #1 start
Description: Setting default global profile registry variables 
Estimated time 1 second(s) 
Task #1 end 

Task #2 start
Description: Initializing instance list 
Estimated time 5 second(s) 
Task #2 end 

Task #3 start
Description: Configuring DB2 instances 
Estimated time 300 second(s) 
Task #3 end 

Task #4 start
Description: Updating global profile registry 
Estimated time 3 second(s) 
Task #4 end 

The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/db2iupgrade.log.7476".
DBI1070I Program db2iupgrade completed successfully.

That was easy, now we can start the database up and upgrade it.

su - db2inst1
db2start
db2 LIST DATABASE DIRECTORY
 System Database Directory

 Number of entries in the directory = 1

Database 1 entry:

 Database alias = MYDB
 Database name = MYDB
 Local database directory = /home/db2inst1
 Database release level = d.00
 Comment =
 Directory entry type = Indirect
 Catalog database partition number = 0
 Alternate server hostname =
 Alternate server port number =

$ db2 UPGRADE DATABASE MYDB
DB20000I The UPGRADE DATABASE command completed successfully.
$ db2 connect to MYDB

 Database Connection Information

 Database server = DB2/LINUXX8664 10.5.4
 SQL authorization ID = DB2INST1
 Local database alias = MYDB

Get rid of the obsolate DAS

After DB2 9.7 DAS is discouraged to be used. It’s best to get rid of it once and for all.

# /opt/ibm/db2/V9.7/instance/daslist 
dasusr1
# /opt/ibm/db2/V9.7/instance/dasdrop 
SQL4410W The DB2 Administration Server is not active.
DBI1070I Program dasdrop completed successfully.

Get rid of the obsolete users as well.

# userdel -r dasusr1
# groupdel dasadm1

Remove old installation

You can remove the old install using the procedure described here

# /opt/ibm/db2/V9.7/install/db2_deinstall -a

TBC

Leave a Reply

Your email address will not be published. Required fields are marked *