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 listing the port numbers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-18-09, 09:54
nkamalkishore nkamalkishore is offline
Registered User
 
Join Date: Nov 2009
Posts: 3
Problem in listing the port numbers

Hello All,

I'm trying to list the port numbers of all the instances in a server, using the below script. But it is not working can anyone help. If any of the listed instances are not working and throwing a db2 error then the remaining instances port numbers are also not displayed.

The db2 error i'm getting is
SQL10007N Message "-1090" could not be retrieved. Reason code: "3".

db2ilist > /tmp/instance.list

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

## Retrieving the servicenames ##
db2 "get dbm cfg " | grep SVCENAME > /tmp/service.list
awk -F" " '{print $6}' /tmp/service.list > /tmp/serv.list

## Checks if any integer (50000) value is specified in SVCENAME ##
echo $(head -1 /tmp/serv.list) | egrep '^[0-9]+$' >/dev/null 2>&1

if [ "$?" -eq "0" ]; then ## If SVCENAME is an integer retrieving the port number using the instance name to search from /etc/servies file##
grep -w $line /etc/services >> /tmp/port.list
else ## If SVCENAME is a string retrieving the port number using the SVCENAME to search from /etc/servies file ##
grep -w $(head -1 /tmp/serv.list) /etc/services >> /tmp/port.list
fi
fi
db2 "terminate" > /tmp/msg.list
done </tmp/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