Add additional Storage to VM hosted on Oracle Virtual Box

In blog Setup VM for DB2, we went through step by step process to setup a Linux VM hosted on Oracle Virtual Box. After setting up your VM, you might be in a situation where you want to create a new File System or drive, extend size of existing File System or drive, but this can be done only if you have free space available on your VM. If all existing storage is allocated for file system or drive then to create new File System or drive you would need additional storage. In this blog we will go through step by step process to add additional storage to your Oracle Virtual Box VM and then utilize additional storage to create a new File System in RHEL.

Add additional Storage to VM hosted on Oracle Virtual Box

Before addition of additional storage to your VM, you should ensure that your VM is in Powered Off state. If it is in running State then Right Click on Your VM, Select Close and then Select Power Off to Power Off your VM. You can also use your VM OS shutdown method to gracefully Power Off your VM.

Top Database Websites and Blogs

 ChoudharySumit.com has bee ranked  at 26 spot in Top 80 Database Websites and Blogs. To check complete list click here.

There are very good blogs and websites in this list and been selected as one the blog in this list is great honor. I would liked to thank Anuj Aggarwal and the team for considering my blog as part of Top 80 Database Website and Blogs.

I write this blog to share my experience with universe. I believe whatever I am is due to universe and I must give it back to universe.

I hope you enjoy this blog and Contact Me if you want to discuss anything.


If you liked this blog and interested in knowing more about DB2, please subscribe by clicking on Subscribe to ChoudharySumit.com by Email.


How to Encrypt DB2 Database using Centralized KeyStore

In blog How to Encrypt DB2 database we went through step by step process of configuring DB2 Native Encryption using Local KeyStore. Local KeyStore has overhead of backup and maintenance and in case Local KeyStore is not accessible due to any reason and you are unable to recover it then you cannot access your encrypted database, also restore from encrypted database backups will not be possible. To reduce this overhead you can use Centralized KeyStore. In this blog we will see step by step process to configure DB2 Native Encryption using Centralized KeyStore.

How to Encrypt DB2 Database using Centralized KeyStore?

Step1: Prerequisite - Digital Certificate

You can use self signed digital certificate as well but it is advised to use digital certificated signed by CA when using Centralized KeyStore.

SQL10007N Message "-1390" could not be retrieved. Reason code: "3"

When working with remote databases you might receive error SQL10007N Message "-1390" could not be retrieved.  Reason code: "3". You might receive SQL10007 Reason Code 3 in  your application as well. IBM documentation list below explanation for this error



SQL10007N Message "<msgno>" could not be retrieved. Reason code: "<code>".

Explanation:

The requested message <msgno> could not be retrieved from the message file. Reason code <code> is one of the following:

DB2 SSL

DB2 Native Encryption protects your DB2 database against threat at rest but this does not secure your data at transit. Even though your database is encrypt but malicious user can tap communication between your database and clients to view and modify data in transit. To secure your database at transit you can configure SSL communication between your application and database server, so that all communication goes through secure tunnel. DB2 support TLS version 1.0, 1.1 and 1.2. TLS 1.2 is not enabled by default. You can configure DB2 to support only TLS 1.2 or all of them i.e. TLS 1.2, 1.1 and 1.0. In this blog we will go through steps to configure DB2 SSL on DB2 server as well as on DB2 client. If you are interested to know about DB2 Native Encryption feature check blog DB2 Native Encryption, check blog Encrypt DB2 Database for steps to configure DB2 Native Encryption.

How to Encrypt DB2 Database

In blog DB2 Native Encryption we went through introduction to DB2 Native Encryption, license requirement, Data Encryption and Master Key, different Keystore supported by DB2, operation for which Keystore is access and performance impact of encrypting database. In this blog we will see step by step process to enable DB2 Native Encryption and Encrypt DB2 database.

How to Encrypt DB2 Database?

Step1: Planning

Before implementing DB2 Native Encryption and encrypting your database you should determine Keystore type i.e. Local KeyStore or Centralized KeyStore. Benchmark your database performance to determine variance in performance after enabling encryption. 

Your DB2 version should be DB2 10.5 FP 5 or above to support DB2 Native Encryption. If you are on DB2 10.5, depending on your DB2 edition you would need additional license of IBM DB2 Encryption Offering to use DB2 Native Encryption. From DB2 11.1 DB2 Native Encryption is available in all Db2 edition.

In this blog we will encrypt DB2 Database using Local Keystore

Check blog Encrypt DB2 Database using Centralized KeyStore for step by step process to enable DB2 Native Encryption using Centralized KeyStore

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