Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2009
    Posts
    9

    Unanswered: Problem in export DB2INSTANCE

    Hi All,

    In a shell script I'm trying to export the instance names sequencially from a file.

    while read line
    do
    if [ -f /home/$line/sqllib/db2profile ]; then
    . /home/$line/sqllib/db2profile

    export DB2INSTANCE=$line

    db2 "get instance"

    done < instance.list


    instance.list consists of all the instance names in the server.


    I want to display different values for db2 "get instance" depending on the instance name.

    Thanks in advance
    Sekhar Bade

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Why do you want to do this? If you want to list all the instances, just use db2ilist.

    Looking at your script, I notice you do not have an end to you if statement.

    Andy

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Also, you need to issue the DB2 TERMINATE command after changing DB2INSTANCE.
    ---
    "It does not work" is not a valid problem statement.

  4. #4
    Join Date
    Dec 2008
    Location
    Toronto, Canada
    Posts
    399
    and line
    db2 "get instance"

    should be

    db2 get instance >> instance.list



    but Andy is right
    DB2 9.5/9.7 on Unix/AIX 6.1/Linux

  5. #5
    Join Date
    Nov 2009
    Posts
    9
    Thanks for all your respone,i issued DB2 TERMINATE command after changing DB2INSTANCE as per my requirement.it help me a lot in the shell script.thanks nick.

    Warm Regards
    BADE

  6. #6
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I wonder what is the purpose of all this. All that GET INSTANCE does is display the contents of the DB2INSTANCE environment variable, and you set it from a list of instances, so you could just as well replace your entire script with "cat instance.list"...
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

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