RE: Export/backup Stored Database Procedures

  • From: <Stephen.Lee@xxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 12 Feb 2004 16:09:13 -0600

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.

---- triggers.sql ----

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@xxxxxxxxx] 
> Sent: Thursday, February 12, 2004 1:40 PM
> To: oracle-l@xxxxxxxxxxxxx
> 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@xxxxxxxxxxxxx
> put 'unsubscribe' in the subject line.
> --
> Archives are at //www.freelists.org/archives/oracle-l/
> FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------
> 
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: