Re: Is there a trigger on session end?

From: DA Morgan <damorgan_at_psoug.org>
Date: Sun, 02 Mar 2008 10:44:17 -0800
Message-ID: <1204483450.602692@bubbleator.drizzle.com>


Peter Teoh wrote:
> On Feb 29, 4:08 pm, DA Morgan <damor..._at_psoug.org> wrote:

>> dean wrote:
>>> 10g / Win
>>> I have a trigger that calls a procedure when a user logs off session:
>>> create or replace trigger LoggedOff
>>> before logoff on database
>>> call procLoggedOff
>>> /
>>> But this trigger is not called if my session ends unexpectedly - a
>>> crash or if the app is killed by some means (simple crash, compiler
>>> reset, CTRL-ALT_DEL, etc).
>>> Is there a way to get Oracle to call a procedure when it determines
>>> that a session has been killed or otherwise has died?
>>> Thanks in advance for any advice.
>> You can create a SYSTEM EVENT trigger to fire on AFTER SERVERERROR.
>>
>> Should work for what you want.
>> --

> Referring to this page:
>
> http://www.psoug.org/reference/system_trigger.html
>
> I saw:
>
> AFTER SERVERERROR (does not trap ...
>
> * ORA-01403: no data found (this is in the Oracle docs but does
> not seem to be correct)
> * ORA-01422: exact fetch returns more than requested number of
> rows
> * ORA-01423: error encountered while checking for extra rows in
> exact fetch
> * ORA-01034: ORACLE not available
> * ORA-04030: out of process memory when trying to allocate string
> bytes (string, string)
>
> So u may have to take note that certain class of errors cannot be
> captured. Or is my interpretation wrong?
>
> Thanks.

Your interpretation is correct. But the errors not trapped are likely irrelevant to the OP's stated usage. For example ORA-01034 would hardly be an issue.

-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Sun Mar 02 2008 - 12:44:17 CST

Original text of this message