DBCC CheckDB遇到a database snapshot could not be created

本文探讨了在使用FAT32文件系统时,使用DBCC CHECKDB进行数据库检查时遇到的错误,并提供了解决方法。包括确认文件系统类型、检查数据库文件组状态、确保SQL Server启动账号具有文件卷完全权限等步骤。

在备份一个客户的数据库时(数据库版本为SQL 2005 Express版本),做DBCC CHECKDB时遇到了下面错误信息:

 

dbcc checkdb('DB_NAME');

消息 5030,级别 16,状态 12,第 1 行

The database could not be exclusively locked to perform the operation.

消息 7926,级别 16,状态 1,第 1 行

Check statement aborted. The database could not be checked as a database snapshot could not be created and the database or table could not be locked. See Books Online for details of when this behavior is expected and what workarounds exist. Also see previous errors for more details.

 

一般导致创建数据库快照失败的原因有两个:

1:数据库有只读的文件组。

2:没有支持稀疏文件(Parse file)的文件系统

 

英文原文如下

     No Parse file support by the file system.

                A. Parse file is not supported in FAT32 check the file system of the datafiles. If you use FAT32   use DBCC CheckDB with Tablock Option

                B. To get the volume information of file system in which we have the datafiles we use  !GetVolumeInformation API.

                This API would fail if SQLServer startup account do not have full permission on Volume in which the data file is located.

                Grant full permission for the startup account of SQLServer on the root volume of all the datafies.

 

我检查了数据库发现没有设定为只读的文件组,这台PC是Window Xp,文件系统系统确实为FAT32,使用DBCC CHECKDB('db_name') WITH  TABLOCK 依然报错,其实当文件系统为FAT32时,DBCC CHECKDB只能在单用户模式才能成功。所以我在该数据库做DBCC CHECKDB时会遇到这个错误,为此,我特意在测试环境测试了一下,如下所示:

 

测试FAT32文件系统下的DBCC CHECKDB问题:

1:新建的数据库TEST的文件位于FAT32磁盘上。如果没有会话访问数据库TEST(相当于单用户模式),DBCC CHECKDB成功,如果在新开一个窗口访问TEST,然后再另外一个窗口执行DBCC CHECKDB('TEST')则会报如下错误,另外DBCC CHECKDB('db_name') WITH  TABLOCK也需要在单用户模式下才能成功。

 

参考资料:

http://blogs.msdn.com/b/karthick_pk/archive/2010/03/07/dbcc-checkdb-fails-the-database-could-not-be-checked-as-a-database-snapshot-could-not-be-created-and-the-database-or-table-could-not-be-locked.aspx

https://support.microsoft.com/en-us/kb/928518

https://ask.sqlservercentral.com/questions/51856/dbcc-checkdb-with-fat32-file-system.html

转载于:https://www.cnblogs.com/kerrycode/p/4858742.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值