Recovery method for SQL 2005 log corruption

Source: Internet
Author: User

SQL in the event of a sudden power outage or abnormal shutdown, a date file error may occur, causing the database to be unhealthy. The recovery database method is as follows

1. The database service stops backing up the database file, such as a database named Dtms, dtms.mdf back up.

2. Open the database service and create an empty database with the same name as Dtms.

3. Close the database service and overwrite the original dmts.mdf of the backup to the newly created database directory.

4. Execute the following statement under Master

--Modify database for state of emergency
ALTER DATABASE DTMS set EMERGENCY

--Set the database as a single user
ALTER DATABASE Dtms SET single_user

--Repair log files
DBCC CHECKDB (' Dtms ', Repair_allow_data_loss)
DBCC CHECKDB (' Dtms ', repair_rebuild)

--Set the database to multi-user
ALTER DATABASE Dtms SET multi_user
--Place the database online
ALTER DATABASE DTMS set ONLINE

Recovery method for SQL 2005 log corruption

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.