Q

Copy data from one schema to a different schema

I want to copy data from one schema to another for testing purposes. The issue is the two schema are not exactly the same.

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?
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

Dig deeper on Oracle database design and architecture

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close