Skip to Main Content
  • Questions
  • Historical list of sessions killed for crossing idle time threshold.

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Jaja.

Asked: August 05, 2021 - 8:00 pm UTC

Last updated: August 09, 2021 - 5:44 am UTC

Version: 12.2.0.1

Viewed 10K+ times! This question is

You Asked

Hello Tom,

Thank you for this forum which helps solve our issues or point us in the right direction towards resolution and generally gives us a better understanding of what we are doing.
My database version is Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production on Linux 7.
The resource_limit parameter is set to true and the default profile's idle time is set to 30 minutes. This works as expected for users assigned the default profile.
My question is, how do I get a historical list with details of only those sessions that got killed because they exceeded the 30 minute idle time threshold?

Thank you in advance!

and Connor said...

I don't think we capture it natively, but with a little auditing and the alert log you could get some information, eg

--
-- First I ran this, which is good to have on *any* database to known when anyone logs on or off
--
SQL> audit session;

Audit succeeded.

--
-- then here's the demo
--
SQL> create profile demo_timeout limit idle_time 5;

Profile created.

SQL> alter user demo profile demo_timeout;

User altered.

SQL> conn demo/demo@db19_pdb1
Connected.
SQL> select * from dual;

D
-
X

SQL> select * from dual;
select * from dual
*
ERROR at line 1:
ORA-02396: exceeded maximum idle time, please connect again


In the alert log we have this when the session is killed (this may vary by platform and version)

(3):KILL SESSION for sid=(369, 52122):
(3):  Reason = profile limit idle_time
(3):  Mode = KILL SOFT -/-/NO_REPLAY
(3):  Requestor = PMON (orapid = 2, ospid = 2400, inst = 1)
(3):  Owner = Process: USER (orapid = 27, ospid = 17916)
(3):  Result = ORA-0


So I can use that information to track back into the audit trail

SQL> select username, userhost, os_process
  2  from dba_audit_trail
  3  where timestamp > sysdate - 1
  4  and os_process like '%17916%';

USERNAME             USERHOST                       OS_PROCESS
-------------------- ------------------------------ --------------
DEMO                 WORKGROUP\GTX                  5920:17916




Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Jaja, August 06, 2021 - 1:59 pm UTC

Thank you Connor! This solves my problem.
Connor McDonald
August 09, 2021 - 5:44 am UTC

glad we could help

More to Explore

Security

All of the vital components for a secure database are covered in the Security guide.