Home » SQL & PL/SQL » SQL & PL/SQL » Killing a user session
Killing a user session [message #82] Fri, 11 January 2002 04:54 Go to next message
James Briar
Messages: 72
Registered: January 2002
Location: Morden (South London)
Member
To kill a user session i can use :-

alter system kill session '7,140';

But how do i amend the above alter command to use Bind variables that hold the values 7 and 140 instead of actually putting in 7 and 140 (assuming you can do this).

For example i've two Bind variables called b_sid and b_serial and these are set to 7 and 140 and one of the things i've tried is :-

alter system kill session 'b_sid, b_serial';

But this fails with invalid values.

We're running Oracle 8i on solaris 8.
Re: Killing a user session [message #96 is a reply to message #82] Mon, 14 January 2002 00:22 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
Hi,

Try

alter system kill session '&b_sid, &b_serial'

cheers
pratap
Re: Killing a user session [message #122 is a reply to message #82] Tue, 15 January 2002 13:26 Go to previous message
James Briar
Messages: 72
Registered: January 2002
Location: Morden (South London)
Member
Hello Pratap,
I tried what you suggested but this prompted me for the values. I've tried many things like using a colon instead of an ampersand, leaving out the quotes and other things, but no luck.
I've now got around the problem by amending my unix script to do :-

cat > /tmp/killuser <<
alter system kill session '$sid_serial';
EOF
su - oracle "ORACLE_SID=train;export $ORACLE_SID; /
sqlplus '/ as sysdba' < /tmp/killuser"

Where $sid_serial equals say "7,140" and is obtained by running similar statements that query the v$session view and copy the sid and serial values to this unix variable.

Thanks.
Previous Topic: SQL-Statement too long?
Next Topic: How I get the Tables' source
Goto Forum:
  


Current Time: Thu Aug 13 07:21:09 CDT 2020