Q: number concurrent sessions by hours in a specified interval

Hello

I have this table that contains the SESSIONID, CREATEDATE, LASTCHECKDATE, EXPIREDATE PARTNERID

We make a query that returns the number of max session competitor hours time for the specified interval.

For example, last week, on a per hour basis or bases the top competitor for each hour or day session day, according to the report.

can make the number of new session every hour with this request;

SELECT TO_CHAR (createdate, ' DD/MM/YYYY HH24') | ' h ' value of start_time, COUNT (SESSIONID) new_sessions name, | ' {' | partnerid |} '}' as a partner
To uws
WHERE expiredate IS NOT NULL
and partnerid = 25
and TO_CHAR(createdate,'YYYY/MM') = ' 2010/05 '
TO_CHAR Group (createdate, ' DD/MM/YYYY HH24') | ' h ', name | ' {' | partnerid |} '}'
ORDER BY 1 DESC;

I think I should use MAX (count (sessionid)) and probably some DECODE when c1 between createdate and lastcheckdate...

This aspect will have to run it on sqlplus from a script shell if possible and same graph on Google maps.

The help is appreciated, please note that I'm not an expert of the Oracle...

Published by: user11954725 on July 19, 2010 17:55

Hello

user11954725 wrote:
Thanks Frank,.

I think we are very close to the solution, I'm looking for now.

Here's the script you gave me (with few changes) and exit;

WITH all_hrs AS
(
SELECT min_hr + ((LEVEL-1) / 24) AS the period
, min_hr + (LEVEL / 24) AS next_period
DE)
SELECT TRUNC (MIN (createdate), 'HH') AS min_hr
, TRUNC (MAX (LASTHEARTBEATDATE), 'HH') AS max_hr

You may have noticed that this site normally compresses white space. When you post the text formatted (including the code or output) on this site, type the 6 characters:

\

(small letters only, inside curly brackets) before and after each formatted section, to preserve the spacing.


produce output;

Period SESSIONS
------------------------- ----------------------
19-APR-10 15
19-APR-10 12
19-APR-10 15
...
12-MAY-10 28
569 rows selected

This is very confusing for several reasons:
(a) it's not formatted.  Use \

tags, as mentioned above.
(b) you're not showing all the significant data. If you're GROUPing BY a date, TRUNCated to the hour, then the hour is significant, and you should show the hour, not just the year, month and day. Use the TO_CHAR function to include the hour in the display for this column, or ALTER SESSSION SET NLS_DATE_FORMAT ... to change the default display for all DATEs.
(c) There's much too much output, even with parts of it cut out. Devise some smaller sample that shows the problem.

Now the output seem to produce the concurrent sessions as needed but the date range show is not exactly.
I expect the output to display only for the range specified in parameter, which if for this example only one day.

The in-line view in all_hours generates min_hr and max_hr.
If you want min_hr to be parameters that are not derived from data in your table, then you can select them from dual.
That is, instead of:

 ...     FROM     (
                SELECT  TRUNC (MIN (createdate),    'HH')     AS min_hr
                ,     TRUNC (MAX (LASTHEARTBEATDATE), 'HH')     AS max_hr
                FROM     userwebsession
       where createdate <= TO_DATE('07-MAY-2010 00.00.00','DD-MON-RR HH24.MI.SS')
         and LASTHEARTBEATDATE >= TO_DATE('07-MAY-2010 23.59.59','DD-MON-RR HH24.MI.SS')
           )

You can tell

...      FROM     (
                SELECT  TO_DATE ( '07-May-2010 00'
                         , 'DD-Mon-YYYY HH24'
                         )               AS min_hr
                ,       TO_DATE ( '07-May-2010 23'
                               , 'DD-Mon-YYYY HH24'
                         )               AS max_hr
                FROM     dual
           )

Probably, if we ask a few more days, we would like to display the MAX number of simultaneous session for a day and (optional) average also for that day and that all the days of the period.

So, for example, based on the output above that level next report would be output as follows (for the period from 19 April 10 to 27 April 10;

19 APRIL 10 24
20 APRIL 10 14
21 APRIL 10 26...

Yes, it is possible. You can have a single query which truncates dates either at the time or day, and instead of

...      CONNECT BY     LEVEL <= 1 + (24 * (max_hr - min_hr)

use something like

...      CONNECT BY     LEVEL <= 1 + (periods_per_day * (max_hr - min_hr)

where periods_per_day is 24 or 1, to generate the exact number of lines of output you want.
Give a specific example if you want to help. D.F.
"Thanks to this data to sample...
I would like to pass these parameters:...
and get this result:...
but, with the same data, if I pass these parameters:...
so I want this output:... »
Once more, there not need a lot of data. Maybe 10 rows, dated between 22:00 one day and 03:00 on the following day, would give a good example of the hourly production so that every day.

user11954725 wrote:
I am now looking to do an export of the table for you to test with real data.

It would be better? expdmp? and download a zip to a site?

Or if you are good for now with this small sample?

Small data sets are the best. It is easier for you to post, easier for you to manually draw the expected results, easier for everyone to understand and verify.
Display instructions INSERT.

By looking at the output once again, if the TIME period would show in the output that would be great, so maybe I can use it as input to another query that could be summarized per day?

Use the function TO_CHAR or ALTER SESSION SET NLS_DATE_FORMAT registration time at the exit of the DATEs.
As I mentioned above, you have a query that produces either hourly output, like this

period               sessions
----------------     --------
07-May-2010 21:00      5
07-May-2010 22:00      1
07-May-2010 23:00      6

or daily output, like this:

period               sessions
----------------     --------
07-May-2010            12

According to a parameter.
You might also have a query which produces two output types at the same time:

period               sessions     daily_total
----------------     --------     -----------
07-May-2010 21:00      5
07-May-2010 22:00      1
07-May-2010 23:00      6          12

Give a clear example of what you want, and someone will help you get it.

Published by: Frank Kulash, July 21, 2010 09:35

Tags: Database

Similar Questions

  • Number of concurrent Sessions per user mismatch with profile settings

    Hello

    Version of DB Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    OS RHES 5U2

    I created a profile MYPROFILE and set the value of simultaneous (per user) Sessions on 30. DB has rebounded after the creation of the profile. I made this default profile for a specific user 'MYUSER '. I checked that questioning DBA_USERS (select profile from dba_users where username like "MYUSER") I checked v$ session with this particular user after awhile and noticed that it showed 34 sessions. Certain ASSETS and the INACTIVE.

    My question is, if I set the maximum number of concurrent sessions per user on 30 to myprofile and made it the default for MYUSER profile, so how did I am still able to see more than 34 sessions of myuser regardless of the State? I don't know if it's relevant or not, but the IDLE TIME is set to 15 minutes.

    Thank you for your help

    Published by: user560883 on July 4, 2010 12:45 AM

    user560883 wrote:
    Hello

    Version of DB Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    OS RHES 5U2

    I created a profile MYPROFILE and set the value of simultaneous (per user) Sessions on 30. DB has rebounded after the creation of the profile. I made this default profile for a specific user 'MYUSER '. I checked that questioning DBA_USERS (select profile from dba_users where username like "MYUSER" ;)) I checked v$ session with this particular user after awhile and noticed that it showed 34 sessions. Certain ASSETS and the INACTIVE.

    My question is, if I set the maximum number of concurrent sessions per user on 30 to myprofile and made it the default for MYUSER profile, so how did I am still able to see more than 34 sessions of myuser regardless of the State? I don't know if it's relevant or not, but the IDLE TIME is set to 15 minutes.

    Thank you for your help

    You have the parameter resource_limit = true ? You must do so before test sessions_per_user. You can do the following,

    alter system set resource_limit=true;
    

    After that, yet try and post comments.

    HTH
    Aman...

  • XNET: Y at - it a playback feature the number of sessions created?

    Hello

    I want to limit the number of sessions that can be created from a single port. Is there a limiting feature, or I can read the number of sessions created for the selected port.

    Used Board: CAN NI PCI-8512 / HS with two ports

    Thanks in advance for your help.

    Dear Matt

    Thanks for this tip. I changed the question in the automotive forum and embedded networks.

    Concerning

    Adrian

  • Calculation of the number of sessions of relaxation JTAPI

    Assumea Trigger 1111 5 sessions and the Group of call control, say 20 ports as well as the Application as the session 20.

    If the part of the script requests a call-redirect to another trigger 2222 - the number of sessions to 1111 will decrease by one after the call-forwarding? (Note that it does not call a subflow but a redirect to appeal to another trigger)

    Thank you!

    Yes, the number of sessions for 1111 decreases by one after the call forwarding.

  • I was on a chat with (deleted by the moderator), she offered a remote session helps and my frozen computer. Could you help me to reconnect with a file number of session 0187688932

    I was on a chat with (deleted by the moderator) with chat support online, she offered a remote session helps and my computer completely frose. How to reconnect with a file number of session 0187688932 or get any support?

    Hi Piotrr30412376,

    I recommend to start a new chat session with the team, to do so please click here Contact Customer Care

    Sign in with your ID (e-mail address utilized to purchase the product) Adobe - select them exact options below:

    Let us know if that helps.

  • largest number of sessions during a given time period

    How can I know the number of sessions on my server for a given time?

    I think I can use "select count (*) in the session $ v where username ="xyz"' every second. Can it be the case that a few sessions of opening and closing during the two consecutive tests?

    AWR or statspack snapshots have this information?

    Thank you
    View

    vuatsc wrote:
    How can I know the number of sessions on my server for a given time?

    I think I can use "select count (*) in the session $ v where username ="xyz"' every second. Can it be the case that a few sessions of opening and closing during the two consecutive tests?

    AWR or statspack snapshots have this information?

    Thank you
    View

    AUDIT SESSION CONNECT

  • Maximum number of sessions?

    Could someone tell me if there is a maximum number of sessions that can be active at any time and if what it is and if it is done by factors such as memory?

    It would be on a Windows Server 2008 64-bit, with 4gig of RAM

    Thank you

    Mark

    As I have shown, you can actually get by yourself. Suppose that you have 500 000 active sessions in memory, each with a load of 1000 bytes and 1 GB of memory available in the Virtual Machine Java. Then there will probably be some memory problems. Depends on the server, the Virtual Machine and your application.

    This method of estimation is just a rule of thumb. She makes the unrealistic assumption that the Virtual Machine is busy with session management. Once you take into account the requests memory from the server, the JVM and your application and the configuration of the memory type, it may be that only 1 to 5% of memory is available for sessions. Divide this amount by the average number of bytes in a session, to get an estimate for the maximum number of sessions.

  • unique identity or concurrent sessions

    Hi all


    advice please address my question, the seller ask us about our users who access the application server,.
    I know there is no sso and sso users, we currently have users to database accounts to authenticate users
    because I see all users under dba_users, but I not confuse what vender say (unique identity or concurrent sessions)?

    can you please gaide me in this issue?


    Thanks in advance.

    >
    advice please address my question, the seller ask us about our users who access the application server,.
    I know there is no sso and sso users, we currently have users to database accounts to authenticate users
    because I see all users under dba_users, but I not confuse what vender say (unique identity or concurrent sessions)?

    can you please gaide me in this issue?
    >
    It is not clear what you're asking.

    If an application server is used to connect to the DB this application server can connect everyone using the same username and password. Some applications have a SINGLE user in the database (for example myAppUser) and the application server connects all as MYAPPUSER.

    For applications the unique username that Oracle knows even is MYAPPUSER and there could be 1,000 or more concurrent sessions logged in as the same user. Oracle would have no knowledge of the actual user of the customer name; only the application server can have this information.

  • ORA-00018. Exceed the maximum number of sessions

    Hi all

    I have a windows Server 2003, oracle 10g release 2.
    connection of 300 users competitor.

    My SESSIONS parameter = 800
    My PROCESS parameter = 723.

    After 2 or 3 days, I got the following message when I try to connect.

    ORA-00018. Maximum number of sessions to exceed.

    even I have restart my server, I got this number sometimes.

    What is the problem? I'm really in a very bad situation, users can not connected.

    Thank you

    Please post output commands below:

    Select the value of the parameter $ v where name = "sessions";
    Select count (*) in the session of v$.
    Select * from v$ resource_limit;

    If you see the 3rd command output as equal values in all the columns then its correct and Oracle returned ORA-00018.

    Then, V$ SESSION is fake! It does not report all sessions really in use. If you look in V$ SESSION see text (with the help of V$ FIXED_VIEW_DEFINITION), you will see that V$ SESSION reports of the sessions USER and only BACKGROUND.

    But there is a 3rd type of session - a RECURSIVE session, which is used for recursive calls data dictionary as explained above. V$ SESSION does not display these.

    So what is the moral of this story?

    Oracle uses recursive sessions for recursive data dictionary operations
    These sessions are also taken from the array of objects in session state controlled by the session setting
    V$ SESSION shows no recursive sessions, but V$ RESOURCE_LIMIT told it the truth about the use of the session state object table
    If you hit the error ORA-00018, and then expand your table of parameters of sessions or configure your application to use fewer connections or sessions

    Note that Oracle 11.2 changed the automatic calculation of parameters of sessions and large number of session state objects is attributed to a number of default process.

    Source: http://tech.e2sn.com/oracle/oracle-internals-and-architecture/recursive-sessions-and-ora-00018-maximum-number-of-sessions-exceeded

    Concerning
    Girish Sharma

  • "number' in the format"hours. "

    Hello experts,

    I wonder, is it possible to make a calculation of conversion of number (ex. 6.68) in hh format (6 ":"0, 68 * 60": 00" "). I dropped with TRUNC or MOD.

    Thank you

    Hello

    If tnum is the number of hours, so 1.5 is 1 hour 30 minutes, then you can use:

    TO_CHAR(TRUNC(ROUND(TO_NUMBER(tnum) * 3600)/3600), 'fmTM9')
    ||':'||TO_CHAR(ABS(MOD(TRUNC(ROUND(TO_NUMBER(tnum) * 3600)/60),60)),'fm00')
    ||':'||TO_CHAR(ABS(MOD(ROUND(TO_NUMBER(tnum) * 3600),60)),'fm00') 
    

    Rod West

  • 200 concurrent sessions to a voicemail system

    Hello

    It is a call center where about 200 concurrent calls from PSTN leave messages in a voice mail box.

    The agents listen to messages and recall. Or a software can be written to read the caller id and deliver the caller ID to the agents.

    Are there Cisco products that can achieve this?

    Any information is appreciated.

    Best regards.

    By using the connection of the unit with HA.

    Sent by Cisco Support technique iPad App

  • WebLogic Web Server concurrent session of the monitor

    Hello

    I use 5.8 Hyperic to monitor Weblogic Server web user simultaneous sessions up to certain level and then if it reaches a threshold to trigger a workflow vCO. Up to now, I understand that Hyperic is not able to control the user's session.

    I wanted to know if this is possible, how can it be done.

    Need your help!

    Thank you

    BR,

    MG

    Hello

    "Active current sessions' supposed to be under WebApp Service.

  • To find a total number of sessions connected to the DMZ node database

    Hi Experts,

    We are in the process of verification and I need the detail on that data. Kindly help me to know how many sessions is connected to the DMZ node oracle database. Also let me know how can I get all the users connected to different node on a daily basis?

    Please let me know the sql for this query.

    Thank you

    Prabhat.

    Hello

    Select the machine, count (*) from v$ session group command of the machine by 2;

    Select count (1) 'no. DB Users", to_char(sysdate,'DD-MON-YYYY:HH24:MI:SS') sys_time from v$ session where username is NOT NULL;

    Kind regards

    Hafiz

  • Get concurrent sessions view administrator view programmatically

    Hello!

    For the purposes of the license, I want to programatically get the data from the table of its use under "Display Configuration"-> "Licenses and use of the product" in Administrator display.

    Is there a way? Preference by using PowerShell...?

    Thank you!

    Best regards, Blaz

    The view connection server check session Office user has every 5 minutes, and these statistics are used both to screen UI admin that you saw, but are also hunted in performance monitor (which in turn can be scratched by powershell). Run perfmon.msc and add the source of VMware View to see it in action, the first hit on google for powershell and pefmon told http://www.vistax64.com/powershell/156856-perfmon-powershell-query.html that would be the glue you need.

  • Convert a representative number 'working day' in hours

    I have a query that pulls in a column < Completion_Days > this working days as a value list that appears in the range between 0 and up to perhaps 10 or higher.
    What I need to do, is that digital to convert to a format of HH:MN:SS time.

    There are an other columns < Completion_Hours > and < Completion_Minutes > I also want to convert it to a time so format. Here is a sample of my data:

    SEQUENCE DAYS COMPLETION_HOURS COMPLETION_MINUTES
    1 0 0 15
    2 0 0 15
    3 1 0 0
    4 0 0 15
    5 0 0 15
    6 1 0 0
    7 0 0 15
    8 0 0 15
    9 0 4 0
    10 0 0 15
    11 0 4 0
    12 0 4 0
    with sample_table as (
                          select  2 Completion_Days,
                                  4 Completion_Hours,
                                  15 Completion_Minutes
                            from  dual union all
                          select  0 Completion_Days,
                                  4 Completion_Hours,
                                  5 Completion_Minutes
                            from  dual
                         )
    select  case
              when Completion_Days * 8 + Completion_Hours < 10 then '0'
            end || (Completion_Days * 8 + Completion_Hours) || ':' || to_char(Completion_Minutes,'FM00') || ':00' res
      from  sample_table
    /
    
    RES
    ------------
    20:15:00
    04:05:00
    
    SQL> 
    

    SY.

Maybe you are looking for