Solved

auto-shrink in SQL

Posted on 2014-09-29
4
491 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 48

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:Scott Pletcher
Scott Pletcher 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

860 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