• There is no easy way of doing it.

    I am sure that database was not cleanly shutdown so you won't be able to use only mdf file to recover the database (sp_attach_single_file_db)

    Do below steps.

    • Run the command for MDF file and get the logical and physical name of Log file.

    == I detached ran for pubs database files==

    DBCC CHECKPRIMARYFILE('C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf', 3)

    • Create a database with same physcial and logical file name.
    • Stop SQL Server.
    • Keep old mdf file on same location as of new database and rename log file.
    • Start SQL Server.
    • Database would come up in suspect mode.
    • Since Log File will not be linked to the new MDF File you have to run DBCC REBUILD_LOG

      dbcc rebuild_log('dbname','New Log File NAme')

    • THIS IS UNDOCUMENTED COMMAND.

    • database will come into Single User mode

    • Run dbcc checkdb and if there are problems then you need to restore from backup

     

    HTH