Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Export/backup Stored Database Procedures
There are scripts you can grab off the net that will spool the create statements for the procedures to a file. I don't have one handy right now, but here's one for grabbing triggers. For some reason around here these things tend to get created with a bunch of extra line feed, and I prefer eliminating them; thus all the CHR(10) things. This should show it's actually very easy to create a text file with the commands for triggers, constraints, procedures, whatever. Also, do some googling for DBMS_METADATA package.
set heading off feedback off lines 500 pages 9999 trim on trims on long
65000 longchunksize 255
set verify off
col slash newline
select upper('&&schema_owner') from sys.dual; spool cr_triggers.sql
select 'CREATE OR REPLACE TRIGGER
'||replace(replace(replace(replace(description,'"'||owner||'".',''),CHR(10)|
|CHR(10),CHR(10)),CHR(10)||CHR(10),CHR(1
0)),CHR(10)||CHR(10),CHR(10)),trigger_body,'/' slash from dba_triggers where
upper(owner) = upper('&&schema_owner');
spool off
set heading on feedback on lines 150 pages 9999
> -----Original Message-----
> From: Michael Fontana [mailto:mfontana_at_verio.net]
> Sent: Thursday, February 12, 2004 1:40 PM
> To: oracle-l_at_freelists.org
> Subject: Export/backup Stored Database Procedures
>
>
>
> What methods do most on this list use to back up stored database
> procedures?
>
> I am familiar with exporting the SYS user only, and importing
> to another
> staging database, and pulling the source code out of there, but I must
> admit, this involves several steps and is a relative "kludge".
>
> A DBA in our group, with Sybase and SQLServer experience, complains
> because Oracle does not have a method to single out such objects for
> backup.
>
>
>
> Michael Fontana
> Sr. DBA
> NTT/Verio
>
>
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to: oracle-l-request_at_freelists.org
> put 'unsubscribe' in the subject line.
> --
> Archives are at http://www.freelists.org/archives/oracle-l/
> FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------
>
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Thu Feb 12 2004 - 16:09:13 CST
![]() |
![]() |