Monday, June 19, 2006

Reverse engineer the DDL

Here is how to reverse engineer the DDL commands. I've found this pretty useful sometimes. For example, in case you want to recreate the db and you want all the tablespace creation scrips. Instead of doin' it from scratch you can use the package, GET_METADA.GET_DDL to get the generate the script for you and then you can use these scripts to create the tablespaces once the db is recreated.
For example, to reverse engineer the tablespace creation script,
sql > set long 900000
sql > select DBMS_METADATA.GET_DDL('TABLESPACE','tablespace_name') from dual;
For example, if i want to get the tablespace creation script for the tablespace users, i use
sql > select DBMS_METADATA.GET_DDL('TABLESPACE','USERS') from dual;
and i set long as 900000 before doin' this, otherwise my output is truncated and i can't see the whole script.
To reverse engineer the table creation script,
select DBMS_METADATA.GET_DDL('TABLE','table_name') from dual;
You can do this to get the DDL of all the objects in the database.
Hope this helps.
-- Vish.

8 comments:

Laurence Jennings said...

This is excellent! Especially when a database contains hundreds of tablespaces...

Anonymous said...

Hi I'd like to congratulate you for such a great quality forum!
I was sure this would be a perfect way to introduce myself!

Sincerely,
Sage Brand
if you're ever bored check out my site!
[url=http://www.partyopedia.com/articles/50th-birthday-party-supplies.html]50th Birthday Party Supplies[/url].

Anonymous said...

Spot on with this write-up, I actually feel this amazing site needs a lot more attention.
I'll probably be back again to see more, thanks for the info!

Here is my weblog :: visit link

Anonymous said...

I've been browsing on-line greater than three hours lately, yet I by no means found any attention-grabbing article like yours. It's lovely price sufficient for me.
In my view, if all website owners and bloggers made
good content as you did, the internet will be a lot more useful than ever
before.

Feel free to surf to my web site: Know More

Anonymous said...

Please let me know if you're looking for a author for your weblog. You have some really great articles and I believe I would be a good asset. If you ever want to take some of the load off, I'd really like to write some articles
for your blog in exchange for a link back to mine.

Please blast me an e-mail if interested. Cheers!

Review my web blog website

Anonymous said...

Great blog here! Additionally your website a lot up fast!
What host are you the use of? Can I get your
associate link in your host? I want my website
loaded up as fast as yours lol

Anonymous said...

It is the best time to make some plans for the future and
it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or advice. Perhaps you can write next articles referring to this article. I wish to read more things about it!

Here is my weblog; poker sites for us players

Anonymous said...

electronic cigarette, ecig forum, electronic cigarettes, electronic cigarette reviews, electronic cigarette, ecigs