SELECT s.username AS username,
(
CASE
WHEN grouping(s.machine) = 1
THEN '**** All Machines ****'
ELSE s.machine
END) AS machine,
COUNT(*) AS session_count
FROM v$session s,
v$process p
WHERE s.paddr = p.addr
AND s.username IS NOT NULL
GROUP BY rollup (s.username, s.machine)
ORDER BY s.username,
s.machine;
沒有留言:
張貼留言