| |
 |
|
Oracle dbms_metadata
Oracle Tips by Burleson Consulting
|
About
Oracle dbms_metadata
Starting in Oracle9i,
you can use the new utility package called dbms_metadata that
will easily display DDL and stored procedures directly from the data
dictionary. Using this powerful utility, you can punch individual
objects or an entire Oracle schema. Best of all, it is easy to use.
You simply execute dbms_metadata.get_ddl, specify the object
names, and Oracle will extract ready-to-use DDL.
To punch off all table and indexes for the EMP table, execute
dbms_metadata. get_ddl, select from DUAL, and provide all
required parameters.
set heading off;
set echo off;
Set pages 999;
set long 90000;
spool ddl_list.sql
select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') from dual;
select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from
dual;
spool off;
|