开发者

calculating oracle users average session time [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

How to write a PL/SQL program to calculate and display the username 开发者_开发问答and average session time for all database users in oracle 11g ? kindly help


By default Oracle does not audit things like user access. There are built-in options, but they are switched off by default.

To enable Oracle's audit trail, we need to set the AUDIT_TRAIL parameter. Set it to DB to have records written to a table; this is more convenient for querying than an OS file (unless your grep is better than your SQL). Find out more.

To monitor user connections and disconnections, ask a DBA to issue the following statement:

AUDIT SESSION;

Then you can write your query off the DBA_AUDIT_SESSION view. Something like:

select USERNAME
       , avg(LOGOFF_TIME - TIMESTAMP)
from DBA_AUDIT_SESSION
group by USERNAME;

Note that this is on;y going to give you meaningful information if you have an application with Old Skool named user accounts. Web applications with connection pooling will all be audited as the same user, so you will need to write a bespoke logging tool.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜