Ask the Expert

Copy data from one schema to a different schema

I want to copy data from one schema (let's call it PROD) to another (let's call it TEST) for testing purposes. I already have these two schemas in the database. The issue is the two schema are not exactly the same: TEST is incomplete regarding PROD. I thought I could do this:
exp userid=xxx/xxx file=my_db.dmp 
log=my_db.log owner=PROD
drop the TEST schema, re-create the TEST user in the DB, then
imp userid=xxx/xxx file=my_db.dmp 
log=imp.log fromuser=PROD touser=TEST
Is it a correct way to do this or is there a simpler way?

    Requires Free Membership to View

The steps you described above are among the simplest. The nice thing about using export/import for this task is that you get an entire copy of the schema. You could use INSERT SELECT statements to copy the data, but then you might miss other schema objects. And INSERT SELECT won't modify the table structure either. Your steps above are how I tackle this task.

This was first published in April 2007

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: