如何检查最后连接的用户,在oracle中的时间?

请告诉我当用户上次登录数据库时如何查找?请告诉我如何使用该命令检查此信息 .

回答(2)

2 years ago

启用审核 .

然后审计连接 - 非常简单的命令

audit connect

Docs Link Here

然后做一些连接 .

然后查询sys.dba_audit_session -

SELECT
    username,
    timestamp
FROM
    sys.dba_audit_session
WHERE
    username = 'HR' -- the user you care about
    AND action_name = 'LOGON'
ORDER BY
    timestamp DESC
FETCH FIRST 1 ROWS ONLY -- in 11g or older just also say where rownum < 2

2 years ago

试试这个:

select username, machine, to_char(logon_time,'HH:MM:SS')
from v$session 
where username='SYS'  <- username