db2start at start up on Linux

To manage db2start on all DB2 instances on a server , there is a workaround to use. This is not standard way of managing db2start , but I have found the method useful.

If you are using Clustering software such as Tivoli Storage Automation (TSA) , then the TSA scripts manage the db2start process.

1)  Create  a shell script  and place this code in the script.  I call it “db2.sh”  , any name is OK.

#! /bin/sh 
for i in `/opt/ibm/db2/V9.5/bin/db2ilist`;
do
 su - $i -c "db2start"
done

2)       Place the script in the “/etc/init.d”  directory and apply relevant execution rights .

3)       Permissions to execute

chmod 744  db2.sh

4)      Create the symbolic links in the proper rc*.d directories links for intended runlevels. Either manual option or “chkconfig” commnand.

For example, assuming you want the level 5 start

ln /etc/init.d/db2.sh /etc/rc5.d/db2.sh

The init.d directory contains a number of start/stop scripts for various services on the  system.  Placing the script in the etc/init.d will execute it on start up, as long as symbolic links are created and relevant permission on file

The script iterates through the list of DB2 instances , and assuming there is a  logon account with the same name as the instance , will issue the “db2start” in the security  context of the account.

Author: Jack Vamvas

Leave a Reply

Discover more from ciquery

Subscribe now to keep reading and get access to the full archive.

Continue reading