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 12»»

SQL Server Backups & Maintenance - Best Practices Expand / Collapse
Author
Message
Posted Wednesday, July 17, 2013 6:17 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, October 09, 2013 5:34 AM
Points: 23, Visits: 68
Hi,

I was wondering if you guys would be able to shed some light on a subject that seems very involved!

We have a SQL Backend Database, which has just over a 250,000 rows (growing every day) in the main table. I have been tasked with trying to improve our Backups and Maintenance. It's an area that I have never really looked into as it was all set-up by the previous DBA. I was just looking for some thoughts on our current plan and maybe where you guys think it could be improved.

- Full DB Backup (Once Before Working Hours, Once During Working Hours, Once After Working Hours)
- DB Differential Backup (Every Hour)
- DB Integrity Check (Once a Day)
- Index Rebuild (Once a Day)
- Update Statistics (Once a Day after Index Rebuild)
- Checkpoint on TempDB (Once a Day)
- Transaction Log (Every 30 minutes)
- SP_Delete_BackupHistory (Once a week)
- SP_Purge_JobHistory (Once a day)

Thanks in advance!
Post #1474535
Posted Wednesday, July 17, 2013 6:46 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 6:39 AM
Points: 1,057, Visits: 713
Hi,

The best way of thinking about your backups is as a restore strategy. If you "lost" the database, how long would you have to bring it back online and what would be the acceptable level of data loss (if any)?

With a maintenance strategy it really depends. How long does it take for your indexes to become fragmented? Are you seeing poor performance due to invalid statistics?

Sorry to be so vague, but it really does depend on the system

Andrew
Post #1474563
Posted Wednesday, July 17, 2013 6:55 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 7:59 AM
Points: 2,078, Visits: 2,410
JAMMOD (7/17/2013)
- Full DB Backup (Once Before Working Hours, Once During Working Hours, Once After Working Hours)
- DB Differential Backup (Every Hour)
- DB Integrity Check (Once a Day)
- Index Rebuild (Once a Day)
- Update Statistics (Once a Day after Index Rebuild)
- Checkpoint on TempDB (Once a Day)
- Transaction Log (Every 30 minutes)
- SP_Delete_BackupHistory (Once a week)
- SP_Purge_JobHistory (Once a day)

Thanks in advance!


Specific the backup plan is depending in your business requirement. How much data-loss is acceptable and how much time is allowed to get back online after a disaster. In my opinion the timing and frequency of the DIFF and LOG backups are not in line with each other. I should increase the frequency of the LOG backup to every 10 minutes or so. A full backup during working hours could also be a bit of an overkill.
Also the update of the statistics is probably unnecassary. This will allready be done with the rebuild of the indexes. Are all indexes rebuild?
What is the purpose of the Checkpoint on TempDB?

It looks like your previous DBA has implemented the SQL Maintenence Plan. Allthough this has a very simple implementation, it also has some drawbacks. Take a look at some custom maintenance solutions (like the one from Ola Hallengren http://ola.hallengren.com/)


** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
Post #1474572
Posted Wednesday, July 17, 2013 7:31 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 6:39 AM
Points: 1,057, Visits: 713
Sorry but an update of the statistics is necessary as a rebuild index will not update the statistics on non indexed columns.

Andrew
Post #1474609
Posted Thursday, July 18, 2013 2:46 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, October 09, 2013 5:34 AM
Points: 23, Visits: 68
Specific the backup plan is depending in your business requirement. How much data-loss is acceptable and how much time is allowed to get back online after a disaster. In my opinion the timing and frequency of the DIFF and LOG backups are not in line with each other. I should increase the frequency of the LOG backup to every 10 minutes or so. A full backup during working hours could also be a bit of an overkill.
Also the update of the statistics is probably unnecassary. This will allready be done with the rebuild of the indexes. Are all indexes rebuild?
What is the purpose of the Checkpoint on TempDB?

It looks like your previous DBA has implemented the SQL Maintenence Plan. Allthough this has a very simple implementation, it also has some drawbacks. Take a look at some custom maintenance solutions (like the one from Ola Hallengren http://ola.hallengren.com/)


Thanks for the replies guys! just a couple of questions on the above, would you be able to explain a bit more about why the DIFF and LOG backups should be more inline and to increase the amount of LOG backups, or if you have any links on this it would be great.

As far as I know it uses a Maintenance Plan to Rebuild Tables and Views and the option "Reorganize pages with the default amount of space is selected"

And with the Checkpoint on the TempDB, it has been one of those things that has been there since I took over and as it is working I haven't touched it.

Thanks,
Post #1474941
Posted Thursday, July 18, 2013 2:53 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 7:59 AM
Points: 2,078, Visits: 2,410
JAMMOD (7/18/2013)[hrThanks for the replies guys! just a couple of questions on the above, would you be able to explain a bit more about why the DIFF and LOG backups should be more inline and to increase the amount of LOG backups, or if you have any links on this it would be great.

A DIFF backup is usually taken to shorten the time and minimize the actions needed to restore the database. The frequency of the LOG backup is a mayor part in determining how much data (measured in time) is allowed to get lost. See: http://msdn.microsoft.com/en-us/library/ms191239(v=sql.105).aspx as a starter. But remember: all depends on your business requirements.


** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
Post #1474943
Posted Thursday, July 18, 2013 4:45 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, April 03, 2014 9:30 PM
Points: 40, Visits: 230
Sorry - Update statistics is not required for Index Rebuild, automatically it will be updated. Please refer the below link. I have pasted the specific content below:

http://msdn.microsoft.com/en-us/library/ms190397.aspx

After Maintenance Operations


Consider updating statistics after performing maintenance procedures that change the distribution of data, such as truncating a table or performing a bulk insert of a large percentage of the rows. This can avoid future delays in query processing while queries wait for automatic statistics updates.

Operations such as rebuilding, defragmenting, or reorganizing an index do not change the distribution of data. Therefore, you do not need to update statistics after performing ALTER INDEX REBUILD, DBCC REINDEX, DBCC INDEXDEFRAG, or ALTER INDEX REORGANIZE operations. The query optimizer updates statistics when you rebuild an index on a table or view with ALTER INDEX REBUILD or DBCC DBREINDEX, however; this statistics update is a byproduct of re-creating the index. The query optimizer does not update statistics after DBCC INDEXDEFRAG or ALTER INDEX REORGANIZE operations.
Post #1474967
Posted Thursday, July 18, 2013 6:13 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, April 17, 2014 8:58 AM
Points: 5,077, Visits: 8,918
What that means is that rebuilding indexes doesn't change the distribution of data and therefore the ALTER INDEX REBUILD operation itself doesn't make the statistics go out of date. However, bear in mind the following:

(1) As Andrew mentioned, unindexed columns won't have their statistics updated
(2) Any index that is reorganized won't trigger an update of statistics
(3) The statistics update automatically triggered by ALTER INDEX REBUILD is based on a limited scan of the data, whereas UPDATE STATISTICS is based on a full scan.

John
Post #1474993
Posted Thursday, July 18, 2013 6:14 AM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Monday, April 07, 2014 1:34 AM
Points: 702, Visits: 2,163

Sorry - Update statistics is not required for Index Rebuild, automatically it will be updated. Please refer the below link. I have pasted the specific content below:

http://msdn.microsoft.com/en-us/library/ms190397.aspx

After Maintenance Operations


Consider updating statistics after performing maintenance procedures that change the distribution of data, such as truncating a table or performing a bulk insert of a large percentage of the rows. This can avoid future delays in query processing while queries wait for automatic statistics updates.

Operations such as rebuilding, defragmenting, or reorganizing an index do not change the distribution of data. Therefore, you do not need to update statistics after performing ALTER INDEX REBUILD, DBCC REINDEX, DBCC INDEXDEFRAG, or ALTER INDEX REORGANIZE operations. The query optimizer updates statistics when you rebuild an index on a table or view with ALTER INDEX REBUILD or DBCC DBREINDEX, however; this statistics update is a byproduct of re-creating the index. The query optimizer does not update statistics after DBCC INDEXDEFRAG or ALTER INDEX REORGANIZE operations.


Hi,

I think you need to read this: http://sqlblog.com/blogs/tibor_karaszi/archive/2007/08/09/is-statistics-over-non-indexed-columns-updated-by-index-rebuild.aspx

Thanks,

Simon




MCSA: SQL Server 2012
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
Post #1474994
Posted Thursday, July 18, 2013 8:00 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, April 03, 2014 9:30 PM
Points: 40, Visits: 230
Wah! Thank you Simon, John and Andrew.
Post #1475051
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse