Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
197 views
in Technique[技术] by (71.8m points)

Restoring database from .mdf and .ldf files of SQL Server 2008

For some reason I have to uninstall SQL Server 2008 R2 but before that I copied two files (.mdf and .ldf) of my database from

C:Program Files (x86)Microsoft SQL ServerMSSQL10_50.MSSQL2008MSSQLDATA

Now, the question is, is it possible for me to recover the database from these files in my new installed SQL Server 2008 R2.

If yes: then how can I do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes, it is possible. The steps are:

  1. First Put the .mdf and .ldf file in C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDATA folder

  2. Then go to sql software , Right-click “Databases” and click the “Attach” option to open the Attach Databases dialog box

  3. Click the “Add” button to open and Locate Database Files From C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDATAfolder

  4. Click the "OK" button. SQL Server Management Studio loads the database from the .MDF file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...