Restoring your Sitecore databases using SQL2005

Everytime I receive databases from customers, (support-)team members, etc, it’s always the same story… Restoring… Grrr… Sitecore has the incredible cool tool called MS SQL Database Restore Tool, but sometimes you just have to run a simple SQL script because you haven’t got any right to run a program, or don’t want to. So I’ve created a simple restore script:

RESTORE DATABASE [sc53Archive] FROM DISK = N’D:\Backup\sql\SC53ARCHIVE_DATA.bak’ WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
RESTORE DATABASE [sc53Core] FROM DISK = N’D:\Backup\sql\SC53CORE_DATA.bak’ WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
RESTORE DATABASE [sc53Extranet] FROM DISK = N’D:\Backup\sql\SC53EXTRANET_DATA.bak’ WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
RESTORE DATABASE [sc53Master] FROM DISK = N’D:\Backup\sql\SC53MASTER_DATA.bak’ WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
RESTORE DATABASE [sc53RecycleBin] FROM DISK = N’D:\Backup\sql\SC53RECYCLEBIN_DATA.bak’ WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
RESTORE DATABASE [sc53Security] FROM DISK = N’D:\Backup\sql\SC53SECURITY_DATA.bak’ WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
RESTORE DATABASE [sc53Web] FROM DISK = N’D:\Backup\sql\SC53WEB_DATA.bak’ WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10

GO

Just find-and-replace ‘sc53’ with the prefix you like and the same goed out to the backupfilepaths. Using this script you should be able to restore in 10 minutes instead of the hour it would cost otherwise. Have fun 🙂