Re: Need of kill query
Posted in 1998
Hi,
how about the following query:
"select username, sqx_sessionid, sqx_conbno,
sysdatabases.name database
from syssqexplain , sysscblst, sysdatabases
where sqx_sessionid=sid
and sysdatabases.name='${DATABASENAME}'
AND sqx_sqlstatement[1,6] IN ( "select", "create" )
---------------------------------------------------
{ or in this way:
AND ( trim(sqx_sqlstatement) matches "select*" OR
trim(sqx_sqlstatement) matches "create*" )
}
---------------------------------------------------
order by 2, 3"
Bye
Stefan Weideneder
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.
>
> Thanks a ton!!!
>
> Sanjeev
> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com