Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003

    Unanswered: generating scripts in oracle??

    Hi there!

    i spent the last few years working with sql server and now it's time for oracle. so i have several questions....
    is it possible to generate a script of tables from one schema that can be ran to produce the same tables in a schema of a different name - (like making a .sql file in sql server and executing it in query analyser).

    thanks for any help!

  2. #2
    Join Date
    Apr 2003
    Greenville, SC (USA)
    Here's a script that will create a file containing the DDL to recreate
    a table ... pass it the owner, table_name that you want to recreate...
    At the end of this script is a "spool" statement... Change it to match
    your configuration .. I usually write sql to build my sql ....

    ie, to build scripts for ALL tables in a schema ...

    sql> spool c:\rebuild_tables.sql
    sql> select '@c:\...\gen_tbl owner||' table_name' from user_tables
    order by table name;
    sql> spool off

    This will build a script call rebuild_tables.sql that I can run to create
    scripts for ALL tables in a schema.... This will create 1 script file
    for every table (named for the table it is to be used for ...)...

    You can also do triggers, constraints, procs, functions ... etc in similiar
    manner with other scripts

    HTH and good luck
    Attached Files Attached Files

  3. #3
    Join Date
    Nov 2003
    perfect - thanks 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