Generate DDL with dbms_metadata
conn user/password
set pagesize 0
set long 90000
set feedback off
set echo off
set long 90000
set feedback off
set echo off
Spool ddl.sql
SELECT DBMS_METADATA.GET_DDL('TABLE',ut.table_name)
FROM USER_TABLES ut;
FROM USER_TABLES ut;
SELECT DBMS_METADATA.GET_DDL('INDEX',u.index_name)
FROM USER_INDEXES u;
FROM USER_INDEXES u;
Spool off
or you can use dual table for generating DDL
set heading off;
set echo off;
set long 90000;
spool ddl.sql
select dbms_metadata.get_ddl('TABLE','YOUR TABLE NAME','YOUR TABLE OWNER NAME') from dual;
select dbms_metadata.get_ddl('INDEX','YOUR INDEX NAME','YOUR TABLE OWNER NAME') from dual;
spool off;
No comments:
Post a Comment