Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Dropping Users That Are Currently Connected / Killing Sessions

Re: Dropping Users That Are Currently Connected / Killing Sessions

From: Joel Garry <joel-garry_at_home.com>
Date: 30 Jun 2004 17:20:32 -0700
Message-ID: <91884734.0406301620.7911cdeb@posting.google.com>


Lee <now_at_yjo.se> wrote in message news:<40e087f5_2_at_news3.es.net>...
> Hi there,
>
> I wonder if someone can me an idea of how to get around the following
> problem? I run regression tests each night using Junit/DbUnit, where
> each test drops the user, recreates the user, creates the schema,
> enables constraints, populated the tables, etc. I often use DBVisualizer
> to browse the tables, but often forget to disconnect before I go home.
> It seems that DBVisualizer doesn't have an auto-disconnect, so when the
> tests run, they all fails giving the message, ~"cannot drop user that is
> currently connected". It's no big deal to just disconnect every night,
> but silly me forget about 2 times a week.
>
> Can anyone direct me to some URLs, where it might give me an idea of how
> to disconnect a user / kill the session in a script?
>
> Many thanks in advance,
> Lee

Fairly indiscriminate, but easy to modify for local situations:

#!/bin/ksh
echo "Killing list:"

   ps -ef|grep oracle${ORACLE_SID}|grep -v grep | \ awk '{print "kill -9 "$2} ' >> $$kill_oracle_attaches

   ps -ef|grep oracle${ORACLE_SID}|grep -v grep echo "[End of list]"
if [ -f $$kill_oracle_attaches ]
then chmod +x $$kill_oracle_attaches

     ./$$kill_oracle_attaches
fi
rm $$*

jg

--
@home.com is bogus.
http://catless.ncl.ac.uk/Risks/23.43.html#subj4
Received on Wed Jun 30 2004 - 19:20:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US