Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rollback changes in SQL Server

By mistake I have updated data on production database. Is there any way to rollback those transactions. I have executed the update statement from management studio and the script does not have in Begin Trans/rollback/commit.

Thanks

like image 594
rmdussa Avatar asked Nov 25 '25 00:11

rmdussa


1 Answers

Here is what I would do in this case:

  1. Restore backup in separate database and compare these databases to recover rows that exist in backup?

  2. If your database is in full recovery mode try reading transaction log to recover the remaining rows.

In order to read transaction log you can use a third party tool such as ApexSQL Log or try to do this yourself through fn_dblog function (here is an example but it’s quite complex).

Here are other posts on this topic:

Read the log file (*.LDF) in SQL Server 2008

How can I rollback an UPDATE query in SQL server 2005?

like image 182
Dario Cage Avatar answered Nov 28 '25 17:11

Dario Cage