Recovering a deleted database
-
Friday, January 18, 2013 4:36 PM
Hello!
Removed database. I restored the database files (MDF, LDF). I can attach the files to the database server to restore the database?
ps: SQL Server 2012 SP1, Windows Server 2008R2 SP1
sorry my english.
All Replies
-
Friday, January 18, 2013 5:34 PM
since you already have mdf and LDF files, Yes, you can directly attach them ..use the below code... you need to replace Test2013 with database name and filename should be pointing to your mdf and ldf file locations....syntax should look like belowUSE [master] GO CREATE DATABASE [Test2013] ON ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012\MSSQL\DATA\Test2013.mdf' ), ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012\MSSQL\DATA\Test2013_log.ldf' ) FOR ATTACH GO
Hope it Helps!!
-
Friday, January 18, 2013 9:00 PM
Stan210,
thank you!

