Generate create table, view, index scripts

set linesize 2000

set trimspool on
set pages 0
set long 1000000000

SET TERMOUT OFF

set echo off

spool c:\temp\table_index_cr.sql

SELECT DBMS_METADATA.GET_DDL(‘TABLE’,ut.table_name)
     FROM USER_TABLES ut;

SELECT DBMS_METADATA.GET_DDL(‘VIEW’,ut.table_name)
     FROM USER_VIEWS ut;

  SELECT DBMS_METADATA.GET_DDL(‘INDEX’,ui.index_name) FROM USER_INDEXES ui;

spool off;

Leave a Reply

Your email address will not be published. Required fields are marked *