Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

徵狀

假設您有一個資料庫,其中包含 Microsoft SQL Server 2014 中的唯讀檔案組。 當您在資料庫上執行 DBCC CHECKDB 時, DBCC 命令無法建立資料庫的資料庫快照。如果沒有任何其他的資料庫連線,DBCC 操作就完成了且沒有錯誤。 不過,您會收到下列錯誤訊息:

DBCC CHECKDB 不會檢查 SQL Server 目錄或 Service Broker 一致性,因為無法建立資料庫快照或已指定了 TABLOCK。

如果有其他的資料庫連線,DBCC 操作會失敗,而且您會收到下列錯誤訊息:

Msg 5030、Level 16、State 12、Line 1The 資料庫無法以獨佔方式鎖定來執行該作業。Msg 7926、Level 16、State 1、Line 1Check 語句已中止。 無法檢查資料庫,因為無法建立資料庫快照,且無法鎖定資料庫或資料表。 如需此行為的詳細資料,以及存在哪些因應措施,請參閱線上叢書。 另請參閱先前的錯誤以取得詳細資料。

解決方案

累積更新資訊

此問題最初是在 SQL Server 的後續累積更新中修正。

每個新的 SQL Server 累計更新都包含所有的修正程式,以及前一個累積更新中所包含的所有安全性修正程式。 我們建議您下載並安裝最新的 SQL Server 累積更新:

其他相關資訊

若要再現這個問題,請在 SQL Server 中執行下列命令:

-- Open a new query that is named conn1, and then create a new database. CREATE DATABASE DbTest GO -- Add a new file group. ALTER DATABASE DbTest ADD FILEGROUP FGTest GO -- Add a file to the new file group. ALTER DATABASE DbTest ADD FILE (NAME=DbTest_Data2, FILENAME=''C:\temp\DbTest_Data2.ndf') TO FILEGROUP FGTest GO -- Change the file group to read-only. ALTER DATABASE DbTest MODIFY FILEGROUP FGTest READONLY GO -- Run the DBCC CHECK command in the conn1 query. DBCC CHECKDB (DbTest) -- The DBCC CHECK command runs correctly. However, you may receive the following message: "DBCC CHECKDB will not check SQL Server catalog or Service Broker consistency because a database snapshot could not be created or because WITH TABLOCK was specified." -- Open a new query window that is named conn2, and then set the database as DbTest. This action opens a connection to the DbTest database. -- Return to the conn1 query, and run the DBCC command again. DBCC CHECKDB (DbTest) -- Notice the error message that is mentioned in the "Symptoms" section.

狀態

Microsoft 已確認本篇文章<適用於>一節所列之 Microsoft 產品確實有上述問題。

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×