Re: Q: What instances have I?
Posted in 1997
In article <860693229.16150@dejanews.com>, science@raptor.cqi.com wrote:
>How does one find information about various instances that exist on one's
>machine? Specifically, say you go up to a new (to you) machine and want
>to answer the question, "What are my instances, and what are their
>configurations?" I'm having a little problem with this.
>
>For example, one can set the INFORMIXSERVER variable, then run "onstat
>-c", but if the ONCONFIG variable is not set, it always gives the contents
>of $INFORMIXDIR/etc/onconfig. If you set the ONCONFIG variable to
>something that does not correspond to the true configuration file
>associated with the INFORMIXSERVER setting, onstat will duly give you the
>information associated with the ONCONFIG setting. And one can't rely on
>using, say, "grep '^DBSERVERNAME' $INFORMIXDIR/etc/* | grep
>$INFORMIXSERVER" because several files like this might exist in that
>directory.
>
>Also, the instance files in $INFORMIXDIR/etc/.infos.* don't appear to be
>guaranteed accurate, either. These could be wiped out (the DBA Guide,
>vol. 2 tells how to regenerate *one* for a given INFORMIXSERVER), and the
>documentation also says that when an instance is taken offline, this file
>is removed.
>
Hi Charlie,
To get a list of instances on the server, you can, as suggested by
Peter, use information in the $INFORMIXDIR/etc/sqlhosts file. The
following script will give you a list of instances and indicate
which ones are on-line.
:
for SERVER in `cat $INFORMIXDIR/etc/sqlhosts | grep -v '^#' | \\
awk '{print $1}'`
do
INFORMIXSERVER=3D$SERVER export INFORMIXSERVER
STATUS=3D`onstat -p | sed -n '2p' | cut -b 39-45`
echo $SERVER $STATUS
done
It still doesn't tell you the configuration of the instance, but
there's hope yet. In the script above, if you remove the 2 lines
related to STATUS and replace them by a single line as below
onmonitor
you end up running onmonitor (obviously!). If you now use the
configuration option to output the SERVER's configuration to
a file, you get=20
-----------------------
Rudy Fernandes
GIC, Kuwait
OL 7.20UC4, 4GL 6.04UC1
-----------------------