Skip to Main Content
  • Questions
  • How Can i get the peak concurrent session

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: March 10, 2003 - 8:43 am UTC

Last updated: November 09, 2020 - 3:36 am UTC

Version: 8.1.5

Viewed 10K+ times! This question is

You Asked

Tom:

I want to get the maximun number of concurrent sessions during a week. Which is the best(easier) way to do it.

Regards
Pablo


and Tom said...

select * From v$license;

session_highwater will tell you that.

Rating

  (7 ratings)

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

Comments

session_highwater

Mark A. Williams, March 10, 2003 - 9:48 am UTC

Since session_highwater is the max. sessions since the instance *started*, you'll want to make sure to do an unattended shutdown every Sunday night to reset the start time, and that way you'll get weekly data. That was not serious, of course. :) However, that is a caveat - you're looking at data since the instance started.

v$license is documented here: </code> http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch393.htm#1116791 <code>



Tom Kyte
March 10, 2003 - 9:57 am UTC

ahh -- good point -- don't shutdown though but you are right, it is since the instance is up.

A reader, March 10, 2003 - 9:54 am UTC

Ok, but the problem is that we run cold backup every night, i know that is not ok do cold backup every day, but anyway i think that the v$license values will reset every time we shutdown the database,Won't they?. What we want to obtain is a meassure of concurrent license we'll need to buy. Do we have to pay for all concurrent session or only for the concurrent "ACTIVE" session?

Thanks in Advance

Tom Kyte
March 10, 2003 - 9:58 am UTC

you'll have to snapshot this view every night then.

shutting down is horrible.


You'll have to talk to your sales guy about licensing issues. normally it is by the CPU.

Not shutting down...

Mark A. Williams, March 10, 2003 - 2:39 pm UTC

I was being tongue in cheek about the shutting down. That's why I had hidden in there "That was not serious, of course. :)" I know you love unattended shutdowns about as much as not using bind variables...

- Mark

Another way

Mike Madland, March 10, 2003 - 8:19 pm UTC

Here's another way to do it that will give you concurrent users based on the time of logon/logoff (if logged on for at least a minute):

SQL> audit session;

Audit succeeded.

... wait for a week ...

SQL> define week_start=2003-03-09
SQL>
SQL> create table week_minutes (clock date primary key)
  2  organization index
  3  /

Table created.

SQL> begin
  2     for i in 1..10080 loop
  3         insert into week_minutes (clock)
  4         values (to_date('&week_start','yyyy-mm-dd') + (i * (1/(24*60))));
  5     end loop;
  6  end;
  7  /

PL/SQL procedure successfully completed.

SQL>
SQL> SELECT max(concurrent_users)
  2    FROM (select clock, COUNT(*) concurrent_users
  3            FROM dba_audit_session, week_minutes
  4           WHERE clock between TIMESTAMP and logoff_time
  5             AND timestamp between to_date('&week_start','yyyy-mm-dd')
  6             and to_date('&week_start','yyyy-mm-dd') + 7 - (1/(24*60*60))
  7             and logoff_time - timestamp > (1/(24*60))
  8           GROUP BY clock)
  9  /

MAX(CONCURRENT_USERS)
---------------------
                   17
 

Concurrent licenses

John, December 29, 2003 - 4:51 pm UTC

Is the session_highwater actually concurrent users or just the maximum number of users that logged into the database at different times?

Tom Kyte
December 29, 2003 - 5:58 pm UTC

its the highwater for concurrent sessions -- they might all have been "idle" -- that is by definition "concurrent users"...

One more way of knowing HWM of sessions after instance shutdown

Manish Upadhyay, December 30, 2003 - 11:06 am UTC

When you shutdown the oracle database, Alertlog is written with the HWM session information.The entry look like this.

"License high water mark = 455"

So you can find out "HWM for sessions" even after the instance shutdown as long as you have alertlog for that instance.

Max concurrent Session per User from AWR

malesh, November 06, 2020 - 12:39 pm UTC

How can we find Max concurrent Session per USER from AWR history as trend or any other view , pls suggest?
Connor McDonald
November 09, 2020 - 3:36 am UTC

I don't you'll get it from there, but I would look at auditing

Look at a simple

'audit session'

command and you'll catch every logon / logoff time for each user in the database.