简体   繁体   中英

what are the effects and side-effects of database file shrink sql server

I'm having a database on Sql server 2012 which size is 5 Gb. and getting larger daily.

I need to shrink that database . My question is:-

Is it a good sign of shrinking the database weekly or monthly one. as running out of space. Are there any side effects like decreasing the performance.

Generally, shrinking is bad because it takes up a lot of resources and cost performance, then you'd likely need to take a look at statistics and fragmentation of indexes at the same time.

Also because a database rarely really can be made "smaller" (more data doesn't take up less space), and because if it has grown to a specific size, it's because the data takes up that amount of space.

So basically what you need to look at is why the database grows. Is it unintended growth? Is it data files which grow or log files? If data files - do you store more data then you need? If log files - how is your backup procedure and how do you handle the log file in that? Shrinking files usually is treating a symptom that something is wrong, more than treating what is actually wrong.

So it is definitely not a good sign if it grows 'unexpected' or 'too much', and trying to find the cause would be the better route.

(Of course, real life scenarios exists where you sometimes do have to make the 'bad' choice, but well - this was just generally speaking :))

The only time a log file should be shrunk when there is some abnormal activities like increasing its size automatically. it is bad to shrink a log file regularly, see here to know why

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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