HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

exporting oracle tables on command line as sql files

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
tableslineexportingsqlfilescommandoracle

Problem

I use exp and expdp to export database tables on command line but it generates binary .dmp files. I want to export/import tables as .sql* files on command line like pl/sql developer app can do. Is there a specific command for this or extra parameters for exp/expdp?

*sql files must contain table creation scripts and insert statements.

Thanks.

Solution

You can generate DDL statements using imp/impdp utilities:

imp user/passwd file=export.dmp show=y log=export.sql 2> /dev/null
impdp user/passwd file=DIR:export.expdp sqlfile=DIR:export2.sql


But this method will generate just schema DDL. INSERT statements will not be generated.

Code Snippets

imp user/passwd file=export.dmp show=y log=export.sql 2> /dev/null
impdp user/passwd file=DIR:export.expdp sqlfile=DIR:export2.sql

Context

StackExchange Database Administrators Q#58635, answer score: 2

Revisions (0)

No revisions yet.