Db2

 View Only
  • 1.  Where is db2 command?

    Posted Thu December 26, 2019 08:28 AM
    First of all I want to say that I'm relatively new to DB2, but I thought that 'db2' command is the basic one.
    I logged into container and tried to execute it:
    [root@90e1ff109b01 /]# db2 connect to testdb
    bash: db2: command not found

    I searched for it, found it and executed it without success:
    [root@90e1ff109b01 /]# /opt/ibm/db2/V11.5/bin/db2 connect to testdb
    SQL10007N Message "-1390" could not be retrieved.  Reason code: "3".

    When I type "db2" and press TAB only 2 commands are displayed - db2greg  and db2ls
    Don't I understand something or is the image not well prepared?


    ------------------------------
    a b
    ------------------------------

    #Db2


  • 2.  RE: Where is db2 command?

    Posted Fri December 27, 2019 02:55 AM
    Edited by System Fri January 20, 2023 04:46 PM
    You are root user so you must have the "db2 environment" or log into the instance user (usually "db2inst1").
    To log into the instance user :
        su  -  db2inst1
    To have the environment (supposed the instance owner was "db2inst1") :
        .  /home/db2inst1/sqllib/db2profile    (n.b. blank after the initial dot)

    As we see the error SQL10007N, I think you must first start the database software itself(with "db2start" com
    mand) and then, probably, create the TESTDB database (db2 "CREATE DATABASE TESTDB").

    ------------------------------
    Adriano Mari
    ------------------------------