Hossein Moradinia
Hossein Moradinia

Reputation: 6244

Error in attaching a database in SQL Server 2008

I detach a database file from a SQL Server 2000 and try to attach it in SQL Server 2008 By the following code:

USE [master]
GO
CREATE DATABASE [KARGAR] ON 
( FILENAME = N'F:\1111\KARGAR_Data.MDF' ),
( FILENAME = N'F:\1111\KARGAR_Log.LDF' )
 FOR ATTACH
GO

When I try to run above code, I see the following error:

Msg 5120, Level 16, State 101, Line 1 Unable to open the physical file "F:\1111\KARGAR_Data.MDF". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)".

How can I fix this problem

Upvotes: 0

Views: 15000

Answers (2)

Ahmed Mongy
Ahmed Mongy

Reputation: 76

another way check you open management studio by user has permission

Upvotes: 2

gbn
gbn

Reputation: 432261

Thoughts:

  • Can SQL Server see the F: drive?
  • It has permissions there?
  • This is a local drive? SQL Server does not support network drives for databases normally

Note: the SQL Server engine runs under a service account that requires permissions on the relevant folders

Upvotes: 7

Related Questions