Wednesday, 2 July 2014

Attaching DB from .mdf file




Find the below steps to attach a DB from .mdf file

a.       Connect to the DB server 

b.      Right click on the DB sever and select Attach..


c.       Click on the ADD button and Browse to the .mdf file


d.       Select the file and click on OK button.




          e.   Refresh on the server, you will find the DB
                              
         or fire the below query to attach the DB

           CREATE DATABASE MyAdventureWorks
           ON (FILENAME = 'C:\MySQLServer\AdventureWorks_Data.mdf'),
           (FILENAME = 'C:\MySQLServer\AdventureWorks_Log.ldf')
           FOR ATTACH;     

No comments:

Post a Comment