±¾ÎÄÖ÷Òª¸ÅÀ¨°²×°Ê±ÌáʾÓйÒÆðµÄ²Ù×÷¡¢ÊÕËõÊý¾Ý¿â¡¢Ñ¹ËõÊý¾Ý¿â¡¢×ªÒÆÊý¾Ý¿â¸øÐÂÓû§ÒÔÒÑ´æÔÚÓû§È¨ÏÞ¡¢¼ì²é±¸·Ý¼¯¡¢ÐÞ¸´Êý¾Ý¿âµÈ²Ù×÷¼¼ÇÉ¡£
1.¹ÒÆð²Ù×÷
ÔÚ°²×°SQL»òSP²¹¶¡µÄʱºòϵͳÌáʾ֮ǰÓйÒÆðµÄ°²×°²Ù×÷£¬ÒªÇóÖØÆô£¬ÕâÀïÍùÍùÖØÆôÎÞÓ㬽â¾ö°ì·¨£º
µ½HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession Managerɾ³ýPendingFileRenameOperations¡£
2.ÊÕËõÊý¾Ý¿â
Öؽ¨Ë÷Òý£º
DBCC REINDEX
DBCC INDEXDEFRAG |
ÊÕËõÊý¾ÝºÍÈÕÖ¾£º
DBCC SHRINKDB
DBCC SHRINKFILE |
3.ѹËõÊý¾Ý¿â
dbcc shrinkdatabase(dbname) |
4.תÒÆÊý¾Ý¿â¸øÐÂÓû§ÒÔÒÑ´æÔÚÓû§È¨ÏÞ
exec sp_change_users_login "update_one","newname","oldname"
go |
5.¼ì²é±¸·Ý¼¯
RESTORE VERIFYONLY from disk="E:dVBbs.bak" |
6.ÐÞ¸´Êý¾Ý¿â
ALTER DATABASE [dvbbs] SET SINGLE_USER
GO
DBCC CHECKDB("dvbbs",repair_allow_data_loss) WITH TABLOCK
GO
ALTER DATABASE [dvbbs] SET MULTI_USER
GO |
CHECKDB ÓÐ3¸ö²ÎÊý£º
REPAIR_ALLOW_DATA_LOSS£ºÖ´ÐÐÓÉ REPAIR_REBUILD Íê³ÉµÄËùÓÐÐÞ¸´£¬°üÀ¨¶ÔÐкÍÒ³½øÐзÖÅäºÍÈ¡Ïû·ÖÅäÒÔ¸ÄÕý·ÖÅä´íÎ󡢽ṹÐлòÒ³µÄ´íÎó£¬ÒÔ¼°É¾³ýÒÑË𻵵ÄÎı¾¶ÔÏó¡£ÕâЩÐÞ¸´¿ÉÄܻᵼÖÂһЩÊý¾Ý¶ªÊ§¡£ÐÞ¸´²Ù×÷¿ÉÒÔÔÚÓû§ÊÂÎñÏÂÍê³ÉÒÔÔÊÐíÓû§»Ø¹öËù×öµÄ¸ü¸Ä¡£Èç¹û»Ø¹öÐÞ¸´£¬ÔòÊý¾Ý¿âÈԻẬÓдíÎó£¬Ó¦¸Ã´Ó±¸·Ý½øÐлָ´¡£Èç¹ûÓÉÓÚËùÌṩÐÞ¸´µÈ¼¶µÄÔµ¹ÊÒÅ©ij¸ö´íÎóµÄÐÞ¸´£¬Ôò½«ÒÅ©ÈκÎÈ¡¾öÓÚ¸ÃÐÞ¸´µÄÐÞ¸´¡£ÐÞ¸´Íê³Éºó£¬±¸·ÝÊý¾Ý¿â¡£
REPAIR_FAST ½øÐÐСµÄ¡¢²»ºÄʱµÄÐÞ¸´²Ù×÷£¬ÈçÐÞ¸´·Ç¾Û¼¯Ë÷ÒýÖеĸ½¼Ó¼ü¡£ÕâЩÐÞ¸´¿ÉÒԺܿìÍê³É£¬²¢ÇÒ²»»áÓжªÊ§Êý¾ÝµÄΣÏÕ¡£
REPAIR_REBUILD Ö´ÐÐÓÉ REPAIR_FAST Íê³ÉµÄËùÓÐÐÞ¸´£¬°üÀ¨ÐèÒª½Ï³¤Ê±¼äµÄÐÞ¸´£¨ÈçÖؽ¨Ë÷Òý£©£¬Ö´ÐÐÕâЩÐÞ¸´Ê±²»»áÓжªÊ§Êý¾ÝµÄΣÏÕ¡£
DBCC CHECKDB("dvbbs") with NO_INFOMSGS,PHYSICAL_ONLY¡£ |
7.SQL ServerÈÕÖ¾Çå³ýµÄÁ½ÖÖ·½·¨
ÔÚʹÓùý³ÌÖдó¼Ò¾³£Åöµ½Êý¾Ý¿âÈÕÖ¾·Ç³£´óµÄÇé¿ö£¬ÔÚÕâÀï½éÉÜÁËÁ½ÖÖ´¦Àí·½·¨¡£
·½·¨Ò»£º
Ò»°ãÇé¿öÏ£¬SQLÊý¾Ý¿âµÄÊÕËõ²¢²»Äܴܺó³Ì¶ÈÉϼõСÊý¾Ý¿â´óС£¬ÆäÖ÷Òª×÷ÓÃÊÇÊÕËõÈÕÖ¾´óС£¬Ó¦µ±¶¨ÆÚ½øÐд˲Ù×÷ÒÔÃâÊý¾Ý¿âÈÕÖ¾¹ý´ó¡£
1¡¢ÉèÖÃÊý¾Ý¿âģʽΪ¼òµ¥Ä£Ê½£º´ò¿ªSQLÆóÒµ¹ÜÀíÆ÷£¬ÔÚ¿ØÖÆ̨¸ùĿ¼ÖÐÒÀ´Îµã¿ªMicrosoft SQL Server-->SQL Server×é-->Ë«»÷´ò¿ªÄãµÄ·þÎñÆ÷-->Ë«»÷´ò¿ªÊý¾Ý¿âĿ¼-->Ñ¡ÔñÄãµÄÊý¾Ý¿âÃû³Æ£¨ÈçÂÛ̳Êý¾Ý¿âForum£©-->È»ºóµã»÷ÓÒ¼üÑ¡ÔñÊôÐÔ-->Ñ¡ÔñÑ¡Ïî-->ÔÚ¹ÊÕÏ»¹ÔµÄģʽÖÐÑ¡Ôñ¡°¼òµ¥¡±£¬È»ºó°´È·¶¨±£´æ¡£
2¡¢ÔÚµ±Ç°Êý¾Ý¿âÉϵãÓÒ¼ü£¬¿´ËùÓÐÈÎÎñÖеÄÊÕËõÊý¾Ý¿â£¬Ò»°ãÀïÃæµÄĬÈÏÉèÖò»Óõ÷Õû£¬Ö±½ÓµãÈ·¶¨¡£
3¡¢ÊÕËõÊý¾Ý¿âÍê³Éºó£¬½¨Ò齫ÄúµÄÊý¾Ý¿âÊôÐÔÖØÐÂÉèÖÃΪ±ê׼ģʽ£¬²Ù×÷·½·¨Í¬µÚÒ»µã£¬ÒòΪÈÕÖ¾ÔÚһЩÒì³£Çé¿öÏÂÍùÍùÊǻָ´Êý¾Ý¿âµÄÖØÒªÒÀ¾Ý¡£ |