I am attempting to write a kill session script that I can launch from
a DOS-type batch file. Everything is working except one part.
The script begins by doing a:
select * from dba_blockers;
Then:
select sid,serial#,username,osuser,machine
from v$session
where sid IN (select holding_session from dba_blockers);
That all works fine. Then I'm trying to do:
alter system kill session 'xxx,xxxxx' <-- I am trying to have a query
pass the results here such as:
select sid,serial#
from v$session
where sid IN (select holding_session from dba_blockers);
just like the above query. I can't figure out how to pass this as an
argument to the "alter system kill session 'foo,blah'" command,
however. Anybody know how to pass the sid and serial# results to that
command? And they have to be in the correct syntax: '123,45678'
This would more or less just show me the user holding the blocking
lock, and then automatically kill it. I thought I might have it
prompt me for the SERIAL#, or OSUSER, or something though, just to
make sure I don't kill something inadvertently.
If anybody can help I would greatly appreciate it. I've been pulling
my hair out all day over this, and I didn't have much to start with.
:)