domenica 18 settembre 2011 15:18
I am getting an error message when trying to attach AdventureWorks2008R2_Data.mdf in SSMS. An error message pops up and says:
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\AdventureWorks2008R2_Data.mdf'. (.Net SqlClient Data Provider)
Server Name: (local)
Error Number: 5123
Line Number: 1
Does anyone know what is wrong and how to fix this?
- Modificato Knot domenica 18 settembre 2011 15:18
Tutte le risposte
lunedì 19 settembre 2011 06:06Hi,
You are attaching mdf file on same version?
First Detach it from old DB then try.
martedì 20 settembre 2011 22:57No, actually I'm trying to attach it on a new computer on a new installation of SQL Server 2008R2 Developer's Edition. Could it have anything to do with not having an Admin account? How do I check if there is an Admin account and if there isn't how do I add one?
lunedì 26 settembre 2011 17:09
some links about this problem :
2 possible reasons :
- the .mdf file is in a read-only state ( classical if the file has been copied from a CD/DVD where the files are read-only usually )
- the login you used to execute your T-SQL CREATE DATABASE FOR ATTACH has not the correct access to the folder where you have your .mdf file
Don't hesitate to post again for more help or explanations
Have a nice day
PS : a stupid question : how have you detached your database ?
PS2 : when you try to attach database files from a more recent version , the error message is different , maybe the 968 message
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
mercoledì 28 settembre 2011 01:13
Thank-you for the information. I am not quite sure how this happened but some time between posting this problem and now the downloaded AdventureWorks databases appeared in SSMS. Perhaps it was after a reboot...? It was possible to see them in Quest's Toad 5.5 before they were visible in SSMS. Anyhow, this seems to have remedied itself! About your PS #1 Papy - the download instructions I was following said it would be necessary to attach the databases in SSMS by right clicking on the Databases node & then clicking Attach.knot