Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: audit alter table add column and drop column

Re: audit alter table add column and drop column

From: <janik_at_pobox.sk>
Date: 3 Jan 2007 05:07:16 -0800
Message-ID: <1167829635.987353.43030@i12g2000cwa.googlegroups.com>


One option is via system event triggers, you can audit ALTER TABLE command. If you want to audit just a specific operation, you can achieve it via string functions + IF.. THEN.

CREATE OR REPLACE TRIGGER test
  BEFORE ALTER ON SCHEMA
DECLARE sql_text ora_name_list_t;
stmt VARCHAR2(2000);
n integer;

BEGIN
 null;
IF (ora_dict_obj_type IN ( 'TABLE') )
 then
  n:= ora_sql_txt(sql_text);

FOR i IN 1..n LOOP
stmt := stmt || sql_text(i);
END LOOP;     INSERT NTO your_table (username,sql_text) VALUES (user,stmt);

END IF;
END test;

Jan

aman.oracle.dba napísal(a):
> hi all,
> I can audit create table and drop table commands but I want to audit
> alter table command.
> basically I want to audit add columns and drop columns commands. Is it
> possible and if yes then how.
Received on Wed Jan 03 2007 - 07:07:16 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US