• Balmukund Lakhani (3/31/2006)


    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.

    == I detached ran for pubs database files==

    DBCC CHECKPRIMARYFILE('C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf', 3) 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