Solved

auto-shrink in SQL

Posted on 2014-09-29
4
478 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 32

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 45

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

759 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

24 Experts available now in Live!

Get 1:1 Help Now