1、按用户统计连接数:
SELECT USERNAME, COUNT(*) AS CONNECTION_COUNT
FROM V$SESSION
GROUP BY USERNAME;
这将返回每个用户的连接数。
2、按模块统计连接数:
SELECT MODULE, COUNT(*) AS CONNECTION_COUNT
FROM V$SESSION
GROUP BY MODULE;
这将返回每个模块的连接数。模块通常包含了应用程序的信息。
3、按登录时间统计连接数:
SELECT TO_CHAR(LOGON_TIME, 'YYYY-MM-DD HH24:MI:SS') AS LOGIN_TIME, COUNT(*) AS CONNECTION_COUNT
FROM V$SESSION
GROUP BY TO_CHAR(LOGON_TIME, 'YYYY-MM-DD HH24:MI:SS')
ORDER BY TO_CHAR(LOGON_TIME, 'YYYY-MM-DD HH24:MI:SS');
这将返回每个登录时间点的连接数。
4、按IP地址统计连接数:
SELECT MACHINE, COUNT(*) AS CONNECTION_COUNT
FROM V$SESSION
GROUP BY MACHINE;