Bo's Oracle Station

查看: 1653|回复: 0

2014-08-05-1.sql

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2014-8-6 08:36:49 | 显示全部楼层 |阅读模式
select  * from dict where  table_name like 'DBA%AUDIT%';

select  *  from DBA_OBJ_AUDIT_OPTS;

select  *  from DBA_STMT_AUDIT_OPTS;

select  * from DBA_PRIV_AUDIT_OPTS;

select  * from dba_audit_trail;


select * from dba_views v where v.view_name='DBA_AUDIT_TRAIL';

select  * from dba_tables t where t.owner='SYS' and t.table_name='AUD$';

alter table aud$ move tablespace tbsaudit;

select  * from dba_tables t where t.owner='SYS' and t.table_name='AUD$';

select  * from dba_audit_trail;

truncate  table aud$;


select  * from dba_audit_trail  where username='HR';

select  * from tlogon;

select * from dba_source s where s.name='TRGLOGON';
--ing     ,  ed


create or replace trigger  trglogon
after logon on database
when ( user ='HR' )
begin
   insert into tlogon values(   to_char(sysdate,'YYYY-MM-DD HH24:MI:SS'),
  sys_context('userenv','ip_address'),
   sys_context('userenv','session_user'));
   commit;
end;


select     a.audit_option     from DBA_STMT_AUDIT_OPTS a
minus
select   b.privilege    from DBA_PRIV_AUDIT_OPTS  b ;


audit table ;

select     a.audit_option     from DBA_STMT_AUDIT_OPTS a
minus
select   b.privilege    from DBA_PRIV_AUDIT_OPTS  b ;

select  * from dba_audit_trail  where username='HR'  order by timestamp desc ;

select  * from dba_stmt_audit_opts  where audit_option='TABLE';

noaudit table;

audit table by hr   by access  whenever  successful ;


alter user sh identified by oracle_4U account unlock;

grant select  on hr.employees to sh ;


audit select  on hr.employees    by  session  ;

select  *  from DBA_OBJ_AUDIT_OPTS;

noaudit  select  on hr.employees;

audit select  on hr.employees    by  access   whenever  successful ;

select  * from dba_audit_trail   where     username='SYSTEM'     order by timestamp desc ;

grant update(salary)  on hr.employees to sh;

---audit  update(salary)  on hr.employees  ;

grant  select any table to sh ;

-----
audit select  any table by sh by session   whenever successful;


select  * from DBA_PRIV_AUDIT_OPTS;

select  * from dba_audit_trail  where username='SH'  order by timestamp desc ;


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-5 10:27 , Processed in 0.039243 second(s), 24 queries .

快速回复 返回顶部 返回列表