sql server

Restore All Databases With Most Recent Backup

ben himself's picture

This is a bit of a scary task.  Someone tells you about 87 databases that all need to be restored from the most recent FULL backups. You can either spend the rest of your day pointing and clicking, or you can use some PowerShell power to crank out the script and get on with your day. Here is the PowerShell way.

I don't like to fire-off the actual backups from PowerShell, rather I just use it to script out the restore script.  So, this PowerShell script will output the T-SQL restore script:

(See caution below before running this!)

Tags: 

Moving Database Files to Another Location

ben himself's picture

Although moving database files around is simple, it is a still big deal.  When you do this, you are moving the entire database contents to another location.  If you have the space, a backup beforehand wouldn’t be a bad idea.  This is the script that I use to make this happen.

Tags: 

Pages

Subscribe to RSS - sql server