As part of a project to reduce space within a cloned database it was decided that a large table could be excluded from the regular scripted copy.
I needed to extract the tables definition from the master, to create an empty version on the clone after the copy was complete.
Being Oracle version 220.127.116.11, I didn’t have to use the ‘exp’ command (the output of which needs a lot of tidying), but could instead use the <b>’get_ddl'</b> function of the <b>’dbms_metadata'</b> package – like so …
— Script to export the definition of table PROC_FIL and its index.
— Remember to add semi-colons, amend ‘storage (initial 1k next 1k minextents
— 1 pctincrease 0 freelists 1 freelist groups 1 buffer_pool default);
— for example, and fix broken lines.
set heading off;
set echo off;
set pages 999;
set long 90000;
select dbms_metadata.get_ddl(‘TABLE’,’PROC_FIL’,’KIS’) from dual;
select dbms_metadata.get_ddl(‘INDEX’,’PF_PK’,’KIS’) from dual;