SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server Backups & Maintenance - Best Practices


SQL Server Backups & Maintenance - Best Practices

Author
Message
JAMMOD
JAMMOD
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 82
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!
DBA From The Cold
DBA From The Cold
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2209 Visits: 1746
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
HanShi
HanShi
SSCarpal Tunnel
SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)

Group: General Forum Members
Points: 4482 Visits: 3672
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’! **
DBA From The Cold
DBA From The Cold
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2209 Visits: 1746
Sorry but an update of the statistics is necessary as a rebuild index will not update the statistics on non indexed columns.

Andrew
JAMMOD
JAMMOD
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 82
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,
HanShi
HanShi
SSCarpal Tunnel
SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)

Group: General Forum Members
Points: 4482 Visits: 3672
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’! **
balasaukri
balasaukri
SSC-Enthusiastic
SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)

Group: General Forum Members
Points: 121 Visits: 301
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.
John Mitchell-245523
John Mitchell-245523
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14694 Visits: 15980
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
s_osborne2
s_osborne2
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1019 Visits: 2292

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



MCSE: Data Platform
MCSE: Business Intelligence
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
balasaukri
balasaukri
SSC-Enthusiastic
SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)

Group: General Forum Members
Points: 121 Visits: 301
Wah! Thank you Simon, John and Andrew.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search