Home > Database > Mysql Tutorial > SQLSERVER中修复状态为Suspect的数据库

SQLSERVER中修复状态为Suspect的数据库

WBOY
Release: 2016-06-07 15:51:31
Original
1168 people have browsed it

前几天的Server因断电损坏了DB,DB的Status被标记为 Suspect。 这种情况少见,此时不能Detachp这个DB了,只能Backup。 后面用这些T-Script重建log文件,还是少量数据丟失。 检查DB的状态: 1: SELECT DATABASEPROPERTYEX ( 'DemoSuspect' , 'STATUS' ) AS 'St

      前几天的Server因断电损坏了DB,DB的Status被标记为Suspect。这种情况少见,此时不能Detachp这个DB了,只能Backup。

      后面用这些T-Script重建log文件,还是少量数据丟失。

      检查DB的状态:   

<span>   1:  </span><span>SELECT</span> DATABASEPROPERTYEX (<span>'DemoSuspect'</span>, <span>'STATUS'</span>) <span>AS</span> <span>'Status'</span>;
Copy after login
<span>   2:  </span><span>GO</span>
Copy after login
<span>   3:  </span> 
Copy after login
<span>   4:  </span>Status
Copy after login
<span>   5:  </span>------<span>--</span>
Copy after login
<span>   6:  </span>SUSPECT
Copy after login
   
Copy after login
   最后修复:
Copy after login

<span>   1:  </span><span>ALTER</span> <span>DATABASE</span> DemoSuspect <span>SET</span> EMERGENCY;
Copy after login
<span>   2:  </span><span>Go</span>
Copy after login
<span>   3:  </span><span>ALTER</span> <span>DATABASE</span> DemoSuspect <span>SET</span> SINGLE_USER;
Copy after login
<span>   4:  </span><span>Go</span>
Copy after login
<span>   5:  </span><span>DBCC</span> CHECKDB (DemoSuspect, REPAIR_ALLOW_DATA_LOSS) <span>WITH</span> NO_INFOMSGS, ALL_ERRORMSGS;
Copy after login
<span>   6:  </span>GO
Copy after login

  

   DemoSuspect是你的DB名称。

   还可以参加下面两篇文章:

    TechEd Demo: Creating, detaching, re-attaching, and fixing a suspect database

    CHECKDB From Every Angle: EMERGENCY mode repair - the very, very last resort

 

   希望这篇Post对您有帮助。

  

   Author: Petter Liu   http://wintersun.cnblogs.com

 

 

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template