dbTalk Databases Forums  

How to split a data definition SQL script file (DDL script)

comp.databases comp.databases


Discuss How to split a data definition SQL script file (DDL script) in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Seb
 
Posts: n/a

Default How to split a data definition SQL script file (DDL script) - 09-16-2006 , 02:22 PM






Hello,

I need to split a Oracle data definition SQL script file (DDL script) to
many files, each file corresponding to one command category (table
creation, constraint creation, index creation, etc).
Do you know some tool to do that ?

Thanks in advance for your answers !

Reply With Quote
  #2  
Old   
Sybrand Bakker
 
Posts: n/a

Default Re: How to split a data definition SQL script file (DDL script) - 09-16-2006 , 03:25 PM






On Sat, 16 Sep 2006 21:22:21 +0200, Seb <arx9qekubvq93e3 (AT) jetabe (DOT) net>
wrote:

Quote:
Hello,

I need to split a Oracle data definition SQL script file (DDL script) to
many files, each file corresponding to one command category (table
creation, constraint creation, index creation, etc).
Do you know some tool to do that ?

Thanks in advance for your answers !

awk, vi and sed come to mind. If you are on Windows, gvim is a vi
clone for Windows, www.gvim.org If you need awk and sed too you can
download Cygwin, which is (korn)shell clone for Windows.

And then of course Perl could do it.

--
Sybrand Bakker, Senior Oracle DBA


Reply With Quote
  #3  
Old   
Martin T.
 
Posts: n/a

Default Re: How to split a data definition SQL script file (DDL script) - 09-16-2006 , 05:18 PM



Sybrand Bakker wrote:
Quote:
On Sat, 16 Sep 2006 21:22:21 +0200, Seb <arx9qekubvq93e3 (AT) jetabe (DOT) net
wrote:

Hello,

I need to split a Oracle data definition SQL script file (DDL script) to
many files, each file corresponding to one command category (table
creation, constraint creation, index creation, etc).
Do you know some tool to do that ?

Thanks in advance for your answers !


awk, vi and sed come to mind. If you are on Windows, gvim is a vi
clone for Windows, www.gvim.org If you need awk and sed too you can
download Cygwin, which is (korn)shell clone for Windows.

And then of course Perl could do it.

Perl! Perl! Perl! :-) (Is there anything you can't use it for?)
But then again, not meaning to be rude to the OP, someone asking this
question will probably not be able to make Perl do it.

cheers,
Martin

p.s.: I agree that this post was not really helpful.



Reply With Quote
  #4  
Old   
Mark D Powell
 
Posts: n/a

Default Re: How to split a data definition SQL script file (DDL script) - 09-16-2006 , 06:41 PM




Martin T. wrote:
Quote:
Sybrand Bakker wrote:
On Sat, 16 Sep 2006 21:22:21 +0200, Seb <arx9qekubvq93e3 (AT) jetabe (DOT) net
wrote:

Hello,

I need to split a Oracle data definition SQL script file (DDL script) to
many files, each file corresponding to one command category (table
creation, constraint creation, index creation, etc).
Do you know some tool to do that ?

Thanks in advance for your answers !


awk, vi and sed come to mind. If you are on Windows, gvim is a vi
clone for Windows, www.gvim.org If you need awk and sed too you can
download Cygwin, which is (korn)shell clone for Windows.

And then of course Perl could do it.

Perl! Perl! Perl! :-) (Is there anything you can't use it for?)
But then again, not meaning to be rude to the OP, someone asking this
question will probably not be able to make Perl do it.

cheers,
Martin

p.s.: I agree that this post was not really helpful.
Seb, if you also need to know how to generate the DDL for Oracle
objects see the Suppled PL/SQL Packages and Types manual or equivilent
for your release of Oracle (8.1 up I believe) for the DBMS_METADATA
package.

Also the indexfile parameter of imp covered in the Utilities manual may
be of interest for table and index definitions. The previously
mentioned Unix utilities can be used on the results of the imp Show
parameter to cut out DDL from an import file.

Version 10 impdp also has some DDL extract options but I do not
remember the parameter name off the top of my head and rather than open
the manual I will leave that to you if you need the feature.

HTH -- Mark D Powell --



Reply With Quote
  #5  
Old   
Mark D Powell
 
Posts: n/a

Default Re: How to split a data definition SQL script file (DDL script) - 09-16-2006 , 06:44 PM




Mark D Powell wrote:
Quote:
Martin T. wrote:
Sybrand Bakker wrote:
On Sat, 16 Sep 2006 21:22:21 +0200, Seb <arx9qekubvq93e3 (AT) jetabe (DOT) net
wrote:

Hello,

I need to split a Oracle data definition SQL script file (DDL script) to
many files, each file corresponding to one command category (table
creation, constraint creation, index creation, etc).
Do you know some tool to do that ?

Thanks in advance for your answers !


awk, vi and sed come to mind. If you are on Windows, gvim is a vi
clone for Windows, www.gvim.org If you need awk and sed too you can
download Cygwin, which is (korn)shell clone for Windows.

And then of course Perl could do it.

Perl! Perl! Perl! :-) (Is there anything you can't use it for?)
But then again, not meaning to be rude to the OP, someone asking this
question will probably not be able to make Perl do it.

cheers,
Martin

p.s.: I agree that this post was not really helpful.

Seb, if you also need to know how to generate the DDL for Oracle
objects see the Suppled PL/SQL Packages and Types manual or equivilent
for your release of Oracle (8.1 up I believe) for the DBMS_METADATA
package.

Also the indexfile parameter of imp covered in the Utilities manual may
be of interest for table and index definitions. The previously
mentioned Unix utilities can be used on the results of the imp Show
parameter to cut out DDL from an import file.

Version 10 impdp also has some DDL extract options but I do not
remember the parameter name off the top of my head and rather than open
the manual I will leave that to you if you need the feature.

HTH -- Mark D Powell --
I meant to reword the start to read more along the lines that if
thought it would be easier to extract the DDL on an object by object or
associated object basis that the tools I mentioned might be of interest
since the OP states that script file already exists.

-- Mark --



Reply With Quote
  #6  
Old   
akkha1234@gmail.com
 
Posts: n/a

Default Re: How to split a data definition SQL script file (DDL script) - 09-16-2006 , 09:17 PM




How about using TOAD? It got all the options.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.