Db2 Instance Cheat Sheet
- Aug 20, 2021
- 2 min read
A DB2 instance is a logical Database Manager environment for DB2. Using this instance, you can manage databases. For DB2 Database Server, the default instance is “DB2” but depending on your requirements, you can create multiple instances on one physical machine. It is not possible to change the location of Instance directory after its creation. An instance can manage multiple databases. In an instance, each database has a unique name, its own set of catalog tables, configurations files, authorities and privileges.

In this blogpost you will see and learn Db2 instance related syntaxes and methods which help you using Db2 database product.
1) Listing instances
db2ilist 2) Instance environment commands
Get instance
db2 get instance Set instance
set db2instance=<instance_name> db2start
db2start db2stop
db2stop 3) 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>4) Arranging communication port and host for an instance
db2c_<inst name> <inst_port>/tcp5) Updating an instance
Update an instance in normal mode
db2iupdt <inst_name> Update an instance in debugging mode
db2iupdt -D <inst_name> 6) Upgrading an instance
db2iupgrade -d -k -u <inst_username> <inst_name> 7) Dropping an instance
db2idrop -u <inst_username> <inst_name> 8) 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_infoThat's all in this post. If you liked this blog and interested in knowing more about IBM Db2. Please Like, Follow, Share & Subscribe to www.ImJhaChandan.com





Comments