如何解決Database處於Recovery Pending狀態

來源:互聯網
上載者:User

上篇文章裡, 我們通過指令碼修改了資料庫MDF和LDF檔案的位置, 恢複了之後, 探索資料庫處於Recovery Pending狀態.

 

如何解決呢?

 

嘗試一

=======================

運行下面的命令, 失敗.

RESTORE DATABASE SharePoint_Config WITH RECOVERY

 

報錯:

Msg 3148, Level 16, State 3, Line 1

This RESTORE statement is invalid in the current context. The 'Recover Data Only' option is only defined for secondary filegroups when the database is in an online state. When the database is in an offline state filegroups cannot be specified.

Msg 3013, Level 16, State 1, Line 1

RESTORE DATABASE is terminating abnormally.

 

嘗試二

======================

運行下面的命令, 失敗.

DBCC checkdb ('SharePoint_Config')

 

報錯:

Msg 945, Level 14, State 2, Line 1

Database 'SharePoint_Config' cannot be opened due to inaccessible files or insufficient memory or disk space.  See the SQL Server errorlog for details.

 

這裡注意到"inaccessible files"字樣, 於是想起應該檢查一下存放MDF和LDF的路徑的使用權限設定是否與預設的檔案夾相同.

經過比較, 發現少了使用者"MSSQLSERVER"的full control.

添加NT Service\MSSQLSERVER使用者後, 賦予full control許可權, 問題依舊. 看起來不是許可權的問題.

 

筆者還嘗試了下面的命令, 均告失敗.

EXEC sp_resetstatus 'SharePoint_Config';ALTER DATABASE "SharePoint_Config" SET EMERGENCYDBCC checkdb('SharePoint_Config')ALTER DATABASE "SharePoint_Config" SET SINGLE_USER WITH ROLLBACK IMMEDIATEDBCC CheckDB ('SharePoint_Config', REPAIR_FAST)DBCC CheckDB ('SharePoint_Config', REPAIR_ALLOW_DATA_LOSS)

 

筆者最後將兩個資料庫刪掉, 重新Attach MDF和LDF檔案, 才將資料庫狀態恢複.

 

筆者不會放過這個問題, 明天找資料庫專家諮詢一下.

 

參考資料

=======================

Database States

http://msdn.microsoft.com/en-us/library/ms190442.aspx

DBCC CHECKDB

http://msdn.microsoft.com/en-us/library/aa258278%28v=sql.80%29.aspx

Suspect Database Recovery (SQL Server 2005)

http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/ea8b251f-fbce-4f8b-8a87-1b570688ce88/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.