Shoemoney throwback

Just a fun note… over 8 years ago ShoeMoney had a contest to see if anybody could outrank a site for “ShoeMoney”.  I totally forgot that I came in 5th for MSN.  The blog page is still there http://shoemoney-contest.blogspot.com/

It wasn’t a big thing.  I won $65.  The methods I used probably don’t work that well any more but it was fun.

You can follow the contest here…

http://www.shoemoney.com/2006/05/21/can-you-outrank-me-for-shoemoney-i-got-1000-that-says-you-cant

http://www.shoemoney.com/2006/06/01/shoemoney-contest-really-getting-interesting

http://www.shoemoney.com/2006/06/01/ok-i-was-trying-to-play-it-off

http://www.shoemoney.com/2006/06/02/mini-seo-contests-end-today

http://www.shoemoney.com/2006/06/02/shoemoney-winners-are

Remove URL from wordpress excerpt

If you have URLs showing up in your excerpt simply add the following somewhere in the top of your theme’s index.php file.

<?php
function RemoveURL($string)
{
  return preg_replace(‘/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i’, ”, $string);
}
add_filter(‘the_excerpt’, ‘RemoveURL’);
?>

This will remove 99% of the URLs in your excerpts.

SQL Server extremely slow to restore

I recently had an issue where restoring a SQL Server database would take forever just to load the restore window.  Right clicking a database, going to Tasks –> Restore –> Database would take MINUTES just to load on a good day.

While I have upgraded and patched the server it has been running since 2008. (You have to love VM Ware allowing you to update hardware and not reinstall).

Cause:
SQL Server logs all backups/restores to MSDB.  You can query all the information from the following system views.

msdb.dbo.backupfilegroup
msdb.dbo.backupmediafamily
msdb.dbo.backupmediaset
msdb.dbo.backupset

In my case because we have been running so many databases for so long I had over 1,000,000 records in msdb.dbo.backupset.  Any time that I used SQL Management Studio to restore a database, or if you deleted a database and instructed it to delete the backup history too, it would take FOREVER.

Resolution:
I created a simple job that deletes backups history over 90 days.  Just change “90” to however many days you want to delete and BLAMO everything is good again.

DECLARE @CutOff    DATETIME
SELECT @CutOff = DATEADD(day, -90, GETDATE())
EXEC SP_DELETE_BACKUPHISTORY @CutOff