mdfÎļþÊÜË𣬻µµÀ¡£ÔÒòΪ£ºÕóÁÐÖÐÒ»º¬ÐÂÏÊÊý¾ÝµÄÓ²ÅÌË𻵶øÎÞ·¨ÐÞ¸´¼°Í¨¹ý¸÷ÖÖ°ì·¨Ò²²»ÄÜÌáÈ¡ÎïÀíÊý¾Ý£¬²»µÃÒÑʹÓÃÁ˺¬¹ýÆÚÊý¾ÝµÄÓ²Å̽øÐлָ´£»Æä½á¹û¿ÉÏë¶øÖª£¬Êý¾ÝÊDz»ÄÜÓõģ¬ÄÚº¬´óÁ¿´íÎ󣬱ØÐëÐÞ¸´²ÅÄÜʹÓã¬ÒÔ×î´óÏ޶ȵÄÍí»áËðʧ¡£
1¡¢ÏµÍ³±íάÐÞ
USE zygl3_data GO SELECT au.allocation_unit_id, OBJECT_NAME(p.object_id) AS table_name, fg.name AS filegroup_name, au.type_desc AS allocation_type, au.data_pages, partition_number FROM sys.allocation_units AS au JOIN sys.partitions AS p ON au.container_id = p.partition_id JOIN sys.filegroups AS fg ON fg.data_space_id = au.data_space_id WHERE au.allocation_unit_id = 72057594055098368 OR au.allocation_unit_id = 72057594055098368 ORDER BY au.allocation_unit_id GO
2¡¢¹ý³Ì
¾Ñ飬ʹÓÃsystools¹¤¾ßÔÚ2003ÏÂÔËÐкܿ죬ÔÚwin7-64ÏÂÔËÐкÜÂý£» µÚÒ»¸ösystools½ø³Ì£¬Õ¼ÓÃÄÚ´æºÜ´ó£¬ÒªÊ¹ÓÃ360¼ÓËÙ£¬µã»÷Ò»¼ü¼ÓËÙ¼´¿É£» ·ñÔòÄÚ´æÕ¼Óôﵽ½Ó½ü2Gʱ£¬³ÌÐò»á±ÀÀ££» µÚ¶þ¸öÎÒsystool½ø³Ì£¬±È½ÏºÃ£¬Ëüµ÷ÓÃÁËsqlwb.exe³ÌÐò£¬Ê¹µÃÖ÷³ÌÐòÕ¼ÓÃÄÚ´æ»ù±¾Îȶ¨£¬²»ÔÙÔö³¤£¬¶øsqlservrÕ¼ÓÃÔö³¤£¬²»¹ýÒ»°ã²»³¬¹ý1.8G¾Í²»ÔöÁË¡£
´ò¿ªsqlÆóÒµ¹ÜÀíÆ÷£¬Ö¸Ïòmaster£¬Ð½¨²éѯ¡£ Ö´ÐÐ alter database zygl3_data set emergency
Çå¿ÕÆÁÄ»
Ö´ÐÐÒÔÏÂÓï¾ä use master declare @databasename varchar(255) set @databasename=''zygl3_data'' exec sp_dboption @databasename, N''single'', N''true''½«Ä¿±êÊý¾Ý¿âÖÃΪµ¥Óû§×´Ì¬ dbcc checkdb(@databasename,REPAIR_ALLOW_DATA_LOSS) dbcc checkdb(@databasename,REPAIR_REBUILD) exec sp_dboption @databasename, N''single'', N''false''½«Ä¿±êÊý¾Ý¿âÖÃΪ¶àÓû§×´Ì¬
Õâʱºò£¬·¢ÏÖ·¾¶´íÎó£¬ÊÖ¹¤½¨Á¢ËùÐè·¾¶£»±¾ÀýÊÇÊÖ¹¤ÔÚDÅ̽¨Á¢sqldataĿ¼£¬
½Ó×ÅÖ´ÐÐÒÔÏÂÓï¾ä£¨ÓëÉÏÏàͬ£© use master declare @databasename varchar(255) set @databasename=''zygl3_data'' exec sp_dboption @databasename, N''single'', N''true''½«Ä¿±êÊý¾Ý¿âÖÃΪµ¥Óû§×´Ì¬ dbcc checkdb(@databasename,REPAIR_ALLOW_DATA_LOSS) dbcc checkdb(@databasename,REPAIR_REBUILD) exec sp_dboption @databasename, N''single'', N''false''½«Ä¿±êÊý¾Ý¿âÖÃΪ¶àÓû§×´Ì¬
ÈÕÖ¾ÎļþÉú³É£»ÒÔÉÏÊÇÔÚwin2003R2-32ϲÙ×÷Íê³É£¬ÔÚwin7-64&sql64ϲ»Í¨¹ý¡£ µ«ÊÇÊý¾Ý¿â´æÔÚ´íÎó:
USE zygl3_data GO SELECT au.allocation_unit_id, OBJECT_NAME(p.object_id) AS table_name, fg.name AS filegroup_name, au.type_desc AS allocation_type, au.data_pages, partition_number FROM sys.allocation_units AS au JOIN sys.partitions AS p ON au.container_id = p.partition_id JOIN sys.filegroups AS fg ON fg.data_space_id = au.data_space_id WHERE au.allocation_unit_id = 72057594055098368 OR au.allocation_unit_id = 72057594055098368 ORDER BY au.allocation_unit_id GO
´íÎóÐÅÏ¢SQL Server ¼ì²âµ½»ùÓÚÒ»ÖÂÐÔµÄÂß¼ I/O ´íÎó ҳ˺ÁÑ(Ç©ÃûÓ¦¸ÃΪ: 0xaaaaaaaa£¬µ«Êµ¼ÊΪ: 0x55aaaaaa)¡£ÔÚÎļþ ''F:\888¶«Óª\ok\zygl3_data.mdf'' ÖС¢Æ«ÒÆÁ¿Îª 0x00000000b8e000 µÄλÖöÔÊý¾Ý¿â ID 7 ÖеÄÒ³ (1:1479) Ö´ÐÐ ¶ÁÈ¡ Æڼ䣬·¢ÉúÁ˸ôíÎó¡£SQL Server ´íÎóÈÕÖ¾»òϵͳʼþÈÕÖ¾ÖеÄÆäËûÏûÏ¢¿ÉÄÜÌṩÁ˸üÏêϸÐÅÏ¢¡£ÕâÊÇÒ»¸öÍþвÊý¾Ý¿âÍêÕûÐÔµÄÑÏÖØ´íÎóÌõ¼þ£¬±ØÐëÁ¢¼´¾ÀÕý¡£ÇëÖ´ÐÐÍêÕûµÄÊý¾Ý¿âÒ»ÖÂÐÔ¼ì²é(DBCC CHECKDB)¡£´Ë´íÎó¿ÉÒÔÓÉÐí¶àÒòËص¼Ö£»ÓйØÏêϸÐÅÏ¢£¬Çë²ÎÔÄ SQL Server Áª»ú´ÔÊé¡£
DBCC CHECKDB ÏûÏ¢ 7985£¬¼¶±ð 16£¬×´Ì¬ 2£¬µÚ 1 ÐРϵͳ±íÔ¤¼ì²é: ¶ÔÏó ID 4¡£ÎÞ·¨Ê¹ÓÃãÅËøÀàÐÍ SH ¶ÁÈ¡²¢ãÅËøÒ³ (1:600071)¡£ÓÉÓÚ²»¿ÉÐÞ¸´µÄ´íÎó£¬CHECK Óï¾äÒÑÖÕÖ¹¡£ zygl3_dataµÄ DBCC ½á¹û¡£ ÏûÏ¢ 5233£¬¼¶±ð 16£¬×´Ì¬ 98£¬µÚ 1 ÐÐ ±í´íÎó: ·ÖÅäµ¥Ôª ID 262144£¬Ò³ (1:600071)¡£²âÊÔ(IS_OFF (BUF_IOERR, pBUF->bstat))ʧ°Ü¡£ÖµÊÇ 12716297 ºÍ -1¡£ CHECKDB ·¢ÏÖÓÐ 0 ¸ö·ÖÅä´íÎóºÍ 1 ¸öÒ»ÖÂÐÔ´íÎóÓëÈκε¥¸öµÄ¶ÔÏó¶¼Ã»ÓйØÁª¡£ CHECKDB ÔÚÊý¾Ý¿â ''zygl3_data'' Öз¢ÏÖ 0 ¸ö·ÖÅä´íÎóºÍ 1 ¸öÒ»ÖÂÐÔ´íÎó¡£
select * from sysobjects ÏûÏ¢ 824£¬¼¶±ð 24£¬×´Ì¬ 2£¬µÚ 1 ÐÐ SQL Server ¼ì²âµ½»ùÓÚÒ»ÖÂÐÔµÄÂß¼ I/O ´íÎó ҳ˺ÁÑ(Ç©ÃûÓ¦¸ÃΪ: 0xaaaaaaaa£¬µ«Êµ¼ÊΪ: 0x55aaaaaa)¡£ÔÚÎļþ ''E:\zygl3zc_Data\zzz\zygl3_data.mdf'' ÖС¢Æ«ÒÆÁ¿Îª 0x0000018fd1a000 µÄλÖöÔÊý¾Ý¿â ID 5 ÖеÄÒ³ (1:818829) Ö´ÐÐ ¶ÁÈ¡ Æڼ䣬·¢ÉúÁ˸ôíÎó¡£SQL Server ´íÎóÈÕÖ¾»òϵͳʼþÈÕÖ¾ÖеÄÆäËûÏûÏ¢¿ÉÄÜÌṩÁ˸üÏêϸÐÅÏ¢¡£ÕâÊÇÒ»¸öÍþвÊý¾Ý¿âÍêÕûÐÔµÄÑÏÖØ´íÎóÌõ¼þ£¬±ØÐëÁ¢¼´¾ÀÕý¡£ÇëÖ´ÐÐÍêÕûµÄÊý¾Ý¿âÒ»ÖÂÐÔ¼ì²é(DBCC CHECKDB)¡£´Ë´íÎó¿ÉÒÔÓÉÐí¶àÒòËص¼Ö£»ÓйØÏêϸÐÅÏ¢£¬Çë²ÎÔÄ SQL Server Áª»ú´ÔÊé¡£
select * from sysindexes ÏûÏ¢ 824£¬¼¶±ð 24£¬×´Ì¬ 2£¬µÚ 1 ÐÐ SQL Server ¼ì²âµ½»ùÓÚÒ»ÖÂÐÔµÄÂß¼ I/O ´íÎó ҳ˺ÁÑ(Ç©ÃûÓ¦¸ÃΪ: 0xaaaaaaaa£¬µ«Êµ¼ÊΪ: 0x55aaaaaa)¡£ÔÚÎļþ ''E:\zygl3zc_Data\zzz\zygl3_data.mdf'' ÖС¢Æ«ÒÆÁ¿Îª 0x0000018fd1a000 µÄλÖöÔÊý¾Ý¿â ID 5 ÖеÄÒ³ (1:818829) Ö´ÐÐ ¶ÁÈ¡ Æڼ䣬·¢ÉúÁ˸ôíÎó¡£SQL Server ´íÎóÈÕÖ¾»òϵͳʼþÈÕÖ¾ÖеÄÆäËûÏûÏ¢¿ÉÄÜÌṩÁ˸üÏêϸÐÅÏ¢¡£ÕâÊÇÒ»¸öÍþвÊý¾Ý¿âÍêÕûÐÔµÄÑÏÖØ´íÎóÌõ¼þ£¬±ØÐëÁ¢¼´¾ÀÕý¡£ÇëÖ´ÐÐÍêÕûµÄÊý¾Ý¿âÒ»ÖÂÐÔ¼ì²é(DBCC CHECKDB)¡£´Ë´íÎó¿ÉÒÔÓÉÐí¶àÒòËص¼Ö£»ÓйØÏêϸÐÅÏ¢£¬Çë²ÎÔÄ SQL Server Áª»ú´ÔÊé¡£
select * from syscolumns ÏûÏ¢ 824£¬¼¶±ð 24£¬×´Ì¬ 2£¬µÚ 1 ÐÐ SQL Server ¼ì²âµ½»ùÓÚÒ»ÖÂÐÔµÄÂß¼ I/O ´íÎó ҳ˺ÁÑ(Ç©ÃûÓ¦¸ÃΪ: 0xaaaaaaaa£¬µ«Êµ¼ÊΪ: 0x55aaaaaa)¡£ÔÚÎļþ ''E:\zygl3zc_Data\zzz\zygl3_data.mdf'' ÖС¢Æ«ÒÆÁ¿Îª 0x0000018fd1a000 µÄλÖöÔÊý¾Ý¿â ID 5 ÖеÄÒ³ (1:818829) Ö´ÐÐ ¶ÁÈ¡ Æڼ䣬·¢ÉúÁ˸ôíÎó¡£SQL Server ´íÎóÈÕÖ¾»òϵͳʼþÈÕÖ¾ÖеÄÆäËûÏûÏ¢¿ÉÄÜÌṩÁ˸üÏêϸÐÅÏ¢¡£ÕâÊÇÒ»¸öÍþвÊý¾Ý¿âÍêÕûÐÔµÄÑÏÖØ´íÎóÌõ¼þ£¬±ØÐëÁ¢¼´¾ÀÕý¡£ÇëÖ´ÐÐÍêÕûµÄÊý¾Ý¿âÒ»ÖÂÐÔ¼ì²é(DBCC CHECKDB)¡£´Ë´íÎó¿ÉÒÔÓÉÐí¶àÒòËص¼Ö£»ÓйØÏêϸÐÅÏ¢£¬Çë²ÎÔÄ SQL Server Áª»ú´ÔÊé¡£
´¦Àí²½Ö裺 µÚÒ»²½£º ´¦Àí¿ÉÒÔ·ÃÎʵÄÊý¾Ý±í (1.1) ÕÒ³öÄÄЩ±í²»¿É·ÃÎÊ£»   н¨Á¢Ò»¸ösql svrÊý¾Ý¿â£¬Êý¾Ý¿âʵÌåÃûΪAisNew¡£½øÈë²éѯ·ÖÎöÆ÷£¬Ö´ÐÐÈçÏÂSQL£º use zygl3_data DECLARE @TbName VARCHAR(80) DECLARE FindErrTable SCROLL CURSOR FOR    select name from zygl.dbo.sysobjects where xtype=''u'' order by name OPEN FindErrTable FETCH FindErrTable INTO  @TbName   WHILE @@FETCH_STATUS<>-1     BEGIN           print  @TbName           exec( ''select top 1 * from'' +  @TbName)           FETCH FindErrTable INTO  @TbName     END PRINT ''Scan Complate¡'' CLOSE FindErrTable DEALLOCATE FindErrTable
************************ ALTER  DATABASE  zygl3_data  set  SINGLE_USER    Go                    ½«Êý¾Ý¿âÉèÖÃΪµ¥Óû§Ä£Ê½ DBCC  CHECKDB (zygl3_data, repair_allow_data_loss)  with NO_INFOMSGS  go    ÔÊÐí¶ªÊ§Êý¾Ý   ALTER  DATABASE  zygl3_data  SET  MULTI_USER   go 
|