David,
Sorry about my soap-box. But I've been in your situation, and it stinks!.
I quick-wrote the following script to help you out. It uses UTL_FILE, so
you will need to place an entry in your init.ora file, pointing to a
directory on your server. The init.ora parameter you need to set is:
utl_file_dir = L:\u0001\oracle\admin\WTWD\Utl ( or some
such directory)
You can the try running the script, and it will create a recreate_trig.sql
file within the directory you use.
Here is the script: Note - I only tested this for a few triggers, so your
mileage may vary. At least it gives you a start:
DECLARE
CURSOR c1 IS
SELECT trigger_name,triggering_event,
trigger_type, trigger_body,table_Name
FROM USER_TRIGGERS
WHERE TABLE_name='WTW_ACTVTY_SUPP_SERV_ALIAS';
file_handle UTL_FILE.FILE_TYPE;
loc_trigger_body VARCHAR2(32000);
BEGIN
file_handle:=UTL_FILE.FOPEN('L:\u0001\oracle\admin\WTWD\Utl','recreate_trig.
sql', 'W');
FOR c1_rec IN c1 LOOP
loc_trigger_body := c1_rec.trigger_body;
-- dbms_output.put_line('CREATE OR REPLACE TRIGGER {newowner}.' ||
c1_rec.trigger_name);
utl_file.PUT_LINE(file_handle,'CREATE OR REPLACE TRIGGER {newowner}.' ||
c1_rec.trigger_name);
utl_file.PUT_LINE(file_handle,SUBSTR(c1_rec.trigger_type,1,7)|| ' ' ||
c1_rec.triggering_event ||
' on ' || c1_rec.table_name);
utl_file.PUT_LINE(file_handle,'FOR ' || SUBSTR(c1_rec.trigger_type,8,20));
utl_file.PUT_LINE(file_handle,loc_trigger_body);
utl_file.PUT_LINE(file_handle,'/');
utl_file.PUT_LINE(file_handle,' ');
END LOOP;
utl_file.FCLOSE(file_handle);
END;
/
Good Luck - and gives that vendor hell!
Tom Mercadante
Oracle Certified Professional
-----Original Message-----
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 25, 2001 3:12 PM
To: Multiple recipients of list ORACLE-L
I've got 885 triggers with hard-coded fully qualified table names in
DBA_TRIGGERS. Problem is, the vendor changed the ownership on these
tables, and now I've got 885 invalid triggers. I'd just like to run my
grand scheme (not to be confused with schema) past you folks, give you the
chance to realize just what an idiot I am, and offer brilliant alternatives
that'll cause lasting envy, jealousy, and self-pity - mostly because the
suggestions will be simpler, and might actually work.
So much for the introduction. I thought I'd just go into DBA_TRIGGERS and
run a replace against the trigger_text. Since trigger_text is a long data
type, I don't believe I can use a straight update .. set ... replace() in
SQL PLUS. My plan therefore is to write a quick PL/SQL piece that will
select the long column into a varchar2, do the replace, then update the
long column with the edited varchar2 variable.
Is this a realistic strategy?
David A. Barbour
Oracle DBA, OCP
AISD
512-414-1002
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
INET: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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: Mercadante, Thomas F
INET: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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).