Extracting the DDL from a .dmp file

Instead of using the long syntax of an import, you can try a text search on the .dmp file to extract the DDL.

In order to extract the DDL from a .dmp file, we normally use the INDEXFILE clause during import:

imp system/passwd@cntstring 
FILE=test.dmp 
INDEXFILE=scrip.txt
log=test.log

Instead of using the long import syntax you can try a text search on the .dmp file as follows. This is faster and simpler. It has been tested on Oracle 9i and 8i.

$fgrep 'CREATE'  test.dmp

Output 
------
CREATE TABLE "CDATA" ("CFID" CHAR(20), "APP" CHAR(64), "DATA" LONG)  PCTFREE
10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1
FREELIST GROUPS 1) TABLESPACE "CLIENT" NOLOGGING NOCOMPRESS
CREATE UNIQUE INDEX "ID1" ON "CDATA" ("CFID" , "APP" )  PCTFREE 10 INITRANS
2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1)
TABLESPACE "CLIENT" LOGGING
CREATE TABLE "CGLOBAL" ("CFID" CHAR(20), "DATA" LONG, "LVISIT" DATE)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536
FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "CLIENT" NOLOGGING NOCOMPRESS
CREATE INDEX "ID2" ON "CGLOBAL" ("CFID" )  PCTFREE 10 INITRANS 2 MAXTRANS
255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "CLIENT"
LOGGING
CREATE INDEX "ID3" ON "CGLOBAL" ("LVISIT" )  PCTFREE 10 INITRANS 2 MAXTRANS
255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "CLIENT"
LOGGING

For More Information

  • Feedback: E-mail the editor with your thoughts about this tip.
  • More tips: Hundreds of free Oracle tips and scripts.
  • Tip contest: Have an Oracle tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize -- submit your tip today!
  • Ask the Experts: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.
  • Forums: Ask your technical Oracle questions--or help out your peers by answering them--in our active forums.
  • Best Web Links: Oracle tips, tutorials, and scripts from around the Web.

This was last published in October 2002

Dig Deeper on Oracle database backup and recovery

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close