Results 1 to 2 of 2

Thread: Schema script

  1. #1
    Join Date
    Jul 2003
    Posts
    24

    Unanswered: 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

  2. #2
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •