How to use fault monitors to automatically restart DB2 UDB instances

Technote (FAQ)


Question

How can I automatically restart my DB2 UDB instances? This document lists step by step instructions for setting up the Fault Monitor Facility to automatically restart DB2 UDB instances.

Cause

The db2iauto command enables and disables the auto-start of an instance after each system restart. With Fault Monitor facility, if the DB2® Universal Database™ (DB2 UDB) instance exits prematurely, the fault monitor will restart it.

Answer

1. Enable auto-start of the instance by executing the following command as the instance owner:

db2inst1@host01:~> db2iauto -on db2inst1

2. Log in as Root

3. Determine whether there are any db2fmcd entries in the /etc/inittab file. If there are, remove them or comment them out before proceeding. To remove the entry, use the db2fmcu -d command:

root@host01:~> cat /etc/inittab | grep db2fmcd
fmc:2345:respawn:/opt/ibm/db2/V10.5/bin/db2fmcd #DB2 Fault Monitor Coordinator
root@host01:~> /opt/ibm/db2/home/db2inst1/sqllib/bin/db2fmcu -d
root@host01:~> cat /etc/inittab | grep db2fmcd

Note:
As of RHEL 6, the /etc/inittab file has been deprecated. Issuing the db2fmcu -d command removes the '/etc/init/db2fmcd.conf' file.
As of Solaris 10, the /etc/inittab file has been deprecated. Issuing the db2fmcu -d command disables the SMF service named 'db2fm'.

4. Make sure there are no db2fmcd (Fault Monitor Coordinator Daemon (FMCD)), db2fmd (Fault Monitor Daemon) or db2fm (Fault Monitor) processes running. If there are, remove (kill) the process(es) before proceeding:

root@host01:~> ps -ef | grep db2fm
root 7300 6652 0 07:01 pts/0 00:00:00 grep db2fm

5. Go to the DB2DIR/bin directory.

root@host01:~> cd /opt/ibm/db2/V10.5/bin/

6. Enable the Fault Monitor Coordinator by executing the ./db2fmcu -u -p /opt/ibm/db2/V10.5/bin/db2fmcd command. This step adds an entry to the /etc/inittab so that the FMCD process will be started each time you reboot.

root@host01: /opt/ibm/db2/V10.5/bin> ./db2fmcu -u -p /opt/ibm/db2/V10.5/bin/db2fmcd
root@host01: /opt/ibm/db2/V10.5/bin> cat /etc/inittab | grep db2fm
fmc:2345:respawn:/opt/ibm/db2/V10.5/bin/db2fmcd #DB2 Fault Monitor Coordinator

Note:
As of RHEL 6, the /etc/inittab file has been deprecated. Issuing this command creates or replaces the db2fmcd.conf file under the /etc/init directory.
As of Solaris 10, the /etc/inittab file has been deprecated. Issuing this command creates and enables the SMF service named 'db2fm'.

7. Start up the fault monitor daemon:

root@host01: /opt/ibm/db2/V10.5/bin> ./db2fm -i db2inst1 -U

8. Start up the fault monitor service:

root@host01: /opt/ibm/db2/V10.5/bin> ./db2fm -i db2inst1 -u

Note:
The above command may return a non-zero return code:

root@host01: /opt/ibm/db2/V10.5/bin> ./db2fm -i db2inst1 -u
./db2fm return non-zero rc, please see log file '/opt/ibm/db2/home/db2inst1/sqllib/db2dump/db2diag.log'

This is because the DB2 instance is already started. Stopping the instance and proceeding to run the same command succeeds.

9. Turn on the fault monitor for the instance:

root@host01: /opt/ibm/db2/V10.5/bin> ./db2fm -i db2inst1 -f on

10. Reboot the server. The fault monitor service should be available once the server has been rebooted.

11. Verify the fault monitor state. Log in as the instance owner and issue the db2fm -s -S command. You should see output similar to the following:

db2inst1@host01:~> db2fm -s -S
Gcf module 'fault monitor' state is AVAILABLE
Gcf module '/opt/ibm/db2/V10.5/lib64/libdb2gcf.so' state is AVAILABLE

12. Log in as Root.

13. Go to the DB2DIR/bin directory (per step 5).

root@host01:~> cd /opt/ibm/db2/V10.5/bin/

14. Verify the FMC Daemon state by issuing the db2fmcu command.

root@host01: /opt/ibm/db2/V10.5/bin> ./db2fmcu
FMC: up: PID = 5319

15. At this point, if the instance is shut down in any way other than via the db2stop command, the fault monitor will start it up again. If you want to test the fault monitor's functionality, bring down the DB2 UDB instance. For example, issue the db2_kill command:

root@host01: /opt/ibm/db2/V10.5/bin> ps -efl |grep db2sysc
4 S db2inst1 6530 6528 0 80 0 - 206688 futex_ 07:07 ? 00:00:00 db2sysc
0
0 R root 6751 5775 0 80 0 - 1380 - 07:09 pts/0 00:00:00 grep db2sysc
root@host01: /opt/ibm/db2/V10.5/bin> su - db2inst1
db2inst1@host01:~> db2_kill
ipclean: Removing DB2 engine and client's IPC resources for db2inst1.

16. The instance will be automatically restarted:

root@host01: /opt/ibm/db2/V10.5/bin> ps -efl |grep db2sysc
4 S db2inst1 7528 7526 5 80 0 - 206688 futex_ 07:10 ? 00:00:00 db2sysc
0
0 R root 7554 5775 0 80 0 - 1380 - 07:10 pts/0 00:00:00 grep db2sysc

Note: This document was tested and created using DB2 versions 8.2, 9.1, 9.5, 9.7, 10.1 and 10.5.



For further discussion on this topic, visit this developerWorks forum thread:
https://www.ibm.com/developerworks/community/forums/html/topic?id=29fc0820-f6b3-4a7d-aaf5-5925835a0c0f

Related information

Fault monitor facility for UNIX-based systems
RHEL6
SOLARIS

Rate this page:

(0 users)Average rating

Document information


More support for:

DB2 for Linux, UNIX and Windows
High Availability - Fault Monitor

Software version:

8.2, 9.1, 9.5, 9.7, 10.1, 10.5

Operating system(s):

AIX, HP-UX, Linux, Solaris

Reference #:

1209001

Modified date:

2014-05-12

Translate my page

Machine Translation

Content navigation