Solved

auto-shrink in SQL

Posted on 2014-09-29
4
486 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
4 Comments
 
LVL 33

Assisted Solution

by:ste5an
ste5an earned 125 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 46

Accepted Solution

by:
Vitor Montalvão earned 125 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 125 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:ScottPletcher
ScottPletcher earned 125 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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now