The goal is to export an existing test Oracle database to SQL so that it can be run in a test pipeline using a Docker images's /container-entrypoint-initdb.d bootstrap. Currently we mount an oradata export, but it's opaque what the actual data is, hence the desire to use SQL so that it can be maintained via git.
I'm aware you can use the GUI Oracle SQL Developer Export Wizard to export a database to SQL.
Though how to do it via command line tools? I've tried many things like:
impdp test/test@XEPDB1 dumpfile=export.dmp directory=DUMP_DIR sqlfile=ddl.sql
And the best I can achieve is exporting the schema, however it is missing the actual data, e.g.
INSERT INTO currencies_countries (currency_id, country_id) VALUES ('EUR', 'CYP');
set sqlformat insertyou can query all of your tables individually to get the insert statements you seem to want, maybe with spool. Or you can write PL/SQL to dump to files yourself. But you still need the DDL, and you'll have to run inserts in the right order for PK/FKs etc. Data pump handles all the complications for you - I would seriously reconsider using expdp/impdp.impdpis the import data pump utility and is used, as the name suggests, to import data. If you want to export data then you want the export data pump utilityexpdb.