Sunday, March 2, 2008

Use sqlplus to backup a package to text file

In 10g and above:
spool backup_packagename_code.txt
select dbms_metadata.get_ddl('OBJECT_TYPE','OBJECT_NAME') from dual;
spool off

In 9i and below:
Set heading off
Set linesize 2000
Set trimspool off
Spool backup_packagename_code.txt

select text from dba_source
where name = 'PACKAGE_NAME’;

spool off

Then check to see if the spool file is readable.

No comments: