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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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?
slightwv (䄆 Netminder) 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.
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

SujithData 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TarasAuthor Commented:
Thank you a lot.
SujithData ArchitectCommented:
Thank you for promptly closing the thread.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.