Importing an exported file into an existing db
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: Importing an exported file into an existing db

  1. #1
    Join Date
    Mar 2005
    Posts
    143

    Importing an exported file into an existing db

    I run nightly exports in our production 9i database. I have several testing databases that are setup just like our production one. I need to refresh one of our test db's from our production db as of last night. I was going to use the export file. I export the entire schema that our application uses. Do I need to trucate all the tables in the test db's schema before I do the import? If I do is there a command to truncate all tables in a schema rather then doing it one table at a time? Can I just run the import and tell it to over-write the data allready there?

  2. #2
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,331
    why not just drop the user and do a full user import?

    but yes you woul dhave to truncate all the tables or drop them, and no there is no one command to do that, you would have to use a plsql loop

  3. #3
    Join Date
    Mar 2004
    Location
    DC,USA
    Posts
    650
    If you cant script the plsql loop, then TOAD will do it for you.

    Best is to drop the schema and import.
    "What is past is PROLOGUE"

  4. #4
    Join Date
    Mar 2005
    Posts
    143
    Thanks, but I ended up not doing the import. I recovered the db from a backup of production. DBASAN, I looked in toad just so I know in the future, and is there anyother way to do it in toad other then highlighting all the tables right clicking and choosing truncate? That is the only way I could see doing this in toad.

  5. #5
    Join Date
    Jun 2006
    Posts
    259
    Or even simpler:
    spool trunc_tbls.sql
    select 'truncate table '|| table_name|| ';' from user_tables;

    spoolf off;

    then run the script, trunc_tbls.sql... Well of course this means that you must have disabled all FK's... But you could do that using the same technique.

  6. #6
    Join Date
    Mar 2004
    Location
    DC,USA
    Posts
    650
    Quote Originally Posted by jayjabour
    That is the only way I could see doing this in toad.
    "What is past is PROLOGUE"

Posting Permissions

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



Click Here to Expand Forum to Full Width