none
Operating system error 2 and Microsoft SQL Server, Error: 5120 - "canot find file specified"

    Question

  • Using SQL Server 2008R2 Express.

    My db is a .mdf, 9GB in size. The .ldf is 23gb in size.

    I am trying to attach my .mdf to SQL Server 2008R2 Express. The DB was take from our live environment. I am working in a test environment with 2008R2 Express.

    When try attach - receive error:

    ___________________________________________________

    Attach database failed for server "myserver/name". (Microsoft.SqlServer.Smo)

    Additional information:

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

    -> Unable to open the physical file "e:\Myfile\name". Operating system error 2: "2(The system cannot find the file specified)". (Microsoft SQL Server, Error 5120)

    ___________________________________________________

    I do not know why "cannot find the file specified" it is sitting right there on the same HDD as my SQL installation - User has full control to files an folders.

    I need to attach this mdf! Is my .ldf too large or 2008R2 express? 

    Thanks for your help!

    Monday, May 07, 2012 1:24 PM

Answers

  • I committed out the line to attach the log file. Created a new log file.

    Issue resolved. Possible issue was corrupt log file or .ldf too large for sqlexpress.

    Thanks for you help everyone

    • Marked as answer by Dustin Sayes Monday, May 07, 2012 4:31 PM
    Monday, May 07, 2012 4:31 PM

All replies

  • Can you trying running SSMS as Administrator (Right click run as Admin).

    Regards,
    Ahmed Ibrahim
    SQL Server Setup Team
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
    This can be beneficial to other community members reading the thread.

    Monday, May 07, 2012 1:35 PM
    Moderator
  • I'm on Server 2003.

    I right clicked SSMS - Select "run as"

    I have two options. Current user or "following user:

    I choose current user (myCompay_AD\myID) - then removed the check box for "run this program with restricted access"

    -- Same error

    I will ask one of our DBA's to login with SQLAdmin account - maybe this will help?

    Monday, May 07, 2012 1:57 PM
  • Using SQL Server 2008R2 Express.

    My db is a .mdf, 9GB in size. The .ldf is 23gb in size.

    I am trying to attach my .mdf to SQL Server 2008R2 Express. The DB was take from our live environment. I am working in a test environment with 2008R2 Express.

    When try attach - receive error:

    ___________________________________________________

    Attach database failed for server "myserver/name". (Microsoft.SqlServer.Smo)

    Additional information:

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

    -> Unable to open the physical file "e:\Myfile\name". Operating system error 2: "2(The system cannot find the file specified)". (Microsoft SQL Server, Error 5120)

    ___________________________________________________

    I do not know why "cannot find the file specified" it is sitting right there on the same HDD as my SQL installation - User has full control to files an folders.

    I need to attach this mdf! Is my .ldf too large or 2008R2 express? 

    what command are you using to attach this database ?

    did you specify the location of both files (.mdf and .ldf) for attaching and does the SQL Server service account have full access to this directory?


    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Monday, May 07, 2012 2:59 PM
  • I have used two methods to attach.

    Right click on "databases" and "attach", then select my .mdf - The log file is automatically reconigized and pulled into the list to be added. 

    Second method I have tried:

    USE master 
    GO
    CREATE DATABASE [Database_name] ON 
    ( FILENAME = N'E:\Program Files\Microsoft SQL Server\MSSQL\Data\mydbname.mdf' ),
    ( FILENAME = N'E:\Program Files\Microsoft SQL Server\MSSQL\Data\mydbname.ldf' )
    FOR ATTACH;

    ---- this method does not work - "could not open new database "database_name" - create database aborted.

    An error occured while processing the log for database 'mydb'. if possible, restore from backup, it might be necessary to rebuild the log"

    I'm using SQL 2008R2 express. my .ldf is larger than 10gb. Is my .ldf size an issue? 

    I'm assuming SQL has access to the directory. SQL is installed in the same location.

    Monday, May 07, 2012 3:45 PM
  • I committed out the line to attach the log file. Created a new log file.

    Issue resolved. Possible issue was corrupt log file or .ldf too large for sqlexpress.

    Thanks for you help everyone

    • Marked as answer by Dustin Sayes Monday, May 07, 2012 4:31 PM
    Monday, May 07, 2012 4:31 PM