Home> Database> SQL> body text

How to recover deleted data from sql database

(*-*)浩
Release: 2020-09-15 17:53:34
Original
36342 people have browsed it

It is not difficult to recover accidentally deleted data in SQL Server. It can be recovered from the transaction log. However, this recovery requires two prerequisites:

How to recover deleted data from sql database

SQL database data recovery method:

1. At least one A previous full backup of the database was accidentally deleted.

2. The recovery mode of the database is "Full".

Regarding these two prerequisites, there will be three situations:

Situation 1. If these two prerequisites exist, it can be restored in only three steps through SQL statements (without the help of Third-party tools.

a) Back up the transaction log of the current database: BACKUP LOG [database name] TO disk= N'backup file name' WITH NORECOVERY

b) Restore a transaction log before it was accidentally deleted Full backup: RESTORE DATABASE [database name] FROM DISK = N'full backup file name' WITH NORECOVERY, REPLACE

c) Restore the database to the time point before accidental deletion: RESTORE LOG [database] FROM DISK = N'The name of the log backup file in the first step' WITH STOPAT = N'The time point before the accidental deletion', RECOVERY

Case 2: If the first prerequisite does not exist and the second prerequisite exists, Requires third-party tools.

Case 3: If the second prerequisite does not exist, recovery cannot be performed. Therefore, be sure to set the database recovery model to "Full".

In the second case, you need to find a third-party tool.

Recommendation: Finally found Recovery for SQL Server on officerecovery.com. Although it is also a commercial software and needs to be purchased, the Demo version can recover data as long as the database file does not exceed 24Gb. Fortunately, my friend's database file is not large and I used it to recover accidentally deleted data.

The above is the detailed content of How to recover deleted data from sql database. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
sql
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!