views:

93

answers:

3

I have recently been given an existing oracle database that i want to script out the various objects and its static data so that i can place the objects under source code control and when necessary rebuild the database from scratch.

Does any one have any scripts or tools that i could look at to assist me.

+4  A: 

I'd look at something like: select dbms_metadata.get_ddl(object_type, object_name, owner) from dba_objects. Stick it in a PL/SQL procedure to write each object's DDL to its own file with UTL_FILE.

Gary
+1  A: 

For tools I'd recommend Oracle's SQL Developer, it has both an automatic scripting for objects and has support for some source control utilities (CVS and Subversion specifically).

Thomas Jones-Low
A: 

I would be inclined to use either EXPORT/IMPORT (if any version up to and including 11g) or DATA PUMP (if 11g and maybe 10G)

At command line on the server enter 'exp help=Y' and you should get enough detail on parameters. Decide if you want the whole DB or one schema, data or not, etc.

Karl