Thursday, March 29, 2012

Error 5123 SQL Server Database Attach Failed

In SQL Server 2008 R2, the attach database option may failed with the below error in some scenarios

CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file... (Microsoft SQL Server, Error 5123)

This will occur due to login mismatch, ie., the login name which we used to detach is different while attaching the same database.

Please assign full rights on the physical files (mdf, ldf) to and try attach option it will work.

1 comment:

  1. You'll have same error if when using Buildin admin account in Server 2008 r2 and 2012.

    ReplyDelete