Results 1 to 12 of 12
  1. #1
    Join Date
    Jun 2008
    Posts
    40

    Unanswered: executing db2 commands as a root !

    Hi all,

    I have installed db2 ese on aix server using root authority ,
    but when ever i try to execute any db2 command as a root user it throws me error db2 not found . i have added root user id to my dbadmin group by modifying the /etc/groups file .
    Kindly help

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    You have to execute the profile of the instance owner user id. I don't use AIX much anymore (use Linux) so I don't remember the file name, but probably .profile in the home directory of the instance owner.

    In a shell script, execute it as:
    . /home/db2inst1/.profile

    where home directory of of instance owner is /home/db2inst1 and profile file name is .profile. Note the space between the first dot and the first slash.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    May 2007
    Location
    somewhere in dbforums
    Posts
    221
    As said by Marcus.... add the following into the .profile file of root

    # The following three lines have been added by UDB DB2.
    if [ -f /home/db2inst1/sqllib/db2profile ];then
    . /home/db2inst1/sqllib/db2profile
    fi
    this is considering the fact that db2inst1 is an instance available in your system....

    The above mentioned script will also be available in the.profile file of your db2 instance which you can directly copy paste into the .profile of root user
    IBM Certified Database Associate, DB2 9 for LUW

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    i would never recommend this because you depend on setting for other user
    never use root for db2 and create dedicate user and create db2 user instance with your proper settings;;;;
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  5. #5
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by przytula_guy
    i would never recommend this because you depend on setting for other user
    never use root for db2 and create dedicate user and create db2 user instance with your proper settings;;;;
    If the user in question is the instance owner, I don't see the problem if the command is part of a shell script. This is especially useful if you have a standard in the company as to where the home directory is located for the instance owner.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  6. #6
    Join Date
    Jun 2008
    Posts
    40
    Hi All,
    i did try to execute the .profile of the instance owner user id but it did not work and at the root i dont find .profile file of the root user .At the root i typed ls -a but i dont find any .profile file . The reason i am trying to execute db2 command with root authority is because i want to drop and create new instance which i guess i can do with only root access

  7. #7
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    If you just want to drop and create instances, you do not need the instance profile loaded to do that. Just run the db2idrop and db2icrt commands as root. You will have to fully qualify the names when executing them. Also run them from the installation directory of DB2 and not the instance directories.

    Andy

  8. #8
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    for db2icrt and db2idrop you d not need any db2 settings
    just cd /opt/ibm/db2/V9.5/instance or where db2 was installed and execute
    ./db2icrt ....
    another remark : .profile is located in /home/db2inst1 or home directory of db2inst1
    you should specify the full path or cd first to the home of db2inst1
    as documented, this should do..
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  9. #9
    Join Date
    Jun 2008
    Posts
    40
    I tried this and got the following result .
    /opt/IBM/db2/V9.5/instance
    # db2icrt -u db2fenc1 db2inst2
    ksh: db2icrt: not found.

  10. #10
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Quote Originally Posted by jayawant01
    I tried this and got the following result .
    /opt/IBM/db2/V9.5/instance
    # db2icrt -u db2fenc1 db2inst2
    ksh: db2icrt: not found.
    If you working directory is /opt/IBM/db2/V9.5/instance then you need to execute:

    # ./db2icrt -u db2fenc1 db2inst2

    Andy

  11. #11
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Or you can do the following:

    /opt/IBM/db2/V9.5/instance/db2icrt -u db2fenc1 db2inst2

    however you did not specify a port number, so try this:

    /opt/IBM/db2/V9.5/instance/db2icrt -u db2fenc1 -p 50100 db2inst2

    Where 50100 is your port number.

    Edit: Last time I worked on AIX (DB2 V8), IBM did not install DB2 on /opt directory, so you need to find out where DB2 is installed. Maybe they changed it so all Linux/UNIX is now on /opt but check first.

    Edit2: Directory on Linux for 9.5 is (case sensitive): /opt/ibm/db2/V9.5/instance
    This could be different if a new fix pack was installed, or if installer chose a different directory.
    Last edited by Marcus_A; 03-30-09 at 14:21.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  12. #12
    Join Date
    Jun 2008
    Posts
    40
    Hi Guys ,
    Thanks to all of you !
    ./db2icrt .... worked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •