資源描述:
《sql server數(shù)據(jù)庫(kù)被置疑解決方法(the sql server database is the solution to doubt)》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、sqlserver數(shù)據(jù)庫(kù)被置疑解決方法(TheSQLServerdatabaseisthesolutiontodoubt)First,makesurethatyouhavebackedupthe.Mdfand.Ldffiles.2.createadatabasewiththesamenameinSQLServer,andthenstoptheSQLServerservice.3.overwritethe.Mdfand.Ldffilesofthenewdatabasewiththeoriginal.Mdfand.Ld
2、ffiles.4.restarttheSQLServerservice,whichshouldseethedatabaseindoubt(Suspect)state.5.intheSQLqueryanalyzer,executethefollowingcommandtoallowupdatingofthesystemtables:UsemasterGoSp_configure'allowupdates',1ReconfigurewithoverrideGo6.placethisdatabaseasanemergen
3、cymode:Update,sysdatabases,set,status=32768,where,name='db_name'Go7.checktheerrorsinthedatabaseusingtheDBCCCHECKDBcommand:DBCCCHECKDB('db_name')GO8.iftheDBCCCHECKDBcommandfails,gotothetenthstep,oryouwillfirstsetthedatabaseinasingleusermode,andthentrytofixit:Sp
4、_dboption'db_name','singleuser','true'DBCCCHECKDB('db_name',REPAIR_ALLOW_DATA_LOSS)GOIftheDBCCCHECKDB("db_name","REPAIR_ALLOW_DATA_LOSS")commandispromptedtoindicatethatthedatabaseisnotinasingleusermode,restarttheSQLServerservice,andthenproceedwiththeattempt.9.
5、iftheDBCCCHECKDB('db_name',REPAIR_ALLOW_DATA_LOSS)commandfails,gotothetenthstep,otherwisethedatabaseerrorwillberepairedsuccessfully:ReruntheDBCCCHECKDB('db_name')commandtomakesuretherearenoerrorsinthedatabase.Clearthequerystatusofthedatabase:sp_resetstatus'db_
6、name'Clearthesingleusermodestateofthedatabase:sp_dboption'db_name','singleuser','false'RestarttheSQLServerserviceand,ifeverythingisOK,thedatabasehasbeensuccessfullyrestored.10.iftheabovestepsdonotsolvetheproblem,pleaserefertothedocumentintheattachedfileandtryt
7、orestorethedatainthedatabasebyrebuildingthetransactionlog.IfyouhaveonlyMDFfiles,theproblemismorecomplex,andweneedtorebuildthetransactionlogdirectly:1.createadatabasewiththesamenameinSQLServer,andthenstoptheSQLServerservice.2.overwritethenew.Mdffilewiththeorigi
8、nalLDFfileanddeletethelogfile(.Ldf).3.starttheSQLServerserviceandsetthedatabaseasanemergencymode(ibid.:steps5and6).4.stopandrestarttheSQLServerservice.5.performthefollowingcommands