Error Kickmaleerie

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, August 3, 2005

SQL Server 2000 backuphistory quirk

Posted on 2:56 AM by Unknown
We came across this recently when we tried to delete a database and found that the server was churning away for hours at > 50% on each CPU. As Andrew's article explains this is because the backuphistory table in msdb is never cleared out - ours had > 250K rows and hence the load when sp_delete_backuphistory is called when a database is deleted!

If you have lots of databases that are backed up and hence a large table - like ours - you really want to step through a month at a time.

declare @xtime datetime
set @xtime = cast('04/01/2003' as datetime)
use msdb
exec sp_delete_backuphistory @xtime;

Once you have it cleared out then you probably want to add a nightly job to clean it up. Add something like the following procedure to to msdb:

create procedure TidyBackupHistoryTo60Days
as
-- delete backup entries older than 60 days
-- run as nightly job to keep msdb tidy
-- procedure must be stored in msdb as it uses
-- sp_delete_backuphistory which is defined there
begin
declare @xtime as datetime
set @xtime = dateadd(d,-60,getdate())
exec sp_delete_backuphistory @xtime
end
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • more getting the SMS message
    Following my recent " getting the message - too late " post about my employer's evident inability to "get" SMS as a ...
  • Find SQL Servers on your Network
    Very useful script.
  • Java Service Wrapper
    Over the past few months I have been using the very excellent eXist XML database available under the GNU LGPL on a project to store and qu...
  • SQL Server 2000 backuphistory quirk
    We came across this recently when we tried to delete a database and found that the server was churning away for hours at > 50% on each CP...
  • Changes, changes
    Having reached 60 in pretty decent shape I decided to retire and did so on the 29th July. There will be fewer technical issues blogged as I ...
  • Sizing tempdb in SQL Server
    Today I learnt that it is a bad idea to use the default size (8MB) and growth (10%) values for tempdb in a production environment. And you m...
  • ARPs and NIC Teaming
    Background: A NIC Team is known by a single MAC address to clients in the network. This MAC address is only used as the source MAC address...
  • OS X Lion, PostgresSQL and launchd
    Recently decided to install PostgresSQL on my new MacBook Air - and yes it's a beauty - as I always like to have anR DMS handy. The inst...
  • beyond marks on paper
    Ted Nelson's concept of hypertext predates the web, so it was interesting to get a request this morning from an academic colleague to ...
  • SQL Server Maintenance Plan Cleanup not working
    Like many folk, I've recently been caught out by the bug in SQL Server 2008 Maintenance Plan Cleanup tasks apparently running OK but not...

Categories

  • logs
  • sawmill
  • w3c

Blog Archive

  • ►  2011 (9)
    • ►  October (1)
    • ►  August (2)
    • ►  July (1)
    • ►  June (2)
    • ►  May (2)
    • ►  April (1)
  • ►  2010 (8)
    • ►  December (1)
    • ►  November (1)
    • ►  August (1)
    • ►  June (1)
    • ►  April (1)
    • ►  March (1)
    • ►  January (2)
  • ►  2009 (5)
    • ►  July (1)
    • ►  May (2)
    • ►  April (1)
    • ►  January (1)
  • ►  2008 (5)
    • ►  December (1)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  February (1)
  • ►  2007 (11)
    • ►  November (1)
    • ►  October (1)
    • ►  August (1)
    • ►  May (2)
    • ►  April (2)
    • ►  March (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2006 (15)
    • ►  December (1)
    • ►  November (3)
    • ►  October (1)
    • ►  September (2)
    • ►  August (1)
    • ►  July (4)
    • ►  June (1)
    • ►  March (2)
  • ▼  2005 (25)
    • ►  October (1)
    • ►  September (2)
    • ▼  August (9)
      • a very quiet commons
      • some you lose ....
      • Jump baby!
      • on the brink of extinction
      • It does exactly what it says on the tin
      • I take my hat off ...
      • OGG the way up
      • Alouette par radio est actuellement mon favori
      • SQL Server 2000 backuphistory quirk
    • ►  July (1)
    • ►  May (1)
    • ►  April (2)
    • ►  March (1)
    • ►  February (3)
    • ►  January (5)
  • ►  2004 (16)
    • ►  December (6)
    • ►  November (10)
Powered by Blogger.

About Me

Unknown
View my complete profile