Search This Blog

Friday, January 28, 2011

Restore SQL Database from MDF file

For ex., if you have northwind.mdf file, you can create a 
database with the following statement:
 
 
USE master
GO
CREATE DATABASE northwind
ON 
( NAME = northwind_dat,
   FILENAME = 'd:\Program Files\Microsoft SQL Server\Data\northwind.mdf',
   SIZE = 10,
   MAXSIZE = 50,
   FILEGROWTH = 5 )
LOG ON
( NAME = northwind_log,
   FILENAME = 'd:\Program Files\Microsoft SQL Server\Data\northwind.ldf',
   SIZE = 5MB,
   MAXSIZE = 25MB,
   FILEGROWTH = 5MB )
GO

1 comment:

  1. .MDF files can be repaired due to recover sql database. The tool launches with low system requirements, it's able to show the results of restoring databases.

    ReplyDelete