Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > Schema script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-04-08, 07:20
avihai avihai is offline
Registered User
 
Join Date: Jul 2003
Posts: 16
Schema script

Hey,

we have new product and i need to plain how to handle the DDL script.

1. in what structre should i use ? one scrips or to devide to tables script and fk scripts and etc? what DDL structre do you recommand?

2. what tool to use to run the scripts in the installation?

Thank you
Reply With Quote
  #2 (permalink)  
Old 01-04-08, 07:42
gbrabham gbrabham is offline
Registered User
 
Join Date: Apr 2003
Location: Greenville, SC (USA)
Posts: 1,143
You can use dbms_metadata.get_ddl (Oracle's package). This does a decent job. Personnally, I like to have a single file for each table, trigger, procedure, etc ... You can spool each out to a file that matches the table_name itself ...
Let SQL write the sql for you ... ie:

select a.index_name,
CURSOR (select dbms_metadata.get_ddl ('INDEX', p.index_name)
from dba_indexes P
where p.index_name = a.index_name)
from dba_indexes a
where a.owner = 'SCHEMANAME'

select 'SELECT dbms_metadata.get_ddl('||''''||'TABLE'||''''||','| |''''||TABLE_NAME||''''||','||''''||'OPENBAR'||''' '||') FROM DUAL;'
FROM USER_TABLES;


HTH
Gregg
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On