July 2009
Mon Tue Wed Thu Fri Sat Sun
« Jun   Aug »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Day July 2, 2009

Clearing out old backup history

Let’s say that you want to clear out your old backup history. Why would you want to do that? Let’s also assume that your maintenance plans (yes, maintenance plans) have not been cleaning up after themselves.

If this has happened over a small period of time, you can just do this:

EXEC sp_delete_backuphistory DATEADD(m, -1, GETDATE());

But what if you have a lot of backup history? Trying to delete two years of backup history will slow things down incredibly on your server and take a very very long time. To the point where your boss will come over and frantically say ‘Hey, why is the server refusing connections?’

Instead you’ll want to use something like this:

DECLARE @oldest_date AS DATETIME;

IF OBJECT_ID('tempdb..#dates') IS NOT NULL
  DROP TABLE #dates;

SELECT DISTINCT DATEADD(d, 0, DATEDIFF(d, 0, backup_start_date)) AS d
INTO #dates
FROM dbo.backupset

SELECT @oldest_date = DATEADD(d, 2, MIN(d))
FROM #dates
WHERE d < DATEADD(mm, -1, GETDATE())

EXEC sp_delete_backuphistory @oldest_date;

Why isn’t this in a loop? Because I have a sinus infection and I didn’t feel like being that clever while I’m working from home. That’s why. You probably should be clever and put this in a loop. And put a nice little wait at the end of it that waits for a minute or two before repeating the whole thing. Me? I just sit here and zone out for a few minutes. The point is, this works.

If you’ll excuse me, I’m going to get back to watching day time TV and pressing F5 every 3 minutes.

Columbus Give Camp is Just Two Weeks Away

The Columbus Give Camp is only two weeks away but it’s still not too late for both charities and volunteers to sign up.

GiveCamp is a weekend-long event where software developers, designers, and database administrators donate their time to create custom software for non-profit organizations. This custom software could be a new website for the nonprofit organization, a small data-collection application to keep track of members, or a application for the Red Cross that automatically emails a blood donor three months after they’ve donated blood to remind them that they are now eligible to donate again. The only limitation is that the project should be scoped to be able to be completed in a weekend.

During GiveCamp, developers are welcome to go home in the evenings or camp out all weekend long. There are usually food and drink provided at the event. There are sometimes even game systems set up for when you and your need a little break! Overall, it’s a great opportunity for people to work together, developing new friendships, and doing something important for their community.

At GiveCamp, there is an expectation of “What Happens at GiveCamp, Stays at GiveCamp”. Therefore, all source code must be turned over to the charities at the end of the weekend (developers cannot ask for payment) and the charities are responsible for maintaining the code moving forward (charities cannot expect the developers to maintain the codebase).

The deadline is July 8th, so get your charity proposals and volunteer submissions in!

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 401 items have been purified.