4、查询审计记录
SQL> alter session setnls_date_format='yyyymmdd hh24:mi:ss';
Session altered.
SQL> set lines 200
col OS_USERNAME for a10
col USERNAME for a11
col USERHOST for a10
col TERMINAL for a10
col TIMESTAMP for a20
col obj_name for a10
col OWNER for a10
col ACTION_NAME for a11
col TRANSACTIONID for a16
col sql_text for a50
SELECT USERNAME,
USERHOST,
TIMESTAMP,
OWNER,
OBJ_NAME,
ACTION_NAME,
SQL_TEXT
FROM DBA_AUDIT_TRAIL
WHERE OBJ_NAME='NUM_T'
ORDER BY TIMESTAMP;
USERNAME USERHOST TIMESTAMP OWNER OBJ_NAME ACTION_NAME SQL_TEXT
----------- ---------- ------------------------------ ---------- -------------------------------------------------------------
ZX rhel5 20161107 11:57:55 ZX NUM_T NOAUDIT OBJ noaudit all on num_t
ECT
ZX rhel5 20161107 12:00:07 ZX NUM_T SELECT select count(*) from zx.num_t
ZX rhel5 20161107 12:00:21 ZX NUM_T INSERT insert into zx.num_t (id1) values(1)
SCOTT rhel5 20161107 12:00:37 ZX NUM_T SELECT select count(*) from zx.num_t
SCOTT rhel5 20161107 12:00:45 ZX NUM_T DELETE delete from zx.num_t
SCOTT rhel5 20161107 12:01:27 ZX NUM_T INSERT insert into zx.num_t (id2) values(2)
6 rows selected.
5、取消审计
SQL> noaudit all on num_t;
Noaudit succeeded.
6、清空aud$
这张系统表是可以使用TRUNCATE命令截断的。把它删掉之后那么视图中的记录也就相应消失了。
SQL> truncate table aud$;
SQL> SELECT * FROM DBA_FGA_AUDIT_TRAIL;
no rows selected