I have been told I need to create an sql script that recreates all of the tables/procedures/triggers/views/sequences, etc of my current database. Does anybody have any idea how I go about doing this? It is an oracle 10g express database.

link|improve this question
feedback

3 Answers

up vote 1 down vote accepted

DBMS_METADATA.GET_DDL is your friend.

And then invest some time in learning a source control tool such as SVN or GIT.

link|improve this answer
feedback

Another option is to go old school and do a no rows export via the exp command.

Setting ROWS=N in the exp parameter file will mean metadata only is exported, no actual data. You would use the imp command to restore that metadata.

Be aware exp generates a binary dump file - if you want SQL scripts use DBMS_METADATA as mentioned by Gary.

link|improve this answer
feedback

If you don't fancy getting to grips with DBMS_METADATA then you can use Oracle's free developer tool called SQL Developer which can create this script for you in a few clicks, either for the whole database, an object type, or just one object.

I'm all for learning the DBMS packages but in this case you'll be done and enjoying a hot beverage of your choice in less then the time it'll take to read up about GET_DEPENDENT_DDL.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.