暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
Oracle Audit 功能的使用和说明.pdf
175
11页
29次
2024-01-28
免费下载
Oracle Audit 功能的使用和说明
审计(Audit) 用于监视用户所执行的数据库操作,审计记录可存在数据字典表(称为审计记录:存储在 system 表空间
中的 SYS.AUD$ 表中,可通过视图 dba_audit_trail 查看)或操作系统审计记录中(默认位置为
$ORACLE_BASE/admin/$ORACLE_SID/adump/.。默认情况下审计是没有开启的
不管你是否打开数据库的审计功能,以下这些操作系统会强制记录:用管理员权限连 Instance启动数据库;关闭数
据库。
和审计相关的两个主要参
1audit_sys_operations
AUDIT_SYS_OPERATIONS enables or disables the auditing of top-level operations, which are SQL statements
directly issued by users when connecting with SYSDBA or SYSOPER privileges.(SQL statements run from within
PL/SQL procedures or functions are not considered top-level.) The audit records are written to the operating
system'saudit trail. The audit records will be written in XML format if the AUDIT_TRAIL initialization parameter is set to
xml or xml, extended.
On UNIX platforms, if the AUDIT_SYSLOG_LEVEL parameter has also been set, then it overrides the
AUDIT_TRAIL parameter and SYS audit records are written to the system audit log using the SYSLOG utility.
默认为 false当设置为 true 时,所有 sys 用户(包括以 sysdba, sysoper 身份登录的用户)的操作都会被记录audit
trail 不会写在 aud$表中,这个很好理解,如果数据库还未启动 aud$不可用,那么像 conn /as sysdba 这样的连接信息,
只能记录在其它地方。如果是 windows 平台,audti trail 会记录在 windows 的事件管理中,如果是 linux/unix 平台则会
记录在 audit_file_dest 参数指定的文件中
2audit_trail
AUDIT_TRAIL = { none | os | db | db,extended | xml | xml,extended }
none or false - Auditing is disabled. 是默认值,不做审计;
db or true - Auditing is enabled, with all audit records stored in the database audit trial (SYS.AUD$). audit
trail 记录在数据库的审计相关表中,如 aud$,审计的结果只有连接信息;
db,extended - As db, but the SQL_BIND and SQL_TEXT columns are also populated. 审计结果里面除了连
接信息还包含了当时执行的具体语句;
xml- Auditing is enabled, with all audit records stored as XML format OS files. 10g 里新增的。
xml,extended - As xml, but the SQL_BIND and SQL_TEXT columns are also populated. 10g 里新增的。
os- Auditing is enabled, with all audit records directed to the operating system's audit trail. audit trail 记录
在操作系统文件中,文件名由 audit_file_dest 参数指定;
注:这两个参数是 static 参数,需要重新启动数据库才能生效。
当开启审计功能后,可在三个级别对数据库进行审计Statement(语句)Privilege(权限)、object(对象)。
1 Statement(语句审计)
对某种类型 SQL 语句审计,不指定结构或对象。比如 audit table 会审计数据库中所有 create tabledrop table
truncate table 语句,alter session by cmy 会审计 cmy 用户所有的数据库连接。
2 Privilege(权限审计)
当用户使用了该权限则被审计,如执行 grant select any table to a,当执行了 audit select any table 语句后,当
a 访问了用户 b 的表时(如 select * from b.t)会用到 select any table 权限,故会被审计
注意:用户是自己表的所有者,所以用户访问自己的表不会被审计
3 Object(对象审计)
对一特殊模式对象上的指定语句的审计如审计 on 关键字指定对象的相关操作, aduit alter, delete, drop, insert
on cmy.t by scott; 这里会对 cmy 用户的 t 表进行审计,但同时使用了 by 子句,所以只会对 scott 用户发起的操作进行审
计。
注意:Oracle 没有提供对 schema 中所有对象的审计功能,只能一个一个对象审计对于后面创建的对象,Oracle 则提
on default 子句来实现自动审计,比如执行 audit drop on default by access;后,对于随后创建的对象 drop 操作都
会审计。但这个 default 会对之后创建的所有数据库对象有效,似乎没办法指定只对某个用户创建的对象有效,
trigger 可以对 schema DDL 进行审计,这个功能稍显不足。
审计的一些其他选项:
1by access / by session
by access 每一个被审计的操作都会生成一条 audit trail
by session 一个会话里面同类型的操作只会生成一条 audit trail,默认为 by session
2whenever [not] successful
whenever successful 操作成功(dba_audit_trail returncode 字段为 0) 才审计,
whenever not successful 反之。省略该子句的话,不管操作成功与否都会审计
和审计相关的视图
1dba_audit_trail
保存所有的 audit trail,实际上它只是一个基于 aud$的视图。其它的视图
dba_audit_session,dba_audit_object,dba_audit_statement 都只是 dba_audit_trail 的一个子集
2dba_stmt_audit_opts
可以用来查 statement 审计级别的 audit options,即数据库设置过哪些 statement 级别的审计。
dba_obj_audit_opts,dba_priv_audit_opts 视图功能与之类似
3all_def_audit_opts
用来查看数据库用 on default 子句设置了哪些默认对象审计。
取消审计
将对应审计语句的 audit 改为 noaudit 即可。 audit session whenever successful取消审计 noaudit session whenever
successful
试验如下:
首先,检查审计功能是否开启。
of 11
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜