简体   繁体   English

SQL Server 2008数据库收缩错误

[英]SQL Server 2008 db shrink error

I have SQL Server 2008 R2 Standard edition with 3 tb data. 我有3 TB数据的SQL Server 2008 R2标准版。 My disc is full. 我的光盘已满。 I want to shrink the .mdf file. 我想缩小.mdf文件。 I've deleted many rows from my db. 我从数据库中删除了许多行。 And I launch 然后我启动

DBCC SHRINKDATABASE(my_db, TRUNCATEONLY)

I got error 我有错误

Msg 0, Level 11, State 0, Line 0 消息0,级别11,状态0,行0
A severe error occurred on the current command. 当前命令发生严重错误。 The results, if any, should be discarded. 结果(如果有的话)应丢弃。

I tried to do it in single user mode result is same. 我试图在单用户模式下执行此操作,结果是相同的。 We have increased disk size to 4.5 tb and retried shrinking, result is same. 我们将磁盘大小增加到4.5 tb,然后尝试缩小,结果是一样的。

dbcc checkdb command shows no error on db. dbcc checkdb命令在db上没有显示错误。

Does anyone know what is problem? 有人知道是什么问题吗?

Please help 请帮忙

Have you tried specifying both the file name and the target size in MB, eg 您是否尝试以MB为单位指定文件名和目标大小,例如

DBCC SHRINKFILE('filename', 20);

Or the TRUNCATEONLY option, which doesn't try any of the nasty stuff like reorganizing all of your physical data: 或TRUNCATEONLY选项,该选项不会尝试任何讨厌的事情,例如重新组织所有物理数据:

DBCC SHRINKFILE('filename', TRUNCATEONLY);

Also you could try making sure the database is in single user mode first: 您也可以尝试先确保数据库处于单用户模式:

ALTER DATABASE db SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

...and turn off any backup / log backup or other maintenance jobs that may be conflicting with your shrink operation. ...并关闭可能与收缩操作冲突的所有备份/日志备份或其他维护作业。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM