Posts

How to check the number of rows affected in DB2 INSERT / DELETE / UPDATE / MERGE commands

By default,Db2 doesn’t print the number of records affected when we run the DML commands like INSERT,UPDATE,DELETE & Merge in the command prompt.   For Displaying the count we have 2 methods   1.use -m   Eg: db2 -m “insert or update or delete statement   2. Add the following Profile Registry Command   Db2set db2options=-m   Restart the Instance   Db2stop   Db2start   Then try to insert or update the records in a table.you can find the counts after the statement executed successfully.    

How to Upgrade DB2 Version from 10.5 to 11.1 using Linux Server

Steps to follow for DB2 Upgrade   1.Backup up the databases. 2.Stop the existing instance 3.Download the Latest db2 version to upgrade 4.First,do the instance upgrade 5.After the instance upgrade completion,do the database upgrade using the upgrade command   -- Download the 11.1 version & install the db2.(Make sure that don't create any instances)   It will install db2 in this /opt/ibm/db2/11.1 path.This is the default path for db2.   Go to /opt/ibm/db2/11.1/instance path,here we have a command called db2iupgrade to upgrade the instances.   ./db2iupgrade -u <fenceuserid> <instanceuserid>   It will take some time to upgrade & will generate the log file.U check the complete details in the log file(regarding the status of upgradation)   Once the upgradation is success.U have to start the instance using  db2start  command.   You can check the db2 version,whether the instance is up...

DB2 Installation Steps in Linux Server

1:Download the Db2 software   Eg : db210.5_linux.tar.gz     2.Unzip the above product using the below command   gunzip -d db210.5_linux.tar.gz   3.Untar the product   db2 -xvf db210.5_linux.tar   It will extract the files & create the SETUP Directory .   4.In the setup directory,u have to run the following command   ./db2install   It will generate the log file,based on the log file u can verify whether it has executed successfully or not.  

What is an Instance in DB2

An instance can manage multiple databases.In an instance,each database has a unique name,its own set of catalog tables,configuration files,authorities & privileges.You can create multiple instances on Linux and Unix if db2 is installed as a root user.   To Create an Instance in DB2   ./db2icrt -u <fenceuserid> <instanceuserid>   To check the list of instances   Db2ilist   To get the current Instance   Db2 get instance   To Start & Stop the instance   Db2start   Db2stop

DB2 Useful Commands

     SYNTAX                                                                             Description Db2Start To Start an Instance Db2Stop To Stop an Instance Db2 Connect to <DB> connect to database Db2Stop Force To stop the database manager instance forcefully Db2cc start the db2 control center Db2 List Db Directory To list all databases in an instance Db2 List Tables To list all tables in the connected Database Db2 List Applications List all Applications Connected Db2 ...