From ian@SLAC.Stanford.EDU Wed, 06 Jun 2001 18:25:30 -0700
From: "MacGregor, Ian A." <ian@SLAC.Stanford.EDU>
Date: Wed, 06 Jun 2001 18:25:30 -0700
Subject: RE: Recording Destructive DDL
Message-ID: <F001.0031F793.20010606173552@fatcity.com>
MIME-Version: 1.0
Content-Type: text/plain


Obtaining the triggering statement is beyond my ken.  If I   use a "before" trigger
and a cursor,
select 
lower(replace( q.sql_text,' ',null))
 from v$sql q, v$sql_cursor c, v$session s
 where s.audsid=audsid and
s.prev_sql_addr=q.address and
 q.address=c.parent_handle;

.
I get back 

select 
lower(replace( q.sql_text,' ',null))
 from v$sql q, v$sql_cursor c, v$session s
 where s.audsid=audsid and
s.prev_sql_addr=q.address and
 q.address=c.parent_handle;

If I do it as an after statement trigger I get back 

deletefromcol$whereobj#=:1andintcol#=:2

which is the DML  run against the sys object to  execute the drop column request.  Of 
course if
I do it as an "after"  I cannot loop through the column_names to check for which one 
was dropped
because it already has been.

Ian MacGregor
Stanford Linear Accelerator Center
ian@slac.stanford.edu

 

-----Original Message-----
Sent: Wednesday, June 06, 2001 8:52 AM
To: Multiple recipients of list ORACLE-L


Also is there any view where I can see statements like create or drop schema
object. In v$sqlarea I cannot see this type of DDL. I can see alter schema
object.

It is 8.1.7 Solaris

As to the question - I did not try it but if owner of the trigger has access
to$sqlarea you can inside trigger query v$sqlarea for current session and
check if there are any alter... drop statements. Strange that oracle does
not provide SQL statement as one of the trigger attributs.

Alex Hillman  

-----Original Message-----
Sent: Tuesday, June 05, 2001 9:46 PM
To: Multiple recipients of list ORACLE-L


I've written a system event trigger which records  information on when a
table was dropped or truncated.   I would also like 
to record when  someone does an "alter table drop column..."  The problem is
determining when the alter statement includes  the drop column clause.  It
looks like I have to use the ora_is_drop_column function, calling it for
each column in the table and checking the return code.  Is there a way of
determing whether "drop column" was issued without using this function?

Ian MacGregor
Stanford Linear Accelerator Center
ian@slac.stanford.edu
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: MacGregor, Ian A.
  INET: ian@SLAC.Stanford.EDU

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Hillman, Alex
  INET: Alex.Hillman@usmint.treas.gov

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: MacGregor, Ian A.
  INET: ian@SLAC.Stanford.EDU

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


