SQL Server:列可为空性不一致
时间:2020-03-05 18:55:06 来源:igfitidea点击:
我有一个只能使用还原的SQL Server 2005数据库
Restore Database The_DB_Name From Disk = 'C:\etc\etc' With Continue_After_Error
有人告诉我源数据库很好。还原报告
Warning: A column nullability inconsistency was detected in the metadata of index "IDX_Comp_CompanyId" (index_id = 2) on object ID nnnnn in database "The_DB_Name". The index may be corrupt. Run DBCC CHECKTABLE to verify consistency.
DBCC CHECKTABLE (Company)
给
Msg 8967, Level 16, State 216, Line 1 An internal error occurred in DBCC that prevented further processing. Contact Customer Support Services. Msg 8921, Level 16, State 1, Line 1 Check terminated. A failure was detected while collecting facts. Possibly tempdb out of space or a system table is inconsistent. Check previous errors.
Alter Index IDX_Comp_CompanyId On dbo.Company Rebuild
给我
Msg 824, Level 24, State 2, Line 1 SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:77467; actual 45:2097184). It occurred during a read of page (1:77467) in database ID 20 at offset 0x00000025d36000 in file 'C:\etc\etc.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
我有多少麻烦?
解决方案
回答
索引中的损坏几乎不像基表中的损坏那样严重,因为可以重建索引。
比较源数据库和目标数据库之间的表和索引定义。
同时检查两个服务器的版本。 (备份还原到服务器后是否自动升级)
删除并重新创建索引,然后重新运行CheckTable。