?
Solved

auto-shrink in SQL

Posted on 2014-09-29
4
Medium Priority
?
509 Views
Last Modified: 2014-10-08
can anyone give a management friendly summary of the issues in using "auto-shrink" on SQL databases:

1) does it cause any risks
2) why do DBA's use it
3) if it does cause risks - are there any safer alternatives to get the same result?
0
Comment
Question by:pma111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 35

Assisted Solution

by:ste5an
ste5an earned 500 total points
ID: 40350045
Auto-shrink resorts the pages in your data file. This means also index pages are reorderd. This leads to index fragmentation.

1.) No.
2.) Never used it.
3.) Rebuild your filegroup.

See also Why you should not shrink your data files from Paul Randal.
0
 
LVL 51

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40350112
I have a little different view fro ste5an.
[1) does it cause any risks
 2) why do DBA's use it
 3) if it does cause risks - are there any safer alternatives to get the same result?
1) Yes. Because is auto-shrink you can't control when it going to trigger. Can be during a period that your database need to be available and depending of the size of data and the fragmentation it can take hours to shrink and during the process will cause locks so no one will be able to do any operation on the database.
2) Because DBA's are wise people and like to control their own databases :)
3) Rebuild indexes

NOTE: Shrinking transaction log files aren't that bad as data files but can have some impact in the performance because if SQL Server needs to growth the tlog file it will block until all the empty space are filled with zeros.
0
 
LVL 24

Assisted Solution

by:Phillip Burton
Phillip Burton earned 500 total points
ID: 40350184
1. It can reduce performance.
2. They don't if they are wise. Growth will soon happen, so all of the auto-shrink is not needed.
3. Manually shrink it if required, and then only to the extent that is needed.
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 500 total points
ID: 40350396
1) Shrinking dbs causes delays in processing and can cause huge performance overhead.  This includes, but is not limited to, releasing and reacquiring disk space, and fragmenting table indexes.  Shrinks are only very selectively needed, thus there is never a need to auto-shrink a db.

2) DBA's don't use it [auto-shrink], ever.

3) Pre-allocate sufficient space, particularly log space.  In the very rare cases when a shrink is needed, do them as efficiently as possible.
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question