Hi, today i share about metadata export script. This script can be used to export Oracle object become sql script. In example, if there was TABLE_A object. After the script was compiled, there was a result script to create TABLE_A.
Check this out.
-- Run this script in SQL*Plus. -- don't print headers or other crap set heading off; set echo off; set pagesize 0; -- don't truncate the line output -- trim the extra space from linesize when spooling set long 99999; set linesize 32767; set trimspool on; -- don't truncate this specific column's output col object_ddl format A32000; --output query which could downloaded at directory spool xit_table.sql; SELECT dbms_metadata.get_ddl(object_type, object_name, owner) || ';' AS object_ddl from dba_objects ao WHERE 1=1 AND OBJECT_TYPE IN ( 'VIEW' ) ORDER BY OWNER , OBJECT_TYPE , OBJECT_NAME ; --end of script spool off;