Q

Copying updated table from test to production system

We make updates and additions to an item table in our test system, and we want to copy that table to the production system without taking production down. I tried to truncate the production item table and insert all of the rows from a temporary item table with the following commands:

     truncate table item
     go

     insert item
     select *
     from item_tmp
     go
This works, but I have to take the production system down to use this. I was hoping to use a cursor and delete a row, then insert the corresponding row from the temp table so that only that item would be locked and I wouldn't have to take the production system down. In Oracle, I can declare a cursor and define a cursor record using the cursor_name%ROWTYPE, then I can delete the item in the production table and insert the current value of the cusor record. Sybase will only let you do updates and deletes with a cursor, no inserts. I also don't want to define each column from the table in the cursor, there are close to 100 columns in the table.

Actually I do not think this is the best way of dealing with this issue.

If you want effectively to use the test table "item" data as the production table all you need is to create a proxy table in production which will be the test table itself. In that case whatever happens to test table data (insert/update/delete) all will be reflected in the production real time. To clarify this point, the user will use the proxy "item" table in production which in reality will be your test table. This will avoid the issue of using cursors, etc., which are inefficient in both Sybase and Oracle. If you need more info please come back.


This was first published in November 2003

Dig deeper on Open source databases

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:

-ADS BY GOOGLE

SearchDataCenter

SearchServerVirtualization

SearchCloudComputing

SearchEnterpriseDesktop

Close