Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Recording Destructive DDL
You are getting current SQL but you need to go thru all SQL for this session to find out if there was alter table drop (column).
Alex Hillman
Original Message-----
Sent: Wednesday, June 06, 2001 9:36 PM
To: Multiple recipients of list ORACLE-L
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_at_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_at_slac.stanford.edu
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: MacGregor, Ian A.
INET: ian_at_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_at_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).
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_at_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).
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_at_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).
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_at_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). Received on Mon Jun 11 2001 - 12:22:46 CDT
![]() |
![]() |