select * from dba_stmt_audit_opts; 查看语句审计
select * from dba_priv_audit_opts; 查看权限审计
select * from dba_obj_audit_opts; 查看对象审计
审计连接或断开连接:
AUDIT SESSION;
AUDIT SESSION BY jeff, lori; -- 指定用户
审计权限(使用该权限才能执行的操作):
AUDIT DELETE ANY TABLE BY ACCESS WHENEVER NOT SUCCESSFUL;
AUDIT DELETE ANY TABLE;
AUDIT SELECT TABLE, INSERT TABLE, DELETE TABLE, EXECUTE PROCEDURE BY ACCESS WHENEVER NOT SUCCESSFUL;
对象审计:
AUDIT DELETE ON jeff.emp;
AUDIT SELECT, INSERT, DELETE ON jward.dept BY ACCESS ;
取消审计:
NOAUDIT session;
NOAUDIT session BY jeff, lori;
NOAUDIT DELETE ANY TABLE;
NOAUDIT SELECT TABLE, INSERT TABLE, DELETE TABLE,EXECUTE PROCEDURE;
NOAUDIT ALL; -- 取消所有statement审计
NOAUDIT ALL PRIVILEGES; -- 取消所有权限审计
NOAUDIT ALL ON DEFAULT; -- 取消所有对象审计
10、清除审计信息
DELETE FROM SYS.AUD$;
DELETE FROM SYS.AUD$ WHERE obj$name='EMP';
5审计前提
show parameter audit
alter system set audit_sys_operations=TRUE scope=spfile;
alter system set audit_trail=db,extended scope=spfile;
然后重启数据库
6 精度审计
conn fang/fang
create table salary(
name varchar2(20),
age number,
salary number(10,2)
);
insert into salary values('u1',30,5000);
insert into salary values('u1',30,7000);
insert into salary values('u1',30,12000);
commit;
新建审计项
begin
dbms_fga.add_policy(
object_schema => 'FANG' ,
object_name =>'SALARY',
policy_name => 'p1',
audit_condition =>'salary>10000',
statement_types =>'select,insert,delete,update',
enable => true);
end;
select * from dba_audit_policies; 查看审计项
取消审计项
begin
dbms_fga.drop_policy(
object_schema => 'FANG' ,
object_name =>'SALARY',
policy_name => 'p1'
);
end;
select * from dba_fga_audit_trail; 查看审计条目