查询Oracle当前所有连接信息:
sql
SELECT
s.sid AS 会话ID,
s.serial# AS 序列号,
s.username AS 用户名,
s.osuser AS 操作系统用户,
s.machine AS 客户端机器,
s.program AS 客户端程序,
s.status AS 会话状态,
s.sql_id AS 正在执行的SQL_ID,
t.sql_text AS 正在执行的SQL文本
FROM
v$session s
LEFT JOIN
v$sql t
ON
s.sql_id = t.sql_id;
查询MySQL当前所有连接信息:
sql
SELECT
id AS 连接ID,
user AS 用户名,
host AS 客户端主机,
db AS 数据库,
command AS 命令,
time AS 运行时间,
state AS 状态,
info AS 查询信息
FROM
information_schema.processlist;
在这两个查询中,我为每个字段添加了中文别名,以提高查询结果的可读性