来自.net代码的数据库压缩 [英] Database compression from .net code

查看:104
本文介绍了来自.net代码的数据库压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想使用.net代码压缩SQL Server 2012中的数据库。



首先我尝试了以下SQL查询:



  DBCC  SHRINKDATABASE(DatabaseName); 

GO
ALTER 数据库 DatabaseName SET RECOVERY SIMPLE
GO
DBCC SHRINKFILE(DatabaseName_log, 5
GO
ALTER DATABASE DatabaseName SET RECOVERY FULL
GO





当我尝试直接在SQL Server中执行上述查询时,它可以正常工作;通过在存储过程中执行。



但是当我尝试从.net代码调用存储过程时,它给出了例外 {不能在用户事务中执行shrinkdatabase操作。终止事务并重新发出语句。}



如果有任何问题,请指导我查询,或者是否有其他解决方案从.net代码压缩数据库。



谢谢。

解决方案

< blockquote>在分析过程中,我发现数据库压缩功能仅在Enterprise 版本的SQL Server 中可用。是这样吗?

快递版是否有售。



如果有人知道,请确认。



谢谢。


Hi,

I would like to Compress the database in SQL Server 2012 using .net code.

First I tried with the following SQL queries:

DBCC SHRINKDATABASE(DatabaseName);

GO
ALTER DATABASE DatabaseName SET RECOVERY SIMPLE
GO
DBCC SHRINKFILE (DatabaseName_log, 5)
GO
ALTER DATABASE DatabaseName SET RECOVERY FULL
GO



When I tries to execute the above queries in SQL server directly, it works properly; by executing in Stored procedure as well.

But when I tried to call the stored procedure from .net code, it gives e the exception of {"Cannot perform a shrinkdatabase operation inside a user transaction. Terminate the transaction and reissue the statement."}.

Kindly guide me if there is any problem with the queries, or if there is another solution to Compress the database from .net code.

Thanks.

解决方案

During the analysis, I found that the database compress feature is only available in Enterprise version of SQL server. Is it so?
Is it not available in express edition.

If anybody know, kindly confirm.

Thanks.


这篇关于来自.net代码的数据库压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆