Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to achieve shrinkage of SQL SERVER Database

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to shrink the SQL SERVER database. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Advice on contraction

Don't shrink the database unless you have to. Shrinking the database has a significant impact:

1. Shrinking the database has a great impact on the database, resulting in a large number of logs and fragments, and locking tables. If your library is currently in use, it's normal that you can't shrink.

two。 Shrinking the database must be done manually, and it is done during the maintenance window.

3. Try to use statements to execute, you can prompt errors

The correct posture of contraction

When you have to shrink, refer to the following steps

1. Find the largest tables in the database and rebuild all indexes. First try to specify how Truncate Only shrinks. It just removes the free space at the end of the file and does not reorganize the data pages that are already in use.

DBCC SHRINKDATABASE (AdventureWorks2012, TRUNCATEONLY)

2 the last consideration is the contraction without options. Don't contract all at once. It can contract by about 2G at a time. Don't shrink all the available space, you can have the rest, such as 4G.

3. You can stop the DBCC SHRINKDATABASE operation at any point in the process, and any completed work will be retained.

4. Cannot shrink the database when backing up the database

This is the end of the article on "how to shrink the SQL SERVER database". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report