If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Problem in export DB2INSTANCE

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-19-09, 11:25
sekhar bade sekhar bade is offline
Registered User
 
Join Date: Nov 2009
Posts: 9
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
Reply With Quote
  #2 (permalink)  
Old 11-19-09, 11:47
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #3 (permalink)  
Old 11-19-09, 12:07
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Also, you need to issue the DB2 TERMINATE command after changing DB2INSTANCE.
Reply With Quote
  #4 (permalink)  
Old 11-19-09, 13:51
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
and line
db2 "get instance"

should be

db2 get instance >> instance.list



but Andy is right
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #5 (permalink)  
Old 11-20-09, 06:07
sekhar bade sekhar bade is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 11-20-09, 09:52
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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"...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On