July 2009 - Posts

28 July 2009
How to get the logical and physical file names for a database
For some operations you need to know the logical and physical file names for the data and log files in a database. Here's some code to get hold of this information. It assumes you only have one data and one log file. This is all I have needed so far. I'm sure it could be adapted fairly easily... Read More...
13 July 2009
Better dependency checking
The dependency information in SQL Server has always been a bit shaky. It's a hard problem for them to solve. Meanwhile, I think you can do a lot worse than simply search the 'source code' of the objects in the database. That way you can even search for things that aren't proper objects... Read More...
Filed under:
06 July 2009
Housekeeping backup and restore history
Every backup and restore event is logged in history tables in msdb and these tables can get out of hand, especially if you're using log shipping. Here's one way to sort it out that will catch up with the backlog and then keep your history tables trimmed. This code will delete the oldest days... Read More...
05 July 2009
Roll your own log shipping
I tried to use SQL Server’s built-in log shipping to set up a disaster recovery facility but I found there were some serious limitations. So, after some research, I decided to do it myself. Here’s what happened. Requirements A disaster recovery plan is useless unless you can test it, preferably at least... Read More...
Filed under: