sqlserver2008 Restore database based on log

Source: Internet
Author: User
Tags backup

Foreword: The recent project close to the end, followed by the maintenance problem, of course, related to database maintenance data, through the data and the actual operation of the error after the operation of the database restore according to the log.

Prerequisite: ① must have a full backup of the database (make a backup plan); ② the database recovery mode is complete (full).

Step: When ① discovers a misoperation, record the Point-in-time date and back up the log file (Backup script: Use master BACKUP log database to Disk=n ' G:cclog.bak ' with NORECOVERY);

② Restore the database (Restore script: Use master RESTORE database databases from DISK = N ' G:cc.bak ' with NORECOVERY, REPLACE);

③ Restore log (Restore Log script: Use master restore log database from DISK = n ' g:cclog.bak ' with STOPAT = N ' Date ', RECOVERY);

④ above 3 steps are successful, then restore success, at this time to view the database found the wrong deletion of the data back again.

Description: ① "NORECOVERY" is used to back up the log, so back to the time the database is restored, other processes can no longer access the database, the log will not be increased, so that when the restoration can be normal recovery. When restoring a backup, if you want to restore the log after the same time, you must add norecovery to restore the log.

The ② time point "date" format is "m/d/yyyy h:m:s PM", which is a 12-hour system, for example: 1/23/2014 1:17:10 PM says January 23, 2014 1:17 P.M. 10 seconds, as long as it is possible before the error operation.

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.