Database Recovery

  • I've got a database that went suspect, due to a log file that's gone corrupt. I've got recent backup's, but they are a day old, and want to try and recover the database without a restore. I am not running a full recovery model.

    I have detached the database, renamed the log file, and tried to attach it with 'sp_attach_single_file_db', with the following error message:

    Could not open new database 'mydb'. CREATE DATABASE is aborted.

    Device activation error. The physical file name 'c:\log\mydb_log.ldf' may be incorrect.

    Now 'c:\log\mydb_log.ldf', is the previous log path and file name. There is plenty of disk space, and I am logged in as an administrator.

    Does anyone know of another way to create a new logfile?

     


    Robert

  • Have you tried using the "WITH MOVE" option to set the log file to a different name?

  • Hi,

    I am currently using attaching the database with the single file method ('sp_attach_single_file_db'). Does the "WITH MOVE" work with this stored proc? I can't get the syntax right

    Thanks for your reply.


    Robert

  • I expect you have detached the database.

    From a theoretical point of view, it appears that SQL server is trying to create a new log file on top of the old one. Therefore try to rename the log file to something_log.old and then attach using sp_attach_single_file_db.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply