SQL Error Operation Recovery Experiment

Source: Internet
Author: User
Tags sql error

There are two required conditions to recover directly from an SQL statement:

First, the database after the creation of a complete backup;

Second, the Database recovery model (Recovery mode) is "full".

Recovery steps:

1. BACKUP LOG [DataBase] to disk= N ' D:\testlog ' with NORECOVERY

Back up the current log and make sure to back up the current log in case of mis-operation

2, RESTORE database [Database] from DISK = ' d:\test ' with NORECOVERY, REPLACE

Restore the database to the previous full backup record, such as fear of problems, you can create a new database to restore

3.RESTORE LOG [DataBase] from DISK = ' d:\testlog ' with stopat= ' 2:12am ', nounload, STATS = ten

Restore the current log to the database

Note:

(1), such as in the first step operation when prompted to not exclusive database, you can first separate the database, and then attach the OK;

(2), can be obtained by the print GetDate () to get the time format, this problem has made me n long ....

(3), such as after the recovery of the database has been in the restore state, you can execute the following command

RESTORE database [DB name] with RECOVERY

Next try to recover through the software, find more free methods, be prepared!

SQL Error Operation Recovery Experiment

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.