How to achieve shrinkage of SQL SERVER Database
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.