Which instanses are configured?
Posted in 2000
Topics: General Discussion
Is there a way to query the DBMS which informix servers (instanses) are
configured in the server machine? One (work around) solution would be
to search the informix user's .profile with "grep" for 'INFORMIXSERVER'
and then test with "onstat -". Any other (more direct) solutions?
Sent via Deja.com http://www.deja.com/
Before you buy.
c-eriks@algonet.se wrote:
> Is there a way to query the DBMS which informix servers (instanses) are
> configured in the server machine? One (work around) solution would be
> to search the informix user's .profile with "grep" for 'INFORMIXSERVER'
> and then test with "onstat -". Any other (more direct) solutions?
/INFORMIXTMP contains some of the information (assuming you're using 7.x
or later versions of Informix). I'm not sure how to interpret the files
in there, but I'm pretty sure that's what 'onstat -g dis' does, and I'm
mortified to find that this option is still not documented when you get
a usage message from onstat even though it was covered in this news
group
in July 1999. I also note that you get different results from the
command
depending on whether you run as root (or informix) or as some lesser
mortal.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"
PS: The 'open' statements in a run of onstat -g dis on Solaris shows:
open("/INFORMIXTMP/.infxdirs", O_RDONLY) = 5
open64("/usr/informix/7.31.UC2/etc", O_RDONLY|O_NDELAY) = 6
open64("/usr/informix/9.20.UC2/etc", O_RDONLY|O_NDELAY) = 6
open64("/usr/informix/9.21.UC1/etc", O_RDONLY|O_NDELAY) = 6
open("/INFORMIXTMP/.infxdirs", O_RDONLY) = 5
open("/usr/informix/7.31.UC2/etc/.conf.osiris_73", O_RDONLY) = 6
open("/usr/informix/9.21.UC1/msg/en_us/0333/olutil.iem", O_RDONLY) = 4
open("/INFORMIXTMP/.infxdirs", O_RDONLY) = 5
open("/usr/informix/7.31.UC2/etc/.infos.anubis_73", O_RDONLY) = 6
open("/INFORMIXTMP/.infxdirs", O_RDONLY) = 5
open("/usr/informix/9.21.UC1/etc/.infos.anubis_53", O_RDONLY) = 6
Note that each of these succeeded; I didn't chase down what directory
entries were read, etc. Two of the three servers referenced were down.
Here's a script which could help.
#!/bin/ksh
# rudy 29/8/97.
# This script attempts to locate INFORMIX instances running on a machine.
# The plan is as follows
# 1. Locate INFORMIXDIR by identifying the file oninit and working
backwords
# 2. Locate ONCONFIG files by grepping $INFORMIXDIR/etc for keyword
"ROOTNAME"
# 3. Set environment variable appropriately for each INFORMIXDIR &
ONCONFIG
# and run onstat -c to get the instance information.
if [ $# = 0 ]
then
echo Run `basename $0` with a directory. All subdirectories below will
be searched
echo For example : `basename $0` /opt
exit 1
fi
SEARCHDIR=$1
SUFFIX=$$
CURRENTDIR=`pwd`
echo Locating Informix software versions in $SEARCHDIR and its
subdirectories...
for INFORMIXDIR in `find $SEARCHDIR -name oninit -print 2>/dev/null | sed
"s:\\(.*\\)\\(\\/bin.*\\):\\1:g"`
do
echo Found software in $INFORMIXDIR
cd $INFORMIXDIR/etc
for ONCONFIG in `grep -l "^ROOTNAME" *`
do
echo Examining Server configured in $ONCONFIG
INFORMIXSERVER=`grep DBSERVERNAME $ONCONFIG | grep -v "^#" | awk'{print $2'}`
echo INFORMIXDIR=$INFORMIXDIR ONCONFIG=$ONCONFIG
INFORMIXSERVER=$INFORMIXSERVER \\ > $CURRENTDIR/$ONCONFIG.$SUFFIX
export INFORMIXDIR ONCONFIG INFORMIXSERVER
onstat -c >> $CURRENTDIR/$ONCONFIG.$SUFFIX done
echo Output in files with suffix of $SUFFIX
SUFFIX=`expr $SUFFIX + 1`
done
#### End #####
Couple of drawbacks :
1. Can be slow if you have no clue on where your software resides.
2. Can give you duplicate information if "old" or "backup" onconfig files
are floating around in $INFORMIXDIR/etc.
Rudy
c-eriks@algonet.se wrote:
> Is there a way to query the DBMS which informix servers (instanses) are
> configured in the server machine? One (work around) solution would be
> to search the informix user's .profile with "grep" for 'INFORMIXSERVER'
> and then test with "onstat -". Any other (more direct) solutions?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Jonathan Leffler wrote:
> c-eriks@algonet.se wrote:
> > Is there a way to query the DBMS which informix servers (instanses) are
> > configured in the server machine? One (work around) solution would be
> > to search the informix user's .profile with "grep" for 'INFORMIXSERVER'
> > and then test with "onstat -". Any other (more direct) solutions?
>
> /INFORMIXTMP contains some of the information (assuming you're using 7.x
> or later versions of Informix). I'm not sure how to interpret the files
> in there, but I'm pretty sure that's what 'onstat -g dis' does, and I'm
> mortified to find that this option is still not documented when you get
> a usage message from onstat even though it was covered in this news
> group
> in July 1999. I also note that you get different results from the
> command
> depending on whether you run as root (or informix) or as some lesser
> mortal.
Hi,
Strange : I noticed that one of my instances was listed twice : first time
up, then down :
Server : webobjects_p_shm
Server Number : 3
Server Type : IDS
Server Status : Up
Server Version: Informix Dynamic Server 2000 Version 9.20.UC2
Shared Memory : 0xa000000
INFORMIXDIR : /opt/informix/informix-9.20.UC2
ONCONFIG : /opt/informix/informix-9.20.UC2/etc/onconfig.webobjects_prod
SQLHOSTS : /opt/informix/informix-9.20.UC2/etc/sqlhosts.webobjects_prod
Server : webobject_p_shm
Server Number : 3
Server Type : IDS
Server Status : Down
Server Version: Informix Dynamic Server 2000 Version 9.20.UC2
Shared Memory : 0xa000000
INFORMIXDIR : /opt/informix/informix-9.20.UC2
ONCONFIG : /opt/informix/informix-9.20.UC2/etc/onconfig.webobject_prod
SQLHOSTS : /opt/informix/informix-9.20.UC2/etc/sqlhosts.webobject_prod
should I contact the support ? They'll told me this is a special fuction of
onstat not made for us, just for debug.. ?
Am I right ?
:)
--
_______________________________________________
Sebastien THOMAS none networks
System Engineer freesbee
geo:153, rue Saint-Denis, 75002 Paris, France
vox:+33 1 45 08 23 10 - fax:+33 1 45 08 25 29
mailto:sebastien.thomas@none.net
These are two different instances because the onconfig file is different
in each case. One says "webobject" and the other says "webobjects".
Sebastien THOMAS wrote:
>
> Jonathan Leffler wrote:
>
> > c-eriks@algonet.se wrote:
> > > Is there a way to query the DBMS which informix servers (instanses) are
> > > configured in the server machine? One (work around) solution would be
> > > to search the informix user's .profile with "grep" for 'INFORMIXSERVER'
> > > and then test with "onstat -". Any other (more direct) solutions?
> >
> > /INFORMIXTMP contains some of the information (assuming you're using 7.x
> > or later versions of Informix). I'm not sure how to interpret the files
> > in there, but I'm pretty sure that's what 'onstat -g dis' does, and I'm
> > mortified to find that this option is still not documented when you get
> > a usage message from onstat even though it was covered in this news
> > group
> > in July 1999. I also note that you get different results from the
> > command
> > depending on whether you run as root (or informix) or as some lesser
>
> > mortal.
>
> Hi,
>
> Strange : I noticed that one of my instances was listed twice : first time
> up, then down :
>
> Server : webobjects_p_shm
> Server Number : 3
> Server Type : IDS
> Server Status : Up
> Server Version: Informix Dynamic Server 2000 Version 9.20.UC2
> Shared Memory : 0xa000000
> INFORMIXDIR : /opt/informix/informix-9.20.UC2
> ONCONFIG : /opt/informix/informix-9.20.UC2/etc/onconfig.webobjects_prod
>
> SQLHOSTS : /opt/informix/informix-9.20.UC2/etc/sqlhosts.webobjects_prod
>
> Server : webobject_p_shm
> Server Number : 3
> Server Type : IDS
> Server Status : Down
> Server Version: Informix Dynamic Server 2000 Version 9.20.UC2
> Shared Memory : 0xa000000
> INFORMIXDIR : /opt/informix/informix-9.20.UC2
> ONCONFIG : /opt/informix/informix-9.20.UC2/etc/onconfig.webobject_prod
> SQLHOSTS : /opt/informix/informix-9.20.UC2/etc/sqlhosts.webobject_prod
>
> should I contact the support ? They'll told me this is a special fuction of
> onstat not made for us, just for debug.. ?
> Am I right ?
> :)
>
> --
> _______________________________________________
> Sebastien THOMAS none networks
> System Engineer freesbee
>
> geo:153, rue Saint-Denis, 75002 Paris, France
> vox:+33 1 45 08 23 10 - fax:+33 1 45 08 25 29
> mailto:sebastien.thomas@none.net
Related threads
- Posting from the Informix-list
- Migrating from IDS 9.40.UC6 to 11.50.UC3
- Ip for a network session
- questions onstat -g