如何使用 SQL Plus 从数据库用户获取日志信息?
How can I get log info from DB user with SQL Plus?
我们公司使用的是 Oracle 数据库。出于监管原因,我们需要 "report" 包含所有数据库用户,这些用户用于在 2018 年更新我们软件的数据库以及他们的登录和注销时间戳。我知道 Oracle 有一个跟踪该功能的工具,但不幸的是,我们公司从未使用过该功能,而且该功能仍处于停用状态。这样的东西还能拿到吗?
我需要的实际上应该是这样的:
1. 列:数据库用户
2. 列:登录时间戳
3. 列:注销时间戳
可能是这样的:
prod_user | 01.02.2018 05:30:05 | 01.02.2018 05:35:30
prod_user | 02.02.2018 10:06:16 | 02.02.2018 10:48:58
此致
假设您使用的用户有足够的权限,您可以使用 DBA_AUDIT_SESSION 视图来检查您需要的信息。
Documentation Oracle 10g
没有
除非您在数据库中启用审计并审计连接,否则默认情况下 Oracle 不会存储用户 login/logout。
来自 the AUDIT SESSION
documentation :
This option generates a single audit record for each session created by connections to an instance. An audit record is inserted into the audit trail at connect time and updated at disconnect time. This record can include connection time, disconnection time, and logical and physical I/O processed, among other information.
对于它的价值,您可以通过查看管理视图 DBA_USERS
中的列 LAST_LOGIN
来访问任何用户的 上次登录日期 。这是一项常规功能,不需要启用审核。
我们公司使用的是 Oracle 数据库。出于监管原因,我们需要 "report" 包含所有数据库用户,这些用户用于在 2018 年更新我们软件的数据库以及他们的登录和注销时间戳。我知道 Oracle 有一个跟踪该功能的工具,但不幸的是,我们公司从未使用过该功能,而且该功能仍处于停用状态。这样的东西还能拿到吗?
我需要的实际上应该是这样的:
1. 列:数据库用户
2. 列:登录时间戳
3. 列:注销时间戳
可能是这样的:
prod_user | 01.02.2018 05:30:05 | 01.02.2018 05:35:30
prod_user | 02.02.2018 10:06:16 | 02.02.2018 10:48:58
此致
假设您使用的用户有足够的权限,您可以使用 DBA_AUDIT_SESSION 视图来检查您需要的信息。 Documentation Oracle 10g
没有
除非您在数据库中启用审计并审计连接,否则默认情况下 Oracle 不会存储用户 login/logout。
来自 the AUDIT SESSION
documentation :
This option generates a single audit record for each session created by connections to an instance. An audit record is inserted into the audit trail at connect time and updated at disconnect time. This record can include connection time, disconnection time, and logical and physical I/O processed, among other information.
对于它的价值,您可以通过查看管理视图 DBA_USERS
中的列 LAST_LOGIN
来访问任何用户的 上次登录日期 。这是一项常规功能,不需要启用审核。