Sql-server 2005 Database File Recovery (consistency-based logical I/O errors detected)

Source: Internet
Author: User
Tags sql server books server error log

Today Sql-server database suddenly error:

SQL Server detected a consistency-based logical I/O error checksum is incorrect (should be: 0x7c781313, but actually: 0X67A313C9). In the file ' C:\Program Files\Microsoft SQL Server\mssql.1\mssql\data\e_block_db.mdf ', the offset is 0x00000000a34000 in the location of the page in database ID 5 (1 : 1306) The error occurred during read execution. Additional messages in the SQL Server error log or the system event log may provide more detailed information. This is a serious error condition that threatens the integrity of the database and must be corrected immediately. Please perform a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; For more information, see SQL Server Books Online.

For a long time, the solution is as follows:

First step: Establish a database with the same name, stop SQL SERVER2005, overwrite the. mdf database file and the. ldf file that cannot be opened, overwriting the two files of the newly created F database

Step Two: Restart the database

Step three: Run the following code in Query Analyzer:

ALTER DATABASE name set emergency-sets the database to a state of emergency

Use master

DECLARE @databasename varchar (255)

Set @databasename = ' database name '-Your. mdf file filename

exec sp_dboption @databasename, n ' single ', n ' true '-set the target database to single-user state

DBCC CHECKDB (@databasename, Repair_allow_data_loss)

DBCC CHECKDB (@databasename, Repair_rebuild)

exec sp_dboption @databasename, n ' single ', n ' false '-set the target data base to multi-user state

Fourth step: Perform the "Database other files do not match the database Master file ..." error, and then execute again.


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.