I’m attempting to make a query that lists a count of Active, Inactive & Total number of connections per machine, per username in an Oracle 10g database.
I have the following Query:
SELECT count(1) AS con_count, machine, username
FROM v$session
WHERE type <> 'BACKGROUND'
GROUP BY username, machine
ORDER BY con_count DESC;
That will list a count of the # of total connections per machine per username but am having trouble adapting it to do a count of Active, Inactive & Total connections as an all in one query.
So results should be something like:
ACTIVE INACTIVE TOTAL MACHINE USERNAME
And I can make the query do one of the first three columns but not all three at once.
Any help would be appreciated, as my SQL is very, very rusty.
Column
statusofv$sessionview contains information about active and inactive sessions. So you could recode you query as follows: