Error in attaching Adventureworks 2012 database

  • hi i have problem in attaching Adventure works 2012 database

    Attach database failed for Server '..........\MSSQLSERVER2012'. (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.2100.60+((SQL11_RTM).120210-1917+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

    ------------------------------

    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ------------------------------

    Directory lookup for the file "C:\CodePlex Database\AdventureWorks2012_log.ldf" failed with the operating system error 2(The system cannot find the file specified.). (Microsoft SQL Server, Error: 5133)

  • Directory lookup for the file "C:\CodePlex Database\AdventureWorks2012_log.ldf" failed with the operating system error 2(The system cannot find the file specified.). (Microsoft SQL Server, Error: 5133)

    SQL server can't find the log file. Have you double checked that it's in the path mentioned above?

    If you're restoring from the GUI you can change the path to the log file in the bottom half of the attach dialogue. or just change the path in your create database statement.

    CREATE DATABASE AdventureWorks2012 ON (FILENAME = 'M:\Data\AdventureWorks2012_Data.mdf'),

    (FILENAME = 'L:\Tlogs\AdventureWorks2012_Log.ldf') FOR ATTACH;

  • The database is looking for the log file in the directory specified in the mdf file, not where you placed it.

    T-SQL

    USE [master]

    GO

    CREATE DATABASE [AdventureWorks2012] ON

    ( FILENAME = N'<Enter path to the mdf file here>\AdventureWorks2012_Data.mdf' )

    FOR ATTACH

    GO

    This will create a new ldf file in the default log file directory.

    Management Studio

    In the Attach Databases dialog box:

    Click the Add button and browse to the mdf file

    Click on the row that specifies the log file

    Click the Remove button

    Click OK

  • I have tried it as well but failed, can we connect over skype please

  • chikatinelson (9/30/2013)


    I have tried it as well but failed, can we connect over skype please

    With which error did it fail?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • chikatinelson (9/30/2013)


    http://www.mssqltips.com/tipimages2/2638_Attach2.jpg..

    When using the GUI for attaching a database, select the MDF file in the upper part, then delete the log file in the below part (the database details).

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I deleted the log file and soon after that the 'message' column on the upper part indicates "Not Found"

  • chikatinelson (9/30/2013)


    I deleted the log file and soon after that the 'message' column on the upper part indicates "Not Found"

    Screenshot?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Check the uploaded document

  • OK, what if you copy the .mdf file to the DATA folder of your SQL Server installation and try it again?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thank you so much, it worked! I spent 2 days trying to figure out how to attach the AdventureWorks2012.

    I do appreciate, many THANKS!!!

  • chikatinelson (9/30/2013)


    Thank you so much, it worked! I spent 2 days trying to figure out how to attach the AdventureWorks2012.

    I do appreciate, many THANKS!!!

    No problem, glad to help.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 13 posts - 1 through 12 (of 12 total)

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