Question: I need to export only my table and
index definitions for my schema. What are the ways to export
only the metadata definitions and not export the data?
Answer: There are two ways to extract
(punch) the DDL for a schema:
1 - Use dbms_metadata.get_ddl:
This package will export a schema definition without the
data
set long 10000
set heading 999
set lines 100
select
dbms_metadata.GET_DDL(u.object_type,u.object_name,'PUBS')
from
dba_objects u
where
owner = 'PUBS';
2 - Data Pump export:
The expdp program will export only the table and index
definitions (DDL) for a specified schema owner:
expdp scott/tiger@db10g
schemas=SCOTT directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log