Help needed! database recovery from .mdf (only)

  • so how exactly it will be? can you please put an example of full code?

    Thank you

  • USE master;

    GO

    EXEC sp_attach_single_file_db @dbname = 'YourDatabase',

    @physname = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\YourDatabase_Data.mdf';

    make sure there isn't a YourDatabase_log.ldf in there

    OR

    USE [master]

    GO

    CREATE DATABASE [YourDatabase] ON

    ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\YourDatabase_Data.mdf' )

    FOR ATTACH

  • vazaryan84 (1/18/2012)


    so how exactly it will be? can you please put an example of full code?

    Thank you

    As you had it, without the log files and FOR ATTACH_REBUILD_LOG

    CREATE DATABASE [DM_REPO_ERP ] ON

    ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\DM_REPO_ERP .mdf' )

    FOR ATTACH_REBUILD_LOG

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thank You VERY MUCH!!!

Viewing 4 posts - 16 through 18 (of 18 total)

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