Unix Technical Forum

allowing a user to kill his own connections

This is a discussion on allowing a user to kill his own connections within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I would like to allow developers to kill their own sessions, e.g. alter system kill session '$sid,$serial#' but only ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-07-2008, 11:16 AM
mh@pixar.com
 
Posts: n/a
Default allowing a user to kill his own connections

I would like to allow developers to kill their own sessions, e.g.

alter system kill session '$sid,$serial#'

but only for sessions which are theirs.

Is there a grant which can handle this? If not, what's the
best way to handle this?

TIA!
Mark

--
Mark Harrison
Pixar Animation Studios
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-07-2008, 11:16 AM
Ana C. Dent
 
Posts: n/a
Default Re: allowing a user to kill his own connections

mh@pixar.com wrote in news:NsKTj.1754$ah4.1745@flpi148.ffdc.sbc.com:

> I would like to allow developers to kill their own sessions, e.g.
>
> alter system kill session '$sid,$serial#'
>
> but only for sessions which are theirs.
>
> Is there a grant which can handle this? If not, what's the
> best way to handle this?
>


You can write a procedure owned by SYS which can issue the ALTER SYSTEM;
using owner's rights not invoker's rights.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-07-2008, 11:16 AM
fitzjarrell@cox.net
 
Posts: n/a
Default Re: allowing a user to kill his own connections

On May 5, 3:53*pm, m...@pixar.com wrote:
> I would like to allow developers to kill their own sessions, e.g.
>
> * * alter system kill session '$sid,$serial#'
>
> but only for sessions which are theirs.
>
> Is there a grant which can handle this? *If not, what's the
> best way to handle this?
>
> TIA!
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios


I agree with the stored procedure route, as that's the only way you
could restrict the action to sessions associated with the invoking
user.


David Fitzjarrell
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-07-2008, 11:16 AM
Mark D Powell
 
Posts: n/a
Default Re: allowing a user to kill his own connections

On May 5, 11:00*pm, "Ana C. Dent" <anaced...@hotmail.com> wrote:
> m...@pixar.com wrote innews:NsKTj.1754$ah4.1745@flpi148.ffdc.sbc.com:
>
> > I would like to allow developers to kill their own sessions, e.g.

>
> > * * alter system kill session '$sid,$serial#'

>
> > but only for sessions which are theirs.

>
> > Is there a grant which can handle this? *If not, what's the
> > best way to handle this?

>
> You can write a procedure owned by SYS which can issue the ALTER SYSTEM;
> using owner's rights not invoker's rights.


I also agree with the stored procedure route; however, the owner does
not need to be SYS and probably should not be SYS. I created a DBA
privileged account to own special purpose routines like this. Using a
non-SYS owner makes keeping track of the special purpose routines,
database event triggers, and like easier.

IMHO -- Mark D Powell --


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-07-2008, 11:16 AM
mh@pixar.com
 
Posts: n/a
Default Re: allowing a user to kill his own connections

Ana C. Dent <anacedent@hotmail.com> wrote:
> mh@pixar.com wrote in news:NsKTj.1754$ah4.1745@flpi148.ffdc.sbc.com:
>
> > I would like to allow developers to kill their own sessions, e.g.
> >
> > alter system kill session '$sid,$serial#'
> >
> > but only for sessions which are theirs.
> >
> > Is there a grant which can handle this? If not, what's the
> > best way to handle this?
> >

>
> You can write a procedure owned by SYS which can issue the ALTER SYSTEM;
> using owner's rights not invoker's rights.


And if I want to make sure that you can't kill someone else's
session, that should be handled by comparing the current
user with the user of the $sid, is that right?

In other words, there's not an automatic ownership/protection
mechanism a la unix processes and kill.

Thanks All!
Mark

--
Mark Harrison
Pixar Animation Studios
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-07-2008, 07:20 PM
fitzjarrell@cox.net
 
Posts: n/a
Default Re: allowing a user to kill his own connections

On May 6, 11:55*pm, m...@pixar.com wrote:
> Ana C. Dent <anaced...@hotmail.com> wrote:
>
> > m...@pixar.com wrote innews:NsKTj.1754$ah4.1745@flpi148.ffdc.sbc.com:

>
> > > I would like to allow developers to kill their own sessions, e.g.

>
> > > * * alter system kill session '$sid,$serial#'

>
> > > but only for sessions which are theirs.

>
> > > Is there a grant which can handle this? *If not, what's the
> > > best way to handle this?

>
> > You can write a procedure owned by SYS which can issue the ALTER SYSTEM;
> > using owner's rights not invoker's rights.

>
> And if I want to make sure that you can't kill someone else's
> session, that should be handled by comparing the current
> user with the user of the $sid, is that right?
>
> In other words, there's not an automatic ownership/protection
> mechanism a la unix processes and kill.
>
> Thanks All!
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios


You are correct.


David Fitzjarrell
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-07-2008, 07:20 PM
Mark D Powell
 
Posts: n/a
Default Re: allowing a user to kill his own connections

On May 7, 12:55*am, m...@pixar.com wrote:
> Ana C. Dent <anaced...@hotmail.com> wrote:
>
> > m...@pixar.com wrote innews:NsKTj.1754$ah4.1745@flpi148.ffdc.sbc.com:

>
> > > I would like to allow developers to kill their own sessions, e.g.

>
> > > * * alter system kill session '$sid,$serial#'

>
> > > but only for sessions which are theirs.

>
> > > Is there a grant which can handle this? *If not, what's the
> > > best way to handle this?

>
> > You can write a procedure owned by SYS which can issue the ALTER SYSTEM;
> > using owner's rights not invoker's rights.

>
> And if I want to make sure that you can't kill someone else's
> session, that should be handled by comparing the current
> user with the user of the $sid, is that right?
>
> In other words, there's not an automatic ownership/protection
> mechanism a la unix processes and kill.
>
> Thanks All!
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios


You want to build in as many safeguards or features as necessary for
your environment. Besides allowing users with unique Oracle usernames
to kill sessions that he or she owns you might in the case of a shared
Oracle username be able to key off of v$session.osuser as an example.
Or maybe like us you have an application where distributers enter
information and can if the task is not completed hold a lock for
hours. If production batch is waiting on the non-existent user you
might approve the kill based on the time since the session last issued
an SQL statement and the v$session.program being executed then log the
action.

Requirements for what you want to allow and for keeping a history of
who killed who will vary by sites.

This same technique is also good for allowing userA to truncate userB
objects. But if you are going to allow truncate it is probably wise
to require OK to truncate tables to be input into a table that records
this fact and check against it least someone truncate a table that
should not be truncated.

HTH -- Mark D Powell --


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:12 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com