DB2: Instance Cheat Sheet

Listing instances


Instance environment commands

Get instance

db2 get instance 

Set instance

set db2instance=<instance_name> 





Creating an instance

Before create a new instance, you need to log in with root. Instance id is not a root id or a root name.

Step1: Create an operating system user for instance.

useradd -u <ID> -g <group name> -m -d <user location> <user name> 
-p <password>  

Step2: Go to the DB2 instance directory in root user for create new instance.

cd /opt/ibm/db2/v10.1/instance  

Step3: Create instance using the syntax below:

./db2icrt -s ese -u <inst id> <instance name>

Arranging communication port and host for an instance

db2c_<inst name> <inst_port>/tcp

Updating an instance

Update an instance in normal mode

db2iupdt <inst_name> 

Update an instance in debugging mode

db2iupdt -D <inst_name> 

Upgrading an instance

db2iupgrade -d -k -u <inst_username> <inst_name>  

Dropping an instance

db2idrop -u <inst_username> <inst_name> 

Using other commands with instance

Check the current instance activated by database manager

db2 get instance  

See the current instance with operating bits and release version]

db2pd -inst | head -2  

Check the name of currently working instance]

db2 select inst_name from sysibmadm.env_inst_info    

Leave a Reply

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