Topic
3 replies Latest Post - ‏2015-04-20T22:40:24Z by Jun Su Lee
SystemAdmin
SystemAdmin
17917 Posts
ACCEPTED ANSWER

Pinned topic How to start DB2 on RedHat

‏2013-02-09T09:11:35Z |
I installed DB2 on RedHat, after installation I started and it worked very well. The problem arose when I had to reboot the machine and DB2 had not yet been included in the services to start at boot RedHat.

Now I no longer start.

On RedHat machine I have the root account, then during the installation of DB2 I was asked to create an administrator account for DB2, and an account of the owner instance. I then three accounts:

-RedHat root account
-Admin DB2 account
-Owner instance DB2 account

Now how do I start DB2, so that the account owner instance can execute the query?

And then how do I put in the DB2 service to start at boot RedHat?
Updated on 2013-02-12T17:59:41Z at 2013-02-12T17:59:41Z by nivanov1
  • nivanov1
    nivanov1
    231 Posts
    ACCEPTED ANSWER

    Re: How to start DB2 on RedHat

    ‏2013-02-12T17:59:41Z  in response to SystemAdmin
    To start the instance manually execute the db2start command as the instance owner. To start it automatically you'd need to add a script performing this task to your init.d directory (or systemd, if that's what you use).
  • dawinter
    dawinter
    1 Post
    ACCEPTED ANSWER

    Re: How to start DB2 on RedHat

    ‏2015-04-17T22:04:10Z  in response to SystemAdmin

    You can enable the autostart for a db2inst with  db2iauto -on db2inst1

    Additionally the db2 install add an entry for the fault monitor in inittab. 

    But with Redhat 6 inittab is deprecated and with Redhat 7 upstart is deprecated and are disabled. (see http://www-01.ibm.com/support/docview.wss?uid=swg21209001)

    To reenable the autostart for the fault monitor and the db2inst you can activate it via systemd as described here:

     - article http://blog.ondruska.com/2014/12/db2-luw-automatic-start-with-systemd.html or 

    - article https://forums.opensuse.org/showthread.php/475468-In-search-for-a-inittab-entry-replacement-for-systemd

  • Jun Su Lee
    Jun Su Lee
    22 Posts
    ACCEPTED ANSWER

    Re: How to start DB2 on RedHat

    ‏2015-04-20T22:40:24Z  in response to SystemAdmin

    Adding to the answers.

    This is normal outlook of account configuration.

    As root

    # groupadd db2igrp
    # useradd db2inst1 -d /home/db2inst1 -g db2igrp -m
    # groupadd db2fgrp
    # useradd db2fenc1 -d /home/db2fenc1 -g db2fgrp -m
    # passwd db2inst1
    # passwd db2fenc1
    # cd /opt/ibm/db2/V9.7/instance
    # ./db2icrt -u db2fenc1 db2inst1

     

    As DB2 instance user

    # su - db2inst1
    $ db2start
    09/15/2009 16:57:21     0   0   SQL1063N  DB2START processing was successful.
    SQL1063N  DB2START processing was successful.
    $ db2 create database mydb
    DB20000I  The CREATE DATABASE command completed successfully.
     
    [db2inst1@becker ~]$ db2 connect to mydb
     
       Database Connection Information
     
     Database server        = DB2/LINUX 9.1.3
     SQL authorization ID   = db2inst1
     Local database alias   = MYDB

     

    And also, you need to two parameters to allow remote connections.

    $ db2set DB2COMM=TCPIP

    $ db2 update dbm cfg using svcename <port>

     Port number can be referred from /etc/services file.