Sql Server附加數(shù)據(jù)庫出現(xiàn)1813錯(cuò)誤的解決方法
SQL Server里附加數(shù)據(jù)庫出錯(cuò)的解決方法
1.新建一個(gè)同名的數(shù)據(jù)庫
2.再停掉sqlserver服務(wù)(注意不要分離數(shù)據(jù)庫)3.用原數(shù)據(jù)庫的數(shù)據(jù)文件覆蓋掉這個(gè)新建的數(shù)據(jù)庫 4.再重啟sqlserver服務(wù)5.此時(shí)打開企業(yè)管理器時(shí)會(huì)出現(xiàn)置疑,先不管,執(zhí)行下面的語句(注意修改其中的數(shù)據(jù)庫名)6.完成后一般就可以訪問數(shù)據(jù)庫中的數(shù)據(jù)了。這時(shí),數(shù)據(jù)庫本身一般還有問題,解決辦法是:利用數(shù)據(jù)庫的腳本創(chuàng)建一個(gè)新的數(shù)據(jù)庫,然后通過DTS將數(shù)據(jù)導(dǎo)進(jìn)去就行了use mastergosp_configure 'allow updates',1 reconfigure with overridegoupdate sysdatabases set status =32768 where name='置疑的數(shù)據(jù)庫名'gosp_dboption '置疑的數(shù)據(jù)庫名', 'single user', 'true'godbcc checkdb('置疑的數(shù)據(jù)庫名') goupdate sysdatabases set status =28 where name='置疑的數(shù)據(jù)庫名'gosp_configure 'allow updates', 0 reconfigure with overridego sp_dboption '置疑的數(shù)據(jù)庫名', 'single user', 'false'go
