Number of active connections to given time

I have this data:
WITH t AS
  (SELECT to_date('01/31/2013 08:31:00','MM/DD/YYYY HH24:MI:SS') logon_time,
    to_date('01/31/2013 08:39:00','MM/DD/YYYY HH24:MI:SS') logoff_time
  FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:31:00','MM/DD/YYYY HH24:MI:SS') logon_time,
    to_date('01/31/2013 08:33:00','MM/DD/YYYY HH24:MI:SS') logoff_time
  FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:32:00','MM/DD/YYYY HH24:MI:SS') logon_time,
    to_date('01/31/2013 08:32:00','MM/DD/YYYY HH24:MI:SS') logoff_time
  FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:32:00','MM/DD/YYYY HH24:MI:SS') logon_time,
    to_date('01/31/2013 08:34:00','MM/DD/YYYY HH24:MI:SS') logoff_time
  FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:39:00','MM/DD/YYYY HH24:MI:SS') logon_time,
    to_date('01/31/2013 08:41:00','MM/DD/YYYY HH24:MI:SS') logoff_time
  FROM dual
  ) ,
  u AS
  ( SELECT to_date('01/31/2013 08:31:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:32:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:33:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:34:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:35:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:36:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:37:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:38:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  UNION ALL
  SELECT to_date('01/31/2013 08:39:00','MM/DD/YYYY HH24:MI:SS') ztime FROM dual
  )
  SELECT * FROM t RIGHT JOIN u ON t.logon_time = u.ztime ORDER BY ztime;
And I would like to know how many connections are active for any given ztime. Pseudo-device code I thought was:
ztime, count where logon_time = ztime or ( logon_time < ztime and logoff_time >= ztime )
The results of the above might look like:
zTime               Logon_Count
01/31/2013 08:31:00 2
01/31/2013 08:32:00 4
01/31/2013 08:33:00 3
01/31/2013 08:34:00 2
01/31/2013 08:35:00 1
01/31/2013 08:36:00 1
01/31/2013 08:37:00 1
01/31/2013 08:38:00 1
01/31/2013 08:39:00 2

Try this...

WITH t AS
     (SELECT TO_DATE ('01/31/2013 08:31:00','MM/DD/YYYY HH24:MI:SS') logon_time,
             TO_DATE ('01/31/2013 08:39:00', 'MM/DD/YYYY HH24:MI:SS') logoff_time
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:31:00','MM/DD/YYYY HH24:MI:SS') logon_time,
             TO_DATE ('01/31/2013 08:33:00','MM/DD/YYYY HH24:MI:SS') logoff_time
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:32:00','MM/DD/YYYY HH24:MI:SS' ) logon_time,
             TO_DATE ('01/31/2013 08:32:00','MM/DD/YYYY HH24:MI:SS') logoff_time
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:32:00','MM/DD/YYYY HH24:MI:SS') logon_time,
             TO_DATE ('01/31/2013 08:34:00','MM/DD/YYYY HH24:MI:SS') logoff_time
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:39:00','MM/DD/YYYY HH24:MI:SS') logon_time,
             TO_DATE ('01/31/2013 08:41:00','MM/DD/YYYY HH24:MI:SS') logoff_time
        FROM DUAL),
     u AS
     (SELECT TO_DATE ('01/31/2013 08:31:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:32:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:33:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:34:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:35:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:36:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:37:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:38:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL
      UNION ALL
      SELECT TO_DATE ('01/31/2013 08:39:00', 'MM/DD/YYYY HH24:MI:SS') ztime
        FROM DUAL)
SELECT   u.ztime, COUNT (*) logon_count
    FROM t, u
   WHERE u.ztime BETWEEN logon_time AND logoff_time
GROUP BY u.ztime
ORDER BY u.ztime

Tags: Database

Similar Questions

  • 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

  • Active connection decreases do not when the application is closed

    Hello.

    High number of connections active and the current number of active connection in the pool of connections to data source in weblogic 10.3 decreases do not even when I connect from my ADF (disconnect) application. I put the maximum number of connections = 15. When the current number of active connection becomes 15 app gives exception "no resources found in connection pool please increase the size of the connection pool.

    can any body tell me what is this and the solution of the other before increasing the size of the connection pool?

    -Usman

    Hello

    Make sure also that the idle connection timeout is set to lower the value.

    Thank you

    Sharmela

  • Caluclating seconds a given time

    Hello world

    I would like to calculate the number of seconds since a given time. In my database, I have a field called web_time (varchar2 30), the data it looks like this

    "23: 53:25.

    I want to calculate the seconds of this time?

    Could someone pls help?

    my version of the database is 11.1.0.6

    Thanks in advance
    with Seconds as
    (
    select regexp_substr(time,'[^:]+',1,1)*60*60 S1,
           regexp_substr(time,'[^:]+',1,2)*60 S2,
           regexp_substr(time,'[^:]+',1,3) S3 from T
    )
    select S1+S2+S3 from seconds;
    
  • How can I limit the number of connections to my PC for an incoming connection at a time. Multiple users are connected to my computer via the network.

    original title: limit incoming connections

    I want to restrict the number of connections to my pc for an incoming connection at a time.  I have several users that connect to my computer, using the same user name & password.  If someone tries to open a session, they fall out of someone who is already connected, without notice. the only solution I can think of is to limit the number of incoming connections to one.

    Hi willard.

    Your question is more complex that most seem to be on the answers. I suggest that you re-post on our TechNetforums where computer professionals can help you.

    http://social.technet.Microsoft.com/forums/en-us/categories/

    I hope this helps.

  • A Wi - Fi and 3G connection active at the same time?

    Maybe this is a stupid question.  I noticed at work today, my WiFi and 3G are both active at the same time.  For all I know, the WiFi is working and not a false indication as I sometimes get at home.  In addition, my 3G indicator shows and seems to be moving a lot of data.

    As I have already noticed, I usually have one or the other, unless he is changing course, or WiFi is falling out or something.

    Any ideas on that?

    Thanks for the help.

    Mark

    It's normal.  3G is not turned off when WiFi is on.  Properly connected WiFi will increase your 3G but not a substitute. -Mark

  • Reset the number of activations on the SN given

    Hi all!
    I wonder if anyone here can answer me before getting assistance on the phone.
    So, recently, my laptop was stolen. I had a Windows 8.1 Pro pack upgrade here with a 2010 office upgraded to 2013 in respect of supply of limited at the launch of the latter.

    When I try to type the serial number of the Pro pack even on the new laptop (the chances are very good that even if one stolen is recovered the HARD drive will be formatted), it says something about the activation for the given SN being exceeded limit and refused to activate the copy, though install it correctly.

    So, is there any chance of getting guys to the millisecond to reset the activation on the pack Pro SN limit? And is it possible to do the same thing with the Office Suite?

    Thank you very much in advance!

    Activation of the phone will be your best course of action for Windows 8/Pro Pack and Office 2010 license.

    1. press the Windows key + X , and then clickrun, and then type: slui.exe 4


    2. then press the ENTER"" key.

    3. Select your "country" in the list.

    4. choose the option "activate phone".

    5. stay on the phone (do not select/press all options) and wait for a person to help you with the activation.

    6. explain your problem clearly to the support person.

    Microsoft Office Activation number:
    http://support.Microsoft.com/kb/950929

  • Activation/serial number work is not the second time

    I just got a new laptop because my old one died and when I went to put in my series number given with the program it wouldn't work, is it possible to get a new one or something? I have photoshop elements 8

    Help

    You must contact Adobe Support by chat or phone when you have the serial number and activation problems.

    Here are some links to help get in touch:

    http://www.Adobe.com/support/chat/ivrchat.html

    http://www.Adobe.com/support/download-install/supportinfo/

  • FSWM shows the active connections on the FWSM standby why?

    Does anyone know why the FWSM Eve shows 45581 active connections.

    Thank you very much

    Ian Vickery

    Standby

    XTRAK1-County of conn sho FWSM #.

    45581 in use

    Primary

    XTRAK1-County of conn sho FWSM #.

    158080 in use

    Unit of primary failover

    Ha failover LAN interface

    Frequency of survey 10 seconds

    failover replication http

    This host: primary: enabled

    Activity time: 118040 (s)

    Interface (outside): Normal

    State-sync () of the interface: Normal

    MGMT () of the interface: Normal

    Crippen () of the interface: Normal

    Interface of Gorgon: Normal

    Production interface (): Normal

    Another host: high - availability

    Activity time: 1311050 (s)

    Interface (outside): Normal

    State-sync () of the interface: Normal

    MGMT () of the interface: Normal

    Crippen () of the interface: Normal

    Interface of Gorgon: Normal

    Production interface (): Normal

    Failover stateful logical Update Statistics

    Link: State-sync

    Stateful Obj xmit rcv rerr xerr

    15850 0 15849 General 0

    sys cmd 15850 0 15849 0

    time 0 0 0 0

    xlate 0 0 0 0

    Conn TCP 289351 0 331 0

    Conn UDP 0 0 0 0

    TCP 58955994 0 24657 3148 NPs

    182101602 0 58540 3148 NPs UDP

    Logical update queue information

    Heart Max Total

    Q: recv 0 1 15849

    Xmit Q: 0 1 15850

    XTRAK1-FWSM #.

    XTRAK1-FWSM #.

    XTRAK1-County of conn sho FWSM #.

    45581 in use

    XTRAK1-sho FWSM # fail

    Failover on

    Secondary failover unit

    Ha failover LAN interface

    Frequency of survey 10 seconds

    failover replication http

    This host: high - availability

    Activity time: 1311050 (s)

    Production interface (): Normal

    Interface of Gorgon: Normal

    Crippen () of the interface: Normal

    MGMT () of the interface: Normal

    State-sync () of the interface: Normal

    Interface (outside): Normal

    Another host: primary: enabled

    Activity time: 117960 (s)

    Production interface (): Normal

    Interface of Gorgon: Normal

    Crippen () of the interface: Normal

    MGMT () of the interface: Normal

    State-sync () of the interface: Normal

    Interface (outside): Normal

    Failover stateful logical Update Statistics

    Link: State-sync

    Because you are a dynamic rollover. Connections built on assets are transferred to waiting on the "failover connection", this way if the active FW dies suddenly, forward resumes and knows all of the existing connections and sessions users abandon.

    Not all types of connection are transferred, that is why you see the difference in number, but other than that you see is normal and a good thing. If you see not those connections on the day before, when the failover occurred would abandon all user sessions and they would have to reconnect.

    One thing I might suggest, you have replication HTTP is enabled with the command "failover replication http. On a busy FW, this can lead to a large number of connections being replicated. When you consider that loading a web page can open and close different connections of 5-10, all very quickly, you really want to have all these replicated to the waiting? If the active made fail the worst that could happen is that the user would have to reload their web page. I would say that put off, which is the default anyway, it'll put a lot less load on your two FW.

  • Need Adobe to reset the number of activations CS4 in order to activate the CS4 on a new computer. [was: Vicky - Chelsea photo lab.] NEED HELP AS SOON AS POSSIBLE]

    I have photoshop CS4. It gave me a serial number to activate a new computer. I was told that the account has been disabled before but it has never been. The number gave me blocks the application whenever I try to open. I've been waiting for Friday and all day today on the Adobe help. I need my CS4 deactivted from a spescific computer so I can reinstall

    From your description, that you don't know do you have actually the license... seems someone gave it to you.  You might have a hard time selling Support from Adobe.   Licenses must be officially transferred through Adobe.

    In all cases, you will need to communicate with them through chat and ask them to reset your activations.  Ask any more than that or they will send you back here where no one can help you.

    Chat support - the link below click the still need help? the option in the blue box below and choose the option to chat...

    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Serial number and activation support (non - CC) chat

    https://helpx.Adobe.com/contact.html?step=PHSP-PHXS_downloading-installing-setting-up_lice nsing-activation_stillNeedHelp

  • Account that a single email can be activated at the same time?

    Hello

    I have two e-mail accounts on the Mail for some time (virginmedia.com and outlook.com). Today, for some reason any Mail keeps asking for the password of the email blank and does not seem to recognize the password (which works fine if I connect on the Virgin account from the internet). Then also the following error message appears "only an e-mail account can be activated at the same time. «The «[email protected] e-mail account activation will disable "... @outlook.com" on this Mas.» How can I solve this?

    Thank you

    10.11.5 OS / iMac (mid-2010)

    You will need at least one of the accounts remove and recreate it in the Internet accounts preferences panel. You can do this without losing all the messages, provided that the account is IMAP or Exchange, and if you store sent messages on the server. Back up all data before making any changes.

  • "How can I fix the iCloud" you cannot connect at this time "error?

    I noticed that I was not able to view my use iCloud on my MacBook Pro. To try to solve the problem, I registered on iCloud, but now I'm more able to sign in - it displays you cannot connect at this time. Try to connect again. In addition, I was not able to install anything from the App Store for about a day because it asks me my Apple ID and password and perpetually displays the activity indicator:

    Playlists and iCloud tabs are not sync between my Mac and iPhone 6 s either. Strangely, Messages and FaceTime are signed in and it works properly.

    So far, I tried to remove my iCloud Keychain password and delete the folder ~/Library/Application Support/iCloud/accounts - both without success.

    I wanted to create a new Apple ID to test a fresh user, however, create Apple ID link is grayed out and unclickable:

    To summarize:

    1. I can not connect on my iCloud account.
    2. Playlists and iCloud tabs are not synchronized.
    3. I can't download anything from the App Store.
    4. I'm not able to create a new Apple ID from my Mac.
    5. Messages and FaceTime are not affected and are still connected.
    6. I tried to remove my iCloud Keychain entry and folder in account iCloud, without success.

    What else can I try? I haven't installed any antivirus software and know that I have not downloaded something fishy to cause a virus problem or malware.

    Try to create a new ID here.

    Apple ID - create

  • 22 FF doesn't remember history/active connections after reboot/logg off the PC

    Hi, I have this problem that started lately. Rarely, I restart my PC, as it always is in any case. Now, every time I restart my PC or Log off, and then log in again, FF forget the active connections and history and I connect on all my sites again. The problem is only concerts on FF and not any other browser since I have an another three (ie, google chrome and netscape) + FF, but I use FF mostly and rarely others.

    I checked all the software that I installed and no product cleaning here as ccleaner and anti-virus settings are checked. I also completely uninstalled FF and installed the latest version and tried to connect to one of the websites before you install any addon.

    seems OK, it was a bit of the virus or malware that keep the pc on its State (unable to display hidden folders and files, the gel firefox so not history or the active connection saved) I changed my antivirus and used combofix/ccleaner for all retrieve and ready again.

  • Discover the number of activations

    Hi people,

    This is my first message here, I apologize for my limited communication skills, but I'm not native English (I'm a man of Italian family 45 years).

    I recently bought the first el + El Photoshop and I'm very happy for that. I know that I have two activation for first El and two for Photoshop El.

    I installed the first and I activated the license by inputing the license key. On the same day, after the update of the software (14.1), I had too many accidents on 10 Windows, so I decided to uninstall.

    I uninstalled and then I reinstalled again Premiere El on the same laptop and I once again the license registration key.

    So, how much license activation are deployed? I don't want to lose the ability to install on a second PC, because now my product only works on a single PC.

    Is there a way to find out how much activation of license are deployed for the side Adobe?

    Thank you.

    You should always disable before uninstalling.  If you active twice and do not turn off once in between, then you have two activations tied to one machine.  What you can do is contact the Adobe Support when they are available (U.S. in opening week) and ask them to reset your activations so that you have two of them released during use.

    To the link below, click on the still need help? the option in the blue box below and choose the option to chat...

    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Serial number and activation support (non - CC) chat

    https://helpx.Adobe.com/contact.html?step=PHSP-PHXS_downloading-installing-setting-up_lice nsing-activation_stillNeedHelp

  • Maximum number of activations reached after the new installation of Lightroom

    After migrating to a new MacBook, I installed OS x fresh on the old MacBook. Because I also tried to get rid of Manager CC I uninstalled Lightroom and installed again on the new MacBook.

    Lightroom now, tells me that the maximum number of activations has been reached. Altogether, I have indeed installation, one on my MacMini and the other on my MacBook.

    Who can reset the activations?

    Normally, you should be able to reset by opening the program and by selecting help-> Deactivate.  If this isn't the case, then you will need to wait until you can reach the Adobe Support via chat and ask them to reset the activations.

    To the link below, click on the still need help? the option in the blue box below and choose the option to chat...
    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Serial number and activation support (non - CC) chat
    https://helpx.Adobe.com/contact.html?step=PHSP-PHXS_downloading-installing-setting-up_lice nsing-activation_stillNeedHelp

Maybe you are looking for