Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Update Live db Table From Like Dev db Table

$
0
0
Code:

greetings all-

We work on Oracle 11g on a Ubuntu 12.4 Server.  We have a Develpment Oracle DB that is the same as our Live DB.  They are not mirrored in the sense that they have the exact same data all the time.  We have to manually sync the dev db to the live (or certain schema/tables) as we need to or wish to.

I needed to add a new column to the same table on both Live and Dev DBs.  Through a shell script I updated over 1 million records in the table on our Dev db.  I now need to do the same on our Live db.  I do not want to run the script as it does a log of sub-querys to get the info and takes over 12 hours to run.  Now that I have the Dev db table set, I'd like to run a simple query in Oracle to update the Live DB table with the new field values from the Dev DB table/field.

I have public db link set up and it works.  What I need is the query.  I created two test tables to make certain I wouldn't bungle up the tables or the db with a bad query.

Note, I could import the dev table to the Live db, but that would over-write any current data that has been added since my script last ran.  New records are getting inserted into the new field on Live.  So, a query is what I'd like to use.


test_jdc table test on Dev

FIRST                LAST                NBR                   
-------------------- -------------------- ----------------------
john                doe                  1                     
jim                  foo                  2                     
joe                  bar                  3                     
june                cleaver              6                     
jane                jones                4                     
sue                  que                  5                     
betty                bop                  7


test_jdc table on Live DB:

Code:

FIRST                LAST                NBR                   
-------------------- -------------------- ----------------------
john                doe                  0                     
jim                  foo                  0                     
joe                  bar                  0                     
june                cleaver              0                     
jane                jones                0                     
sue                  que                  0                     
betty                bop                  0

Would anyone know a query to update all the 0's (zeros) to the appropriate numbers from the Dev db table?

Doesn't work:
Code:

Update webadmin.test_jdc
  set nbr = (select nbr from webadmin.test_jdc@shadev);

The '@shadev' is the public db link that allows me to access the Dev db from the Live one.

Thanks for any suggestions.
-john

Viewing all articles
Browse latest Browse all 13329

Trending Articles