In this article I am going to explain how to create database
from .MDF & .LDF file in Sql server.
Description
& Implementation:
I have .MDF and .LDF file of database. I want to restore or
create database from these files. We have 2 ways to create database from .MDF
and .LDF file.
Method 1:
Using T-Sql
Run the below given query :
CREATE DATABASE aspmantra ON
(FILENAME =
'F:\Project\db\aspmantra.mdf'),
(FILENAME =
'F:\Project\db\aspmantra_log.ldf')
for attach;
Method
2: Using Sql server Management studio (SSMS)
Follow the below given steps to create database from MDF
file.
Step 1: Login
to Sql server database engine. Right click on database and select the Attach. See
attachment
Step 2: Attach
database pop up window will be open. Click on add button.
Step 3: Locate
database files window will be open. Select the MDF file and press the Ok
button.
No comments:
Post a Comment