Recover the SQL Server database from the log to the time point

Source: Internet
Author: User
In DB2, the database can be restored to the specified time point. When the SQL Server database recovery model is full or bulk copy, the database can be recovered from the log. In fact, one of the statements recorded in the log redo these SQL statements when restoring the database. Prerequisites: mybbs is a table in the test database. The recovery model of the test database is full, auto close, and auto shrink. The data files and log files of the database test are automatically increasing by default. A: perform database backup at, 1600, and backup database test to disk = 'd:/DB. bak 'with initb: 2004/10/14, and other database update and delete operations; C: 2004/10/15, when Delete mybbs where ID> 300 is used, the statement is mistakenly written as delete mybbs, therefore, all data in the table mybbs is deleted. At point C, the database is mistakenly operated. We hope that the database can be restored to the status before C, for example, to the status at on January 1, October 15. To restore database B, use the database 1600.bakwith the backup score of point A, and use the latest backup score of 1820. therefore, perform the following operations: -- backup log: backup log test to disk = 'd:/1820. logs 'with init -- Restore database 1600.bak, use the with norecovery parameter: Restore database test from disk = 'd:/DB/1640. bak 'with norecovery -- use the log to restore the database until, January 1, October 15: Restore Log Test from disk = 'd:/1820. logs 'with recovery, stopat = '2014/1/41' corresponding processes of the preceding three statements: 1. restore the database to point A. 2. execute the log record between the A-B and restore the database to point B. in this way, the database will be restored. To the specified time point. If the recovery fails, the possible cause is: 1. The correct backup database is not used; 2. The database option selects auto shrink.
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.