set echo off
----------------------------------------------------------------------------------------
--
-- Name: bak_object_source1.sql
--
-- Description: Objects - Backup an object to a text file.
-- Objects include: packages, package bodies, procedures and functions
--
-- Author:
--
-- Usage: @bak_object_source1
--
-- 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
--
define obj_owner=&1
define obj_name=&2
--
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_&&obj_name._&&v_instance&&TODAY_DATE..DDL
spool &&out_file
--
SELECT text
from dba_source
where name=upper('&&obj_name') and owner=upper('&&obj_owner')
order by 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
|