DB2 Native Encryption

IBM introduced DB2 Native Encryption with DB2 10.5 FP 5. DB2 Native encryption, encrypt db2 backup image and key database files like tablespace containers, transaction logs, archive logs, load copy data as well as load staging files.  In other databases this technology is also referred as TDE (Transparent Data Encryption). TDE or DB2 Native Encryption, encrypt data at rest that is in files and not data in transit or data in use. Even if you have enabled DB2 Native Encryption for your database it will not encrypt table data which user can access using DML statement. It is possible to only encrypt backup of database which is not encrypted.

DB2 Native Encryption License Requirement:

In DB2 10.5 FP 5 and later FP, DB2 Native Encryption is available by default with DB2 Express-C Edition, DB2 Advanced Workgroup Server Edition, DB2 Advanced Enterprise Server Edition, DB2 Developer Edition but for DB2 Express Server Edition, DB2 Workgroup Server Edition, DB2 Enterprise Server Edition you need to purchase and apply additional license of IBM DB2 Encryption Offering to use DB2 Native Encryption. From DB2 11.1 DB2 Native Encryption is enable by default for all edition.

SQL0803N SQLSTATE=23505 Error on table with IDENTITY column

SQL0803N SQLSTATE=23505 or SQLCODE=-803 SQLSTATE=23505 error in DB2 LUW indicates you are trying to Insert, Update row which violates Primary Key, Unique Constraint or Unique index on a table. This error on a table for which Primary Key column is IDENTIY column with GENERATED BY DEFAULT or GENERATED ALWAYS seems strange, since DB2 itself take care of generating unique value for IDENTITY column. You might get SQL0803N error when running insert from CLI and in application error log you might get see error SQLCODE=-803 SQLSTATE=23505.

This issue happens when IDENTITY column generate value which is already present in table. You can observer this anomaly in below scenarios: 

db2_deinstall error : DBI20081E The installer detected that there is not enough free disk space

During DB2 client uninstall you can encounter error DBI20081E  The installer detected that there is not enough free disk space in "/tmp". Free space detected in "/tmp" is: "1811268" (measured in kilobytes). Space needed is: "2000000" (measured in kilobytes).  If free size in /tmp is less than 2000000 KB you will hit this error even though /tmp space requirement is only 512 MB for non pureScale environment as per IBM Knowledge Center. I successfully reproduced this issue with DB2 11.1 FP 2b and 11.5.4 client.

Red Hat Linux 8.2 Installation

In previous blog we have seen how to install and create a new VM in Oracle VirtualBox, if you have not read it, you can check Setup VM for DB2 LUW installation post. In this post we will install Red Hat Enterprise Linux (RHEL) 8.2 on Oracle VirtualBox VM and configure RHEL for DB2 installation.

Step1: Download RHEL 8.2

You can download RHEL from Red Hat Linux website. You would need a Red Hat account to download RHEL. If you do not have a Red Hat account you can create free of cost account from Red Hat Account. RHEL 8.2 DVD ISO file size is 8 GB. As part of Red Hat Developer program you can download any RHEL version which is currently supported by Red Hat including version 5 and 6. This RHEL product must only be used for development and not for production.

Step2: Configure VM to boot RHEL 8.2 installation DVD

Open Oracle VirtualBox, select your VM and click on Settings button

Setup VM for DB2

Every DBA must have a VM to play around, it can be either a VM in public cloud like AWS, Azure, GCP, IBM Cloud etc. or you can build your own VM on your system. If you have a system with processor which supports virtualization and 8 GB of memory you should be fine with creating VMs. You can do it with 4 or 6 GB of memory but then you might observe slowness on your VM as well as on your system.

For creating VM you can use Oracle Virtual Box or  VMware Workstation Player which is freeware.

In this post we will see how to Setup VM for DB2 using Oracle Virtual Box on a Windows 10 system. Below steps can be used to setup VM for other purpose as well not necessarily for DB2.

Step1: Download Oracle Virtual Box

You can download Oracle Virtual Box from  Download Oracle Virtual Box

DB2 installation issue : The hostname is invalid

During DB2 installation you might get error The hostname is invalid. We get this error if your hostname is not properly configured and mapped to an IP Address which is reachable.

While performing DB2 installation using db2setup command you might get below error screen.

Same solution is valid for error during installation with db2_install command.

DB2 11.1 GUI Installation on Linux

DB2 11.1 can be install using GUI on Linux server. In this blog we will see how to install DB2 11.1 using GUI on linux server. For DB2 system requirement, prerequisite and pre-installation steps check blog DB2 11.1 Installation on Linux

Check blog Setup X11 Forwarding to access GUI in Linux to configure X11 forwarding to access GUI.

Once you have configured X11 forwarding and pre-installation steps completed for DB2 installation then change your working directory to directory where you have extracted DB2 product.

Setup X11 Forwarding to access GUI in Linux

While working with Linux OS over a ssh connection, you might be in a situation where you want to access GUI. In such situation either you can use tool like MobaXterm which has inbuilt support for X11 forwarding or you can use your own PuTTY which can support X11 forwarding if you have X11 display server installed on your system like Xming X Server. In this post we will go through steps to setup X11 forwarding to access GUI in Linux.

Step1: Download and Install Xming X Server

Download Xming X Server from sourceforge.net

Uninstall DB2 on Linux

 As part of server decommissioning, cleanup of old DB2 product,  you might need to uninstall DB2. In this blog we will go through steps to uninstall DB2 on Linux.

Step 1: Verify DB2 instance association with DB2 product

You can use db2ilist command and execute it from <DB2 Installation Path>/instance with root privilege to get DB2 instance associated with that DB2 installation

./db2ilist

db2ilist

If there is no DB2 instance associated with it then skip next step

db2idrop issue : The specified instance does not exist

You might come across scenario where db2ilist return DB2 instance name but that instance does not exist. Such situation might arise due to failed db2idrop, sqllib directory missing in DB2 instance user home directory or someone messed up with your instance home directory.

db2ilist

How to create DB2 Instance on Linux

DB2 Instance:

DB2 Instance is a run time environment under which database runs. Instance is used to configure run time environment using Database Manager Configuration (DBM) parameters and registry variables. You can have multiple instance on same server depending upon your server resource configuration. Databases are unique within the instance. You cannot have 2 database with same name in one instance but you can have 2 database with same name in different instance on same server. E.g. You cannot have 2 database with same name i.e. TESTDB in one instance i.e. db2i1 but you can have 2 database with same name i.e. TESTDB in two instance on server i.e. db2i1 and db2i2. In this blog we will see step by step procedure to create DB2 Instance on Linux server. This same steps can be followed for not only Linux environment but it is applicable for any unix environment which is supported by DB2.

DB2 11.1 Installation on Linux

In this post we will go through steps of DB2 11.1 installation on Linux. Before installing any DB2 LUW product, you should ensure your system meets operating system, hardware, software, storage and memory requirement.

Update: Below steps are valid for DB2 11.5 installation on Linux as well.

Step 1: Check below link for most up to date installation requirement



Step 2: Download DB2 LUW product image from below link