Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Revert Back Changes from Update query

 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Proper QA comes to mind.
 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is an drawback of database there's must be an option for it...
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any such option in SQL 2005 ??
 
Bill Karwin
author
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic