locked
Attach database failed for Server RRS feed

  • Question

  • TITLE: Microsoft SQL Server Management Studio
    ------------------------------

    Attach database failed for Server 'EVEREST-LAPPY\SQLEXPRESS'.  (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&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)

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

    Unable to open the physical file "F:\Black-book C# 2008\C#2008_BB\Project OnlineCabService\OnlineCabService\KogentCab.mdf". Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476

    ------------------------------
    BUTTONS:

    OK
    ------------------------------
    Thursday, November 4, 2010 4:52 PM

Answers

  • Permission issue. Check what is the service account and that account have permission to the location. By default service account should be network service acount, you may change that to local system (not recommended as per security best practices) and attach the db.

    Madhu


    MCITP, MCTS, MCDBA,MCP-- Blog : http://experiencing-sql-server-2008.blogspot.com/
    • Proposed as answer by WeiLin Qiao Monday, November 8, 2010 5:56 AM
    • Marked as answer by Tom Li - MSFT Monday, November 15, 2010 2:36 AM
    Thursday, November 4, 2010 5:07 PM

All replies

  • Permission issue. Check what is the service account and that account have permission to the location. By default service account should be network service acount, you may change that to local system (not recommended as per security best practices) and attach the db.

    Madhu


    MCITP, MCTS, MCDBA,MCP-- Blog : http://experiencing-sql-server-2008.blogspot.com/
    • Proposed as answer by WeiLin Qiao Monday, November 8, 2010 5:56 AM
    • Marked as answer by Tom Li - MSFT Monday, November 15, 2010 2:36 AM
    Thursday, November 4, 2010 5:07 PM
  • For security reasons, when detaching a table SQL Server sets the rights to only allow access to the account who DETACHED the database. 

    If you moved this file, you need to reset the rights to the current user.

    http://msdn.microsoft.com/en-us/library/ms189128.aspx

     

    Thursday, November 4, 2010 5:52 PM
  • Hi, Easiest fix is to start management studio as an administrator (Right click on Management studio and choose run as administrator) and attach the database again. Thanks, Manoj Das
    MDas
    • Proposed as answer by Manojpdas Tuesday, July 26, 2011 5:11 PM
    Tuesday, July 26, 2011 5:10 PM
  • Thanks Manojpdas. I don't know how and why? Bit it helped me to attach a database.
    • Edited by Chintalas Tuesday, June 18, 2013 2:57 AM
    Tuesday, June 18, 2013 2:56 AM
  • This seems like access issue. add the SQL service account in security tab of the folder F:\Black-book C# 2008\C#2008_BB\Project OnlineCabService\OnlineCabService with full right.
    Tuesday, June 25, 2013 12:03 PM