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

    Unanswered: Difference between su - and connect to sample user ...

    Hallo everyone,

    normally, I change the user of my DB2-Server using the OS command like:
    sudo su - myuser
    After logged in as myuser, I then connect to the database:
    db2 connect to our_db

    I saw a command in the documentation:
    connect to our_db user myuser using "password"

    My question:
    is the latter command just the short form of the the previous ones?
    Is there any differences regarding the loaded OS start up files between them?

    Questions regarding password:
    I have learnt that the authentification is controlled from OS, so that if I am a root, I can su to any user account without any password. This is also the way I switch to another user, for example:
    sudo su - db2inst2

    I never use su - db2inst2, because I dont know the password from db2inst2.
    As information, I created db2inst2 using these commands:

    sudo groupadd db2iadm2
    sudo groupadd db2fadm2
    sudo groupadd dasadm2

    sudo useradd -g db2iadm2 -m -d /home/db2inst2 db2inst2
    sudo useradd -g db2fadm2 -m -d /home/db2fenc2 db2fenc2
    sudo useradd -g dasadm2 -m -d /home/dasusr2 dasusr2

    sudo ./db2icrt -u db2fenc2 db2inst2


    I tried to different passwords I found in internet as default passwords like ibmdb2 etc, but it didnt work.

    Can someone please help me? Thank you.

    Regards,
    Ratna

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by ratnalein View Post
    Hallo everyone,

    normally, I change the user of my DB2-Server using the OS command like:
    sudo su - myuser
    After logged in as myuser, I then connect to the database:
    db2 connect to our_db

    I saw a command in the documentation:
    connect to our_db user myuser using "password"

    My question:
    is the latter command just the short form of the the previous ones?
    Is there any differences regarding the loaded OS start up files between them?
    No, they are not the same. You will have trouble doing that if the other database is in a different instance, unless you catalog that database as a remote database (see CATALOG DATABASE command), in which case you are connecting remotely (even if on the same server).
    Quote Originally Posted by ratnalein View Post
    Questions regarding password:
    I have learnt that the authentification is controlled from OS, so that if I am a root, I can su to any user account without any password. This is also the way I switch to another user, for example:
    sudo su - db2inst2

    I never use su - db2inst2, because I dont know the password from db2inst2.
    As information, I created db2inst2 using these commands:

    sudo groupadd db2iadm2
    sudo groupadd db2fadm2
    sudo groupadd dasadm2

    sudo useradd -g db2iadm2 -m -d /home/db2inst2 db2inst2
    sudo useradd -g db2fadm2 -m -d /home/db2fenc2 db2fenc2
    sudo useradd -g dasadm2 -m -d /home/dasusr2 dasusr2

    sudo ./db2icrt -u db2fenc2 db2inst2


    I tried to different passwords I found in internet as default passwords like ibmdb2 etc, but it didnt work.

    Can someone please help me? Thank you.

    Regards,
    Ratna
    You are asking Linux questions, not DB2 questions. These are more appropriate on a Linux forum.

    If you are root and want to change the password of a different user, issue this command (as root):
    passwd db2inst2

    If you are not root, but have sudo root authority:
    sudo passwd db2inst2

    Anyone alredy logged in as the user can use this command (but will need the current password):
    passwd
    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 2012
    Posts
    155
    thank you Marcus_A

  4. #4
    Join Date
    May 2012
    Posts
    155
    Hallo Marcus_A,

    You will have trouble doing that if the other database is in a different instance
    do you mean, it would be problem if one user is available in 2 instances and in each of this instance there is a database with same name?

    Is this version the better practice?
    connect to SAMPLE user RATNA using "password"
    Thank you.

    Regards,
    Ratna

  5. #5
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by ratnalein View Post
    Hallo Marcus_A,



    do you mean, it would be problem if one user is available in 2 instances and in each of this instance there is a database with same name?

    Is this version the better practice?


    Thank you.

    Regards,
    Ratna
    It's not the user that you have to be worried about. You can have two databases with same name on same server if they are in a different instances. But if the database is in a different instance, then you first have to either:
    1. attach to the instance, or
    2. run the profile command for the other instance (see the .bashrc hidden file for each instance owner that tells DB2 what instance you want) so DB2 knows which instance the database you want to connect to is located in. If you are instance owner, this profile gets executed when you log on, but if not the instance owner (or you want a different instance) then you have to source the other profile.


    Another other option is to catalog the remote node and database of the other database/instance if you want to access a database in a different instance (or different sever).
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

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