數(shù)據(jù)庫(kù)置疑 |
類型:數(shù)據(jù)庫(kù)置疑 版本:商業(yè)系列通用 |
問: |
Q、 數(shù)據(jù)庫(kù)置疑處理? |
答: |
1.停止SQL Server的服務(wù),備份SQL Server安裝目錄下的\data子目錄一個(gè)hbposv6_branch_log.ldf(也有可能非此命名), 同時(shí)查看磁盤 3.停止SQL Server 4.把老數(shù)據(jù)庫(kù)的MDF文件(hbposv6_branch_data.mdf)替換 新數(shù)據(jù)庫(kù)的相應(yīng)的MDF文件, 并把LDF文件(hbposv6_branch_log.ldg)刪除。 5.重新啟動(dòng)SQL Server服務(wù),然后運(yùn)行如下命令: Use Master go sp_configure 'allow updates', 1 reconfigure with override go begin tran update sysdatabases set status = 32768 where name = 'hbposv6_branch' --Verify one row is updated before committing commit tran go 6.停止SQL然后重新啟動(dòng)SQL Server服務(wù),然后運(yùn)行如下命令 (更換日志文件路徑地址): use master go DBCC TRACEON(3604) DBCC REBUILD_LOG ('hbposv6_branch', 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\hbposv6_branch_log.ldf') --在這里,請(qǐng)輸入你的數(shù)據(jù)庫(kù)的路徑 Go 7.停止SQL然后重新啟動(dòng)SQL Server服務(wù),然后運(yùn)行: use master go update sysdatabases set status = 8 where name = 'hbposv6_branch' go sp_configure 'allow updates', 0 reconfigure with override go 8.運(yùn)行dbcc checkdb(db_name) 檢查數(shù)據(jù)庫(kù)的完整性 9.修復(fù)數(shù)庫(kù) --請(qǐng)?jiān)诓樵兎治銎髦袌?zhí)行下列語句.執(zhí)行前斷開其它 所有數(shù)據(jù)庫(kù)連接,最好是斷開網(wǎng)線 --如果不是該數(shù)據(jù)庫(kù)名,請(qǐng)將數(shù)據(jù)庫(kù) --hbposv6_branch --改為要修復(fù)的數(shù)據(jù)庫(kù) USE master Go --單用戶模式 EXEC sp_dboption 'hbposv6_branch', 'single user', 'TRUE' go --數(shù)據(jù)庫(kù)檢查 DBCC CHECKDB ('hbposv6_branch') Go --如果返回結(jié)果出現(xiàn)了紅色的提示文字,說明數(shù)據(jù)庫(kù)中存在錯(cuò)誤,需要修復(fù) --數(shù)據(jù)庫(kù)修復(fù) DBCC CHECKDB ('hbposv6_branch','repair_rebuild') Go --再次數(shù)據(jù)庫(kù)檢查,如果返回結(jié)果中沒有了紅色的提示文字, 說明修復(fù)成功; DBCC CHECKDB ('hbposv6_branch') Go --否則意味著還需要更高級(jí)別的修復(fù);嘗試將上面修復(fù)語句的 'repair_rebuild'換為'repair_allow_data_loss'再試, 之后再次檢查數(shù)據(jù)庫(kù)。 --如果還有錯(cuò)誤未修復(fù),請(qǐng)把這些信息以文字的方式發(fā)給我們 --退出前請(qǐng)一定要執(zhí)行以下語句返回到多用戶模式 EXEC sp_dboption 'hbposv6_branch', 'single user','FALSE' go 注:都要把 dbname 替換成真實(shí)的數(shù)據(jù)庫(kù)名字。
|
[ 2008-4-2 15:35:12 ] |
聯(lián)系客服