SQL Server自动收缩数据库属性

In this article, we will discuss the SQL Server Auto Shrink database property, which allows SQL Server to automatically shrink the database files when the value is configured as True in the database option. Automatic shrink operation is done by the server auto shrink database feature, which is the main course of this article.

在本文中,我们将讨论SQL Server自动收缩数据库属性,当在数据库选项中将该值配置为True时,该属性允许SQL Server自动收缩数据库文件。 服务器的自动收缩数据库功能可以完成自动收缩操作,这是本文的主要课程。

To avoid the activity of shrinking of data/log files whenever file size surpasses the free space in the data file, DBA (Database Administrator) must back up the log files at a regular interval. Backing up the whole database is not a good idea; one must construct or set up the transaction log also. Transaction logs will increase in numbers until it occupies all the available disk space if you don’t take back up of them. If you back up the database, it releases the free space to be reused again. Database Administrator must schedule a transaction log backup to reduce the size of log files at a fair size.

为了避免每当文件大小超过数据文件中的可用空间时就减少数据/日志文件的活动,DBA(数据库管理员)必须定期备份日志文件。 备份整个数据库不是一个好主意。 还必须构造或设置事务日志。 事务日志的数量将不断增加,直到不占用所有可用磁盘空间为止。 如果备份数据库,它将释放可用空间以再次使用。 数据库管理员必须安排事务日志备份,以以适当的大小减少日志文件的大小。

SQL Server Auto Shrink feature is disabled by default on SQL Server instance databases. In the scenario where you have a number of relatively small databases that grow to a larger size either by insertion of new tuples or by a large number of empty spaces created by deletion of several tuples, SQL Server Auto Shrink becomes pretty handy in this situation. Moreover, you must need not worry about the size fragmentation of database files.

默认情况下,SQL Server实例数据库上禁用SQL Server自动收缩功能。 在您有许多相对较小的数据库(通过插入新的元组或通过删除多个元组而创建的大量空白空间)将其增大到较大的情况下,在这种情况下,SQL Server自动收缩变得非常方便。 而且,您不必担心数据库文件的大小碎片。

While shrinking the database, you must have to consider shrinking operations on both critical as well as relatively larger databases as a part of maintenance. Besides, this one should avoid running manual shrink feature; the consequences of doing this are that one will never be acquainted with issues regarding the new or existing request. However, Transaction files shrinking is better than the data files shrinking.

在收缩数据库时,必须将收缩关键数据库和相对较大的数据库上的操作作为维护的一部分。 此外,这一操作应避免运行手动收缩功能; 这样做的后果是,您将永远不会熟悉有关新请求或现有请求的问题。 但是,事务文件收缩比数据文件收缩好。

如何激活和停用数据库SQL Server自动收缩? (Way to activate and deactivate the SQL Server auto shrink for the database?)

Users can enable and disable database auto shrink option using SSMS and T-SQL both ways.

用户可以同时使用SSMS和T-SQL启用和禁用数据库自​​动收缩选项。

Activating the database auto shrink by using SSMS:

通过使用SSMS激活数据库自动收缩:

Users can enable or disable t

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值