Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Maintenance Tasks on 2005 MS SQL Database Expand / Collapse
Author
Message
Posted Sunday, November 4, 2012 5:41 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Sunday, November 24, 2013 12:37 PM
Points: 85, Visits: 159
What are the recommended Maintenance tasks to perform on a 2005 SQL production Database. I am thinking of the following:
1. Integrity Check - I am reading that this is resource intensive and can slow down SQL. Therefore it should be done offline.
2. Purge old data - I have a few tables that I can perform a "delete from ... " to delete data older than 6 month old as an example. What impact can this have on the database if it's done live? Is this necessarily going to reduce the size of the database? The database is set for "simple recovery".
3. Reorganize index
4. Update statistics
5. Shrink the DB. I was reading some articles that talked about the fact that this is a bad practice as it can increase fragmentation? So I guess I should not do it?

My objective is to reduce the size of the database without affecting performance. How do you do this?

Thanks
Post #1380855
Posted Tuesday, November 13, 2012 12:09 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, May 7, 2014 2:27 PM
Points: 7, Visits: 61
First, backups! either with ssms maintenance plans or 3rd party product.
Second, start monitoring and reporting the db's performance, activity.
Third, then you'll know what the next step will be.
Post #1384239
Posted Tuesday, November 13, 2012 1:20 PM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: 2 days ago @ 4:16 PM
Points: 4,389, Visits: 9,526
Why do you feel you need to reduce the size of the database? Databases grow as you add data - and unless you have had an event that grew the database far beyond its normal size there is no reason to make it smaller.

Integrity Checks - should be run every day. If a database is corrupted and you don't know about it for several weeks/months you have no option to recover from a known good backup. You would end up losing data - and probably much more... There is no reason to try and run this 'offline' as it runs against a hidden snapshot of the database. Running in offline mode means the database will not be accessible to anyone while it runs.

Purge Data - this could lock the tables being purged. It can also cause performance issues during the process - depends on how it is written and what else is being run on the system at that time.

Rebuild/Reorganize indexes - use a procedure that identifies only those indexes that need to be rebuilt or reorganized. This will reduce the impact of this process on your system. If your system is Standard Edition - index rebuilds will be performed offline - meaning the index itself will not be available while it is being rebuilt.

ShrinkDB/ShrinkFile - as stated above, no reason to run this on a regular basis unless you want to cause additional performance issues and waste time. Both of these cause fragmentation in the indexes - which you just rebuilt/reorganized. And, if you do the shrink before the rebuild/reorganize - then the database is just going to grow back out.


Jeffrey Williams
Problems are opportunites brilliantly disguised as insurmountable obstacles.

How to post questions to get better answers faster
Managing Transaction Logs
Post #1384272
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse