set echo off
----------------------------------------------------------------------------------------
--
-- Name: bak_object_source.sql
--
-- Description: Objects - Backup objects of current user to a text file.
-- Objects include: packages, package bodies, procedures and functions
--
-- Author:
--
-- Usage: @bak_object_source
--
-- Revision History:
--
-- DATE WHO WHAT
-- --------- ---------- ------------------
--
--
----------------------------------------------------------------------------------------
set termout off
set verify off
set doc off
set feedback off
set recsep off
set pagesize 0
--
define lsize=200
set linesize &&lsize
--
Column instance noprint NEW_VALUE v_instance
select upper(value) instance from v$parameter where name = 'db_name';
--
Column TODAY noprint NEW_VALUE TODAY_DATE
select to_char(sysdate, 'YYYYMMDDHH24MISS') TODAY from dual;
--
define out_file=bakobj_&&v_instance&&TODAY_DATE..DDL
spool &&out_file
--
SELECT text
from user_source
order by decode(type,'FUNCTION',1,'PROCEDURE',2,'PACKAGE',3,'PACKAGE BODY',4,5),name,line
;
spool off
UNDEFINE LSIZE
UNDEFINE TODAY_DATE
UNDEFINE OUT_FILE
set doc off
set feedback on
set pagesize 30
set termout on
set echo on
-- exit
|