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