SQL SERVER – Database Files Initial Size Changing Automatically

One of my clients reported an interesting issue and I was needed to wear detective cap to solve it. The mystery, for which they hired me was as below for Database Files Initial Size Changing Automatically.

Pinal,
We see an interesting issue, and we believe there is something not right with our environment. As per best practices from one of your blog, we have configured the initial file size of the database files to big enough for next 1 year data growth.

We are noticing that the file size is not getting set and it changes to smaller size every night.  Would you be able to suggest us something?

SQL SERVER - Database Files Initial Size Changing Automatically databaseshrink-800x281

MY INVESTIGATION

I asked them if there is any maintenance plan which runs every night and does the shrink of the database, like below?

SQL SERVER - Database Files Initial Size Changing Automatically shrink-auto-01

And they said that they have no maintenance plan doing such activity.

Here are the various data points I looked at.

  1. SELECT * FROM database_files
  2. SELECT * FROM databases
  3. sp_helpdb SAPDB

When I looked at sys.databases, I could see is_auto_shrink_on was set to 1.

You can run below query in you production database and make sure auto shrink is set to 0.

SELECT is_auto_shrink_on, * FROM sys.databases

ROOT CAUSE

As you can see above, we concluded that the behavior which they saw was because Auto Shrink property was set to ON for many databases. Since this was one of an active database, auto shrink was kicked as compared to other databases. This article discusses the use of both Auto options.

Reference: Pinal Dave (https://blog.sqlauthority.com)

, ,
Previous Post
SQL SERVER – SQL Agent Not Starting. The EventLog Service has Not Been Started
Next Post
NuoDB – Achieving Performance Through Scale-Out – Elastic Scalability

Related Posts

2 Comments. Leave new

Leave a Reply

Menu