Thursday, March 25, 2010

Can not restore sql server 2005 Backup

If restoring a .bak file to a new database fails then go to these steps.

Create a new database using this script.

 USE [master]
GO


CREATE DATABASE [Test] ON PRIMARY
( NAME = N'Test', FILENAME = N'C:\Test.mdf' , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Test_log', FILENAME = N'C:\Test_log.ldf' , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

Stop sql server service.

then replace the newly created  .mdf & .ldf files with your older .mdf & .ldf files.

Stop sql server service. 

Refresh  your server tree.


Then you are done...

No comments: