Use the transaction log to recover data loss due to update, delete misoperation

Source: Internet
Author: User
Recovery | Data maybe a lot of friends have encountered this problem:
The update or DELETE statement forgets the WHERE clause, or the WHERE clause is not accurate enough to cause serious consequences after execution,
Data recovery in this case can only take advantage of the transaction log backup, so if your SQL does not have a corresponding full library backup
Or cannot back up the log (Truncate Log on Checkpoint option is 1), then data recovery is not possible, or
Only the data for the most recent backup can be recovered.

The following is a brief description of the recovery data method:
1, if there is a full library backup (or there are multiple differential or incremental backups) before the misoperation, the first thing to do is to
Make a log backup (if you want to trunc the log file to make it larger.) Log on chkpt. option is 1 then you're dead.
Backup LOG dbname to disk= ' FileName '
2, restore a whole-library backup, note that you need to use with NORECOVERY, if there are other differences or incremental backup, and then resume
Complex
Restore Database dbname from disk= ' FileName ' with NORECOVERY
3, restore the last log backup that is just a log backup, specify the restore time point to the moment before the error
Restore log dbname from disk= ' FileName '
With stopat= ' Date_time '

All of these actions can be done in SQL Server Enterprise Manager, not very difficult ...

Of course, if the misoperation is some do not log operations such as truncate table,select into such operations, it is not good
Using the above method to recover the data ...



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.