In article <6pb6bg$fab$1@news.xmission.com>, sanjeevsagar@rocketmail.com
(sanjeev sagar) wrote:
>
>
>
> Hey Guy's,
>
> I am in need of one kill query which should do the
> following
>
> KILL ALL SELECT QUERY CONNECTED TO A SPECIFIC
> DATABASE OF A SPECIFIC INSTANCE.
>
> i made one script which take instance and database
> name as a input positional parameter. The query which
> i ran inside the script is
>
> "select username, sqx_sessionid, sqx_conbno,
> sqx_sqlstatement,
> sysdatabases.name database
> from syssqexplain , sysscblst, sysdatabases
> where sqx_sessionid=sid
> and sysdatabases.name='${DATABASENAME}'
> order by 2, 3"
>
>
> This gives me full sql statement rather than giving
> me a type of sql statement like it shows in "onstat
> -g sql" output i.e the type of sql statement like
> SELECT or CREATE
>
> I am not able to get that info from sysmaster. if i
> can get that info then i can use my if clause to
> match the word 'SELECT' and use the onmode -z <sid>
> command.
>
> I would appreciate if someone can give me some help
> or give me another query for my script.
>
you could try something a long the lines of
for sesid in `onstat -g sql | egrep 'SELECT.*${DATABASE}' | awk
'{print$1}'`
do
onmode -z $sesiddone
It mightn't be perfect but you get the idea.
Paul Watson # I don't suffer from
WF Software Ltd. # stress, I'm just
Tel. (+44) 1436 674729 # a carrier
Fax. (+44) 1436 678693 #