I use Oracle Data Pump to extract the DDL for all schema objects – impdp
with sqlfile
parameter. It generates one huge SQL file. I want to split it up into several files – one file per one schema object. E.g., a package P
should be stored in P.pks
and P.pkb
– the specification and the body, a table T
– in T.tbl
, etc.
These files are going to be put into some repository for revision control. That is why one huge SQL file containing all the DDL is inconvenient compared to the set of files for each object. I have not find any tool for splitting the Data Pump SQL file. Therefore I will have to write my own program for splitting the Data Pump SQL file and organizing folder structure for the repository.
Is there any Data Pump options/parameters to generate such set of files? Is there any other tool to do so?
Best Answer
Why bother with Data Pump for a task like that? It is designed for something else, and there are simpler solutions for this without Data Pump, like using
DBMS_METADATA
directly.Then create the directory object:
Then just run something like below. In this example I generated the DDL for only first 5 (order based on object_id) packages, package bodies and tables to keep the output short.
And the files:
The rest is up to you: customize the above for specific types and file extensions.