aspose file tools*
The moose likes JDBC and the fly likes Revert Back Changes from Update query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Revert Back Changes from Update query" Watch "Revert Back Changes from Update query" New topic
Author

Revert Back Changes from Update query

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

Hi,

Yesterday I'd run an updated query and forget to put an where caluse in it result 10,000 rows updated and application ruined because of it. Grace of GOD I have tha back up for that database otherwise I was in a big dumb daze...My question is can we revert back the changes once performed an Update query on DB...I search it on net but not found proper result for it...the final result I come to know that is->Better to put safety before running any update query or prepare back up for your DB ... Any thing perticular you know about this issue..?

[fixed typo in subject]


No Kaustubh No Fun, Know Kaustubh Know Fun..
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

If the transaction in which the update query runs isn't committed, it can be rolled back. Otherwise, you'll have to restore a backed up version.


[My Blog]
All roads lead to JavaRanch
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Proper QA comes to mind.
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

I think this is an drawback of database there's must be an option for it...
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
No. If you delete a file from the file system it's gone too, unless you made a backup. If you throw out something in your household it's gone too, unless you made provisions to recreate or retrieve it. Why would a DB be different? If you weren't sure that updating data was the right thing to do, then why did you tell the DB to do it?
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
On Oracle, starting from version 10g, there is a facility named "flashback query".
You can restore a whole table/tables or only a part of the table (individual rows) without actually restoring complete database from the backup.
If you are using Oracle, read this: http://www.orafaq.com/node/50
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

Any such option in SQL 2005 ??
Bill Karwin
author
Ranch Hand

Joined: Aug 02, 2010
Posts: 32
Kaustubh G Sharma wrote:Any such option in SQL 2005 ??


I have read about a third party product called Redgate SQL Log Rescue. Their product description says:

if you have accidentally deleted, inserted or modified your database, SQL Log Rescue will help you get the data back.


http://www.red-gate.com/products/SQL_Log_Rescue/index.htm

Sorry I haven't used it myself so I can't say from experience whether it would work in your case.


Bill Karwin is the author of SQL Antipatterns: Avoiding the Pitfalls of Database Programming
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

Thanks Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Revert Back Changes from Update query