master數(shù)據(jù)庫損壞的解決辦法有哪些
SQL Server 2008 master數(shù)據(jù)庫損壞后,SQL SERVER服務(wù)啟動失敗,查看錯誤日志,你會看到下面錯誤信息:
2015-10-27 10:15:21.01 spid6s Starting up database 'master'.
2015-10-27 10:15:23.01 spid6s 錯誤: 9003,嚴(yán)重性: 20,狀態(tài): 1。
2015-10-27 10:15:23.01 spid6s The log scan number (227:418:1) passed to log scan in database 'master' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.
2015-10-27 10:15:23.01 spid6s Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
如果是數(shù)據(jù)庫版本是中文版,你會看到類似下面的錯誤信息:
傳遞給數(shù)據(jù)庫 'master' 中的日志掃描操作的日志掃描號 (227:418:1) 無效。此錯誤可能指示數(shù)據(jù)損壞,或者日志文件(.ldf)與數(shù)據(jù)文件(.mdf)不匹配。如果此錯誤是在復(fù)制期間出現(xiàn)的,請重新創(chuàng)建發(fā)布。否則,如果該問題導(dǎo)致啟動期間出錯,請從備份還原。
此時解決master數(shù)據(jù)庫的損壞的方法大致有三種:
1: 從備份還原master數(shù)據(jù)庫
還原master數(shù)據(jù)庫的前提是你的master有做備份。千萬謹(jǐn)記,master也必須備份。很多時候,有些人備份時會忽略這些系統(tǒng)數(shù)據(jù)庫。 一般master、msdb備份是必須的。
2: 復(fù)制master數(shù)據(jù)庫模板
如果你沒有master備份,那么退而求次,選擇從安裝目錄的Templates拷貝master數(shù)據(jù)庫文件到對應(yīng)的目錄。如果你SQL SERVER安裝在C盤,沒有修改過安裝路徑,那么可能就是C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\Templates
3:重建master數(shù)據(jù)庫
找到SQL Server 2008的安裝介質(zhì)(插入光盤或拷貝介質(zhì)到對應(yīng)目錄),在命令窗口將目錄更改為setup.exe文件所在目錄,然后運(yùn)行下面命令(具體結(jié)合實(shí)際情況修改相關(guān)參數(shù))
setup.exe /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=instance_name /SQLSYSADMINACCOUNTS= accounts [/SAPWD=password] [/SQLCOLLATION=collation_name]
當(dāng)然有很多細(xì)節(jié),如果數(shù)據(jù)庫安裝后打過補(bǔ)丁,做過升級,可能需要重新應(yīng)用這些補(bǔ)丁。
以上內(nèi)容是關(guān)于master數(shù)據(jù)庫損壞的解決辦法,希望對大家有所幫助。
相關(guān)文章
SQL Server數(shù)據(jù)庫中設(shè)置索引的策略分享
在 SQL Server 中,索引通過加快數(shù)據(jù)檢索速度在優(yōu)化查詢性能方面發(fā)揮著關(guān)鍵作用,在數(shù)據(jù)庫中設(shè)置索引的策略受數(shù)據(jù)庫結(jié)構(gòu)、表的大小和將要運(yùn)行的查詢類型的影響,以下是如何將索引應(yīng)用于這些不同類型的表的詳細(xì)分類,需要的朋友可以參考下2024-12-12
SQL數(shù)據(jù)庫實(shí)例名稱找不到或遠(yuǎn)程連接失敗并顯示錯誤error40的原因及解決辦法
這篇文章主要介紹了SQL數(shù)據(jù)庫實(shí)例名稱找不到或遠(yuǎn)程連接失敗并顯示錯誤error40的原因及解決辦法,需要的朋友可以參考下2015-11-11
基于Python的SQL Server數(shù)據(jù)庫實(shí)現(xiàn)對象同步輕量級
這篇文章主要介紹了基于Python的SQL Server數(shù)據(jù)庫對象同步輕量級實(shí)現(xiàn)方法,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2019-06-06
格式導(dǎo)致的Excel導(dǎo)入sql出現(xiàn)異常的解決方法
因?yàn)镋xcel導(dǎo)入到sql的事兒,今天折騰了大半天。2009-03-03
SQL?Server縱表轉(zhuǎn)橫表的實(shí)現(xiàn)示例
在使用SQL?Server數(shù)據(jù)庫的過程中我們經(jīng)常會遇到需要將查詢結(jié)果從縱表轉(zhuǎn)成橫表的問題,本文就來介紹一下SQL?Server縱表轉(zhuǎn)橫表示例,感興趣的可以了解一下2023-12-12
SQL Server使用row_number分頁的實(shí)現(xiàn)方法
這篇文章主要為大家詳細(xì)介紹了SQL Server使用row_number分頁的實(shí)現(xiàn)方法,具有一定的參考價值,感興趣的朋友可以參考一下2016-06-06
SQL查詢數(shù)據(jù)庫中符合條件的記錄的總數(shù)
這篇文章主要介紹了SQL查詢數(shù)據(jù)庫中符合條件的記錄的總數(shù)的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-09-09

