Recovery of mistakenly deleted data in SQL Server

Source: Internet
Author: User
Recovering from accidental deletion of data in SQL Server is not a difficult task to recover from the transaction log. However, this recovery requires two prerequisites:

1. There is at least one full backup of the database before it is mistakenly deleted.

2. The recovery model of the database (Recovery mode) is "full".

There are three scenarios for both of these prerequisites:

Situation one, if both prerequisites exist, the SQL statement can be restored in just three steps (refer to the article) without the need for a third-party tool (Recovery for SQL Server).

A) Back up the transaction log for the current database: BACKUP log [database name] to disk= N ' backup file name ' with NORECOVERY

b) Restore a full backup before deleting it: Restore database [DB name] from DISK = N ' full backup filename ' with NORECOVERY, REPLACE

c) Restore the database to a point in time before it was mistakenly deleted: Restore log [database] from DISK = n ' first step of log backup filename ' with STOPAT = n ' mistakenly deleted before the point in time ', RECOVERY

Situation two, if the 1th precondition does not exist, the 2nd precondition exists, need to use third-party tool.

Situation three, if the 2nd precondition does not exist, cannot recover. Therefore, be sure to set the database recovery mode to full.

Recovery of mistakenly deleted data in SQL Server

Related Article

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.