Obtain DDL scripts for Oracle schema objects

During the application development phase and more often the DDL needs to be backed up for the schema objects. SQL format which supports the readability and recovery or portability of the object's creation later on when needed. This could be easily done by the Oracle data pump utility.

Workaround:


Step 1: First make the export dump for the intended schema for the metadata only.

$ expdp system schemas = test directory = data_pump_dir dumpfile = test_ddl_25112020.dmp logfile = test_ddl_25112020.log content = metadata_only

Step 2: Import the contents of the dump file to a .sql file by the IMPDP. The parameter sqlfile provides the transfer of dump file contents to SQL format.

$ impdp system directory = data_pump_dir dumpfile = test_ddl_25112020.dmp sqlfile = test_ddl_25112020.sql

Comments