For a single database error, run this fix not. Then I was able to run it in tempdb.
DBCC CHECKDB (' tempdb ')
In fact, there was another mistake at the beginning:
An attempt to extract a logical page (1:1640) in database 5failed. This logical page belongs to the allocation unit XXX, not xxx.
Use Master declare @databasename varchar (255) Set@databasename ='the name of the database entity that needs to be repaired'exec sp_dboption @databasename, N' Single'N'true'--set the target data library to single-user status DBCC CHECKDB (@databasename, Repair_allow_data_loss) DBCC CHECKDB (@databasename, Repair_rebuild) E Xec sp_dboption @databasename, N' Single'N'false'--Set the target data base to multi-user state
This has no effect, running to half the error, there is nothing to do. Helpless under TRUNCATE TABLE test, and then insert data from the new. Of course, the premise of doing this is that your data is backed up. Otherwise, it is not readable from the corrupted table.
This table fixes the method also does not have the use.
use the name of the database entity that needs to be repaired declare @dbname varchar (255) Set@dbname ='name of the database to be repaired'exec sp_dboption @dbname,'Single user','true'DBCC CHECKTABLE ('name of the data table to be repaired', Repair_allow_data_loss) DBCC CHECKTABLE ('name of the data table to be repaired', Repair_rebuild)------Change the name of the data table that needs to be repaired to the name of the data table that executes the DBCC CHECKDB times error exec sp_dboption @dbname,'Single user','false'
DBCC dbreindex (table name, ') fixes all indexes on this table. This method is useless.
DBCC Checkalloc
Checks the consistency of the disk space allocation structure for the specified database. This is not enough for me to see any problems.
The larger the database, the longer the repair. or be ready to back up at any time.
I system win10+sql2008, in the installation of sql2008 when the system is not compatible, but can be installed successfully and run, not clear what causes. Hope to have a master can answer. I have never met this problem before in Win7.
SQL Server detected a consistency-based logical I/O error checksum is incorrect | | Attempt to extract logical page (1:1640) in database 5 failed