Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2004
    Posts
    5

    Unanswered: DB2 environment - or not?

    I have a strange problem; or perhaps it is a feature? I'm not sure, but it looks as a problem. This is the setup: An HP-UX server with several DB2 instances, all version 8.1. Users need to be able to switch between instances, which they do by setting DB2INSTANCE as well as the PATH and library path; but for some reason this doesn't seem to work quite as expected, especially for two instances, db2i81 and db2i81p. These are the symptoms:

    set env for db2i81 and run:
    $ db2 get dbm cfg | grep -i svce
    TCP/IP Service name (SVCENAME) = db2i81

    set env for db2i81p and run:
    db2 get dbm cfg | grep -i svce
    TCP/IP Service name (SVCENAME) = db2i81

    - but if I first set the environment for db2i81p and then for db2i81, SVCENAME will come back as db2i81p. What is happening here?

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    In the user profile file (not sure what it is called in HP-UX but it is .profile in Linux) for instance owner, there are some commands added by DB2 to initialize the environment so that the user id points to the correct DB2 instance. It would probably be best to look at those commands and use them for any other users that want to point to another instance.
    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
    Jun 2006
    Posts
    471
    It is a bad idea to re-use the profile of another user. there can be settings in this profile that are not needed or specific for this user
    always create a client instance and catalog the local instances/node and databases and use your own profile
    Best Regards, Guy Przytula
    DB2 UDB LUW certified V6/7/8

  4. #4
    Join Date
    Apr 2004
    Posts
    5
    What you are saying is true - and it is what I do, more or less; only I have wrapped it in a shell function with a menu interface that lets the user set the environment for Oracle, Informix and Sybase as well (we develop SW that talks to all of those).

    The thing is - this problem doesn't seem to occur on the other platforms (AIX, SunOS, Linux). I have compared the whole environment in the situation described (first set the env for db2i81, then db2i81p, compared to just setting db2i81p) - and there is no difference at all. But the SVCENAME is different in the two situations.

  5. #5
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Actually, I would source the sqllib/db2profile of the respective instance. Then you only pick up the DB2-related changes and not what any other user may do in his/her ~/.profile.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  6. #6
    Join Date
    Jun 2006
    Posts
    471
    SVCENAME is only a mapping between a symbolic name and /etc/services
    to define a port on which the instance is listening for external connections
    each instance has his own entry in this file
    Best Regards, Guy Przytula
    DB2 UDB LUW certified V6/7/8

  7. #7
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Try issuing "db2 terminate" after you change the shell environment. Catalog and connection information may be cached and won't take effect immediately.
    ---
    "It does not work" is not a valid problem statement.

  8. #8
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Quote Originally Posted by guyprzytula
    SVCENAME is only a mapping between a symbolic name and /etc/services
    to define a port on which the instance is listening for external connections
    each instance has his own entry in this file
    That's not quite correct. SVCENAME identifies the port already. The identifier may be a symbolic name or a numeric value. If it is a numeric value, then it is the port number (not a mapping). The symbolic name is mapped to a port number using /etc/services, however.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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