SQL Server Image http://www.Oostdam.Info General pictureMicrosoft SQL Server is a great product to work with. Especially from the release of version 2005 and now 2008. For me, it is the standard for all kinds of databases. The Object explorer, Tuning Advisor, the Query Analyser and T-SQL statements work great, and are a joy to work with. When it goes wrong somewhere, it is mostly a syntax error, program(bug) error or a user error that causes the problem. Stable as it is, I can recomment the use of it to anyone. In this articles I like to share with you, some errors and "best practices" that came up during my work several times. So, initially set up was for my own references, now I share it with you. Enjoy these articles!! Due to the fact that a big percentage of visitors of this page are international based, this article is in the english language.

Error 5123 when attaching a database:
This is a common error which i've seen on many occasions. Sometimes you have to detach a database. You cannot allwys use backup files or other solution. This error can occur when you try to attach the database again, mostly on different locations. Mostly it is something like: SQL Server -Error 5123 : Cannot attach DB

Please check the following things which each can be the source of your problems:

  • Check the exact database names and file paths.
  • Disable your Anti Virus Software, this could "lock" your database as well.
  • Check if backup software is "locking" de Database.
  • Give NTFS security permissions for the MDF and LDF files to "Everyone".
    ( and on that directory or (mapped) disk letter
  • Move the files to a sub directory, root directories can give errors sometimes.
  • Rename the database files.
  • Try using Windows Authentication instead of SQL Server Authentication or the other way around.
    ( while logging on to the Management Studio GUI )
  • Logon on the server ( and Management Studio under another Administrative account.
  • Restart the SQL services ( preferred after working hours )
  • Open a new Query and use the "sp_Attach_DB" command to attach the database.
    ( remember, the GUI ain't always everything )

Each of the above mentioned possible solutions can do the trick. Please try re-attaching the DB after each possible solution.

This looks like a typical SQL 2005 error. I've never seen it on SQL 2000 or SQL 2008 so far.

Printscreen: Not available.


Ben OostdamBen Oostdam has been working with Windows systems since 1993. Worked for several companies as a system administrator, and is currently a Senior Support Engineer for Qurius Customer Care in the Netherlands specialized in System Center Solutions.

Disclaimer: The information contained in this website/article is for general information purposes only. The information is provided as is, by Ben Oostdam and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. In no event will we be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website. Through this website you are sometimes able to link to other websites which are not under my control. I have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them. Every effort is made to keep the website up and running smoothly. However, I take no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control. All entries in these articles, are my individual opinion, or from co-writers and they don't necessary reflect the opinion of my employer.


Friday the 16th, April 2021. All rights reserved.. // Oostdam WebDesign