1

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.

3
  • Just back up the database like normal people. Commented May 16, 2009 at 1:54
  • Khb, i think you're missing the point here. I don't intend to use these scripts as a backup method we'll do that for the production db. What i want to do is set base point, from which any new development is made. We can then better identify what changes are made, when and by whom. Commented May 16, 2009 at 8:42
  • I was missing the point and apologize, you could try having a look at the user_source/all_source tables. Commented May 16, 2009 at 12:45

3 Answers 3

5

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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).

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.