Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Naming one's hostname for sp_who
Date: Oct 9 2001 4:51PM
David LANDGREN writes:
> |kiruna (8:56AM):1 > perl -MSybase::DBlib -e 'my $dbh = new Sybase::DBlib
> |"sa"; sleep(100);'
> |(yeah - I've still got the null sa password :-) and I get:
> Hmm. And I thought I was the only one :)
> |So this sets it correctly for me.
> |Maybe your gethostname() (or whatever) call doesn't work right?
> | > Rats. I cleared the source of the machine a few weeks ago. I'll
> download it
> | > again and tell you how it went.
> Our mails crossed. I think gethostname() is working ok. I running this code
> from the same server that Sybase is running on, so it's normal that it
> returns the name of the server.
> However, I have lots of different scripts that tend to eat CPU when we're
> not watching, so I need to be able to differentiate between them.
> This was easy to do with the older scripts that are dreadful shell hacks
> that talk to isql, because I was able to override the hostname column with
> the -H flag of isql, which makes it possible to identify them. I would like
> to emulate doing that via the more recent scripts that use Sybase::DBlib to
The DBSETLHOST() patch will do that. You can also use the appname bit
(although that doesn't show in sp_who, it does show in sp__who, and
you can of course query master..sysprocesses directly and get the
BTW - I use the following query to list "active" connections:
object_name(id, dbid) procname,
where spid != @@spid
and status != 'recv sleep'
and cmd not like '%HANDLER'
and cmd not like 'DEADLOCK%'
and cmd not like 'CHECKPOINT%'
and cmd != 'HOUSEKEEPER'
I've put that in a cgi script that reloads every X seconds, works
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
firstname.lastname@example.org - email@example.com
International Sybase User Group - http://www.isug.com