A B
object Specify the name of the object to be audited. The object must be a table, view, sequence, stored procedure, function, package, materialized view, mining model, or library.ddl 审计前面已有案例
下面是proc的审计
SQL> CREATE OR REPLACE PROCEDURE p_showdate AS 2 BEGIN 3 dbms_output.put_line(to_char(SYSDATE, 'yyyy-mm-dd hh24:mi:ss')); 4 END; 5 / Procedure created Executed in 0.359 seconds SQL> audit execute on p_showdate; Audit succeeded SQL> set serveroutput on SQL> exec p_showdate; 2014-06-11 15:58:17 PL/SQL procedure successfully completed SQL> SQL> SELECT TIMESTAMP, owner, obj_name, sql_text 2 FROM dba_audit_trail 3 WHERE username = 'TEST' 4 AND obj_name = upper('p_showdate'); TIMESTAMP OWNER OBJ_NAME SQL_TEXT ----------- ------ ---------- -------------------------------------------------- 2014-06-11 TEST P_SHOWDATE begin p_showdate; end;
SQL> exec p_showdate; 2014-06-11 16:00:13 PL/SQL procedure successfully completed Executed in 0 seconds SQL> exec p_showdate; 2014-06-11 16:00:14 PL/SQL procedure successfully completed Executed in 0 seconds SQL> SQL> SELECT TIMESTAMP, owner, obj_name, sql_text 2 FROM dba_audit_trail 3 WHERE username = 'TEST' 4 AND obj_name = upper('p_showdate'); TIMESTAMP OWNER OBJ_NAME SQL_TEXT ----------- ------ ---------- -------------------------------------------------- 2014-06-11 TEST P_SHOWDATE begin p_showdate; end; 2014-06-11 TEST P_SHOWDATE begin p_showdate; end; 2014-06-11 TEST P_SHOWDATE begin p_showdate; end; 3 rows selected
<span style="font-family: Tahoma, sans-serif; ">SQL> alter system set AUDIT_SYS_OPERATIONS=TRUE scope=spfile;</span> System altered. SQL> startup force; ORACLE instance started. Total System Global Area 778387456 bytes Fixed Size 1405452 bytes Variable Size 285216244 bytes Database Buffers 486539264 bytes Redo Buffers 5226496 bytes Database mounted. Database opened. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options G:\Tools\Console2>sqlplus sys/ofbiz as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 11 16:21:03 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> SELECT sessionid,t.action,t.comment_text,sql_text 2 FROM dba_audit_trail t 3 / SESSIONID ACTION COMMENT_TEXT SQL_TEXT ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------- 120014 49 alter system set AUDIT_SYS_OPERATIONS=TRUE 130012 100 Authenticated by: DATABASE; Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168 130013 100 Authenticated by: DATABASE; Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168 130014 100 Authenticated by: DATABASE; Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168 4 rows selected