snippetMinor
How to detach a sql server 2008 database that is not in database list?
Viewed 0 times
2008detachsqldatabasethathowserverlistnot
Problem
I installed sql server 2008 on windows 7 then i create a Database! after 2 days, i reinstall the windows and install the sql server! now i am trying to attach my database file, but i encounter to bellow error. i think that the files are like a attached file and i can't attach them. what is difference of an attached file and a not attached file? how can i to attach this file? Please Help Me.
Error Text:
TITLE: Microsoft SQL Server Management Studio
Attach database failed for Server 'AMIR-PC'. (Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1540+)&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:\Company.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.50.1600&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476
Error Text:
TITLE: Microsoft SQL Server Management Studio
Attach database failed for Server 'AMIR-PC'. (Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1540+)&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:\Company.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.50.1600&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476
Solution
I'm pretty sure the problem is that due to the uninstall/reinstall of SQL Server, the database engine no longer has permissions on the database files.
If you move the .mdf and .ldf files to the data folder that you specified on install, it should work for you. If you want to keep the files where they are, make sure the permissions are configured to allow appropriate access to the database engine service account group.
If you move the .mdf and .ldf files to the data folder that you specified on install, it should work for you. If you want to keep the files where they are, make sure the permissions are configured to allow appropriate access to the database engine service account group.
Context
StackExchange Database Administrators Q#20156, answer score: 5
Revisions (0)
No revisions yet.