Script Update production database table from Test databas tables

I have Production  database  and Test database environment for Oracle db.
 In production I have script that update table tbl_A from tbl_B; tbl_C; tbl_D.
In test database I have the same script that update my tbl_A from tbl_B; tbl_C; tbl_D which have different data that production tables.

Now I would like to run the same sript in production to update my production tbl_A but from  my test  tables.
How to do that.
Who is Participating?
SujithConnect With a Mentor Data ArchitectCommented:
You might try this

1. Backup your original tables as Tbl_A_bak, etc
2. Create a Tbl_D_Tmp in prod with the same structure as tbl_D
3. Upload data from test into Tbl_D_Tmp in prod. You can use external table or SQL Loader or scripts or import or whatever method is convenient
4. Run your update on Tbl_A using Tbl_D_Tmp
5. After verification you may drop the backups and tmp tables
slightwv (䄆 Netminder) Commented:
I don't understand what you are trying to do.

It sounds like you had a script to clean up some test data and you cannot just run that script in production?

Are you wanting to take your test tables and move them into production or do you want to do a merge from test into production?
TarasAuthor Commented:
I will try to explain it as I am new In this I could sound not clear.

I want to update a field in my table  tbl_A in production database. That field is updated with a value of a field from table tbl_D.
For that I am using update script that  has four tables in;
tbl_A - table that will be updated
 tbl_B - connection table
tbl_C - connection table
tbl_D  – table that have new value that will be updated in table tbl_A.

Let say I copy my tables tbl_A; tbl_B; tbl_C_; tbl_D from Production to Test database.
In test database did some changes in table tbl_D,   I added couple records in table tbl_D or changes to existing records in table tbl_D both scenarios are possible.

For some reason I could not do that changes in Production as I did in Test database.

Now I would like to run update script in Production database to update my tbl_A but against test tables data as they have that changed record/s in tbl_D.
What is proper way to do this?
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

slightwv (䄆 Netminder)Connect With a Mentor Commented:
It is dangerous to mix test and production but I'm guessing you know what you are doing.

Can you create a database link from Production to the Test database?  If so, you can run your update and access production and test tables in the same script.

If not, you might need to export the test tables and import them into a different schema, that you create for this process, in the production database.  Then you can access both sets of tables.  When you are done, just drop the temporary schema you created.
TarasAuthor Commented:
Thank you a lot.
SujithData ArchitectCommented:
Thank you for promptly closing the thread.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.