Hello all,
I have a backup database file (i.e. test.mdf), however, I don't have the LDF file. I was told that SQL Server 2008 R2 can load MDF without LDF.
Is that true?
Thank you
Hello all,
I have a backup database file (i.e. test.mdf), however, I don't have the LDF file. I was told that SQL Server 2008 R2 can load MDF without LDF.
Is that true?
Thank you
Assuming the database was detached cleanly, you should be able to use sp_attach_single_file_db or the newer CREATE DATABASE...FOR ATTACH syntax.
EXEC sp_attach_single_file_db
@dbname = 'YourDB',
@physname = N'C:\YourFile.mdf';
OR
CREATE DATABASE YourDB
ON (FILENAME = 'c:\YourFile.mdf')
FOR ATTACH_REBUILD_LOG;
Another option to sp_attach_single_file_db
is the CREATE DATABASE command with the FOR ATTACH_REBUILD_LOG option.