Results 1 to 8 of 8
  1. #1
    Join Date
    May 2012
    Posts
    155

    Unanswered: sudo su - db2inst1

    Hallo everyone,

    I have installed DB2 Express-C in my Ubuntu machine. I start my DB2-Server with the command:
    sudo su - db2inst1

    I wonder, whether I can start my DB2 with other commands too?
    Like db2start

    I havent tried this, because I just "broke" my Ubuntu machine. Because of a problem, I changed the name of etc/passwd.lock into etc/passwd.lock_bak. Since then, my Ubuntu ist broken
    I will have to install it new.

    But to my previous problem. I actually havent understood, why I HAVE to use sudo su - db2inst1 to connect to the instance db2inst1.
    I tried to log in as user with the command su. After that I tried to sudo db2inst1. But it didnt work.

    Somebody knows why?

    Thank you...

    Regards,
    Ratna

  2. #2
    Join Date
    Apr 2012
    Posts
    1,034
    Provided Answers: 18
    If you have only 1 machine for learning
    then you can get DB2 instances to start
    automatically when you boot your machine.
    Search the Infocenter for these commands:
    db2iauto
    db2fmcu

    If you do not want automatic starts then
    you can use db2start for each instance.

    You only need to sudo to the instance owner
    when you specicially want to be that user
    (for example you want to grant special rights
    to other users, other groups, other roles).

  3. #3
    Join Date
    May 2012
    Posts
    155
    Thanks db2mor,

    I have installed new DB2 Express-C on my Ubuntu machine. After the installation, there were 2 "annoying" messages:

    *Starting DAS: failed
    Message: -su: db2admin: Command not found.

    Is it bad? Or it doenst matter?

    Thank you

    Ratna

  4. #4
    Join Date
    May 2012
    Posts
    155
    I give up with the creating of a new instance. I will just use the default instance created from the installation.

    So, now I have an instance called db2inst1. In this instance, I have created the recommended database SAMPLE.

    If I am not mistaken, the user name of this instance is also db2inst1, right?

    My question:
    if want to connect to SAMPLE without sudo su - db2inst1, how can I do that?

    I tried to connect to the database:
    ratna@ratna-Laptop:~$ sudo db2start
    sudo: db2start: command not found

    Thank you,
    Ratna

  5. #5
    Join Date
    Apr 2012
    Posts
    1,034
    Provided Answers: 18
    You seem to be learning Linux and learning DB2 at the same moment, and asking a lot of very simple questions.

    Maybe that is not wise to try both things at the same moment.

    Maybe it is best to Learn the basics of Linux first...

    That would let you progress faster...




    This failure to start DAS is not a blocking problem, you can survive without the DAS, but the problem should be easy to fix if you study the messages and Infocenter.
    In V9.7 the DAS is needed only for some actions in Control-Center.



    Become the DAS user (example: login as that account , or sudo su - dasadm1, or su - dasadm1 )

    Try to start the DAS manually:

    /opt/ibm/db2/V9.7/das/bin/db2admin start

    and then try to understand the messages, look in the infocenter for the meaning of the error messages and the recommended actions.

    You can also create a .profile for the DAS user and add a line to dot in the dasprofile
    .profile --> . $HOME/das/dasprofile

    You can also read the error messages in the DAS diagnostics file
    ~dasusr1/das/dump/db2dasdiag.log


    Always study the Infocenter before asking for help. Google answers many simple questions quickly.





    Study the infocenter
    Starting and stopping the DB2 administration server (DAS) - IBM DB2 9.7 for Linux, UNIX, and Windows

  6. #6
    Join Date
    May 2012
    Posts
    155
    I actually just want to start using the database SAMPLE without having to "log in" over sudo su - db2inst1.
    Because, this command seems to be a logging in as an administrator for the instance db2inst1.

    In fact, I found a lot of informations regarding starting a db. The simplest way might be:
    db2 connect to db2inst1
    db2 connect to db2inst1 ratna db2inst1

    But they just didnt work. They kept giving me the error "command not found". To be honest, I dont even have a clue, why:

    ratna@ratna-Laptop:~$ db2start
    ratna@ratna-Laptop:~$ sudo db2start

    dont work. All give me the message "command not found".

    I could not find the answers in the internet. But okay, maybe I have to take a course.

    Regards,
    Ratna

  7. #7
    Join Date
    Apr 2012
    Posts
    1,034
    Provided Answers: 18
    Once again, very elmentary stuff. Yes get some training or just study any one of the many books available about DB2 on LUW.

    When Linux says "not found" when you try run a program it normally means that the PATH variable is not set right.

    For any userid on Linux that wants to use DB2 from the command line shell (bash or ksh) that user's home directory needs to "dot in the db2profile" of the correct instance.

    Since you can have lots of instances, DB2 does not know *which* instance you want to use at any time, so you have to tell it via environment variables.

    This is in the infocenter at:
    UNIX environment variable settings - IBM DB2 9.7 for Linux, UNIX, and Windows


    So in your example case, edit your .profile or .bashrc and include the line
    Code:
    . ~db2inst1/sqllib/db2profile
    Then either logout and login again, or just execute the .profile manually.
    The db2profile is a short scrpt that sets lots of variables necessary to run DB2 commands and tools.

    You should also do this in the .profile of the instance owner(s) , and a simiilar change (see my previous post) for the DAS user.

  8. #8
    Join Date
    May 2012
    Posts
    155
    Hallo db2mor,

    where should I put the line?
    Code:
    . ~db2inst1/sqllib/db2profile
    in my .profile ?

    The file .profile looks like this:

    Code:
    # if running bash
    if [ -n "$BASH_VERSION" ]; then
        # include .bashrc if it exists
        if [ -f "$HOME/.bashrc" ]; then
            . "$HOME/.bashrc"
        fi
    fi
    
    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
    fi
    Thank you,
    Ratna

Posting Permissions

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