溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

master數(shù)據(jù)庫損壞如何解決

發(fā)布時間:2021-08-05 14:47:43 來源:億速云 閱讀:246 作者:Leah 欄目:數(shù)據(jù)庫

本篇文章為大家展示了master數(shù)據(jù)庫損壞如何解決,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。

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,嚴重性: 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有做備份。千萬謹記,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文件所在目錄,然后運行下面命令(具體結(jié)合實際情況修改相關(guān)參數(shù))

setup.exe/QUIET/ACTION=REBUILDDATABASE/INSTANCENAME=instance_name/SQLSYSADMINACCOUNTS= accounts[/SAPWD=password][/SQLCOLLATION=collation_name]

當然有很多細節(jié),如果數(shù)據(jù)庫安裝后打過補丁,做過升級,可能需要重新應(yīng)用這些補丁。

上述內(nèi)容就是master數(shù)據(jù)庫損壞如何解決,你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲備,歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI