SELECT a.inst_id,sid,username,event,sql_id,a.PROGRAM
FROM gv$session a
WHERE a.STATUS='ACTIVE'
AND username IS NOT NULL;
或者
SELECT sid,username,event,sql_id,a.PROGRAM
FROM v$session a
WHERE a.STATUS='ACTIVE'
AND username IS NOT NULL;
注:
1、gv$session: 指的是所有实例上的所有会话,而v$session是当前实例上的所有会话
2、gv$session比v$session多个inst_id字段,就是实例ID