Link to home
Start Free TrialLog in
Avatar of brokeMyLegBiking
brokeMyLegBiking

asked on

delete failure on backup device, Access is denied.

I can't figure out why I am getting an access denied error. The file does not seem to be in use.

I tried to drop my database and get this error:

 AsynchronousDiskAction::DoDeleteFile: delete failure on backup device 'C:\Program Files\Datalink\SFS\SqlServer\SFS_ISLAND_20060501.ldf'. Operating system error 5(Access is denied.).

The database is dropped from sysdatabases, but the physical files are still there.

ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
are you using DROP DATABASE syntax?

>> The database is dropped from sysdatabases

?? you mean dropped when "master" is current db?
Avatar of brokeMyLegBiking
brokeMyLegBiking

ASKER

how can I check that?
sweatCoder, yes, master DB is current DB. I am executing the command from a VB.NET windows application.
per aneeshattingal, make sure the user that runs mssql has write permissions on that ldf file and on the folder.
Easiest way is to goto
C:\Program Files\Datalink\SFS\SqlServer\
try to delete the log file . watch the error message ..
aneeshattingal, your experiment is only worthwhile if the logged in user is the same as the user context that mssql runs under. they are often not the same. just because the logged in user can delete a file doesn't mean mssql can.
You are Right SweatCoder. If he uses the windows Authentication, then the above strategy  will work
OK, I think we are on to something.

When I connect to my database using windows authentication, I have no problem, but when I attach using the sa login (which is what my application is using to connect to the DB) it has the problem...

hm, now I have to figure out how to grant read-write access to the sa login, for the directory:  C:\Program Files\Datalink\SFS\SqlServer\

I don't have this problem in sql Server 2005 developer edition, just express edition.

correction : *but when I use the sa login
Excellent!

Thanks for your help. This issue was really causing me some serious headaches.

To fix it I just have my program log in with windows authentication instead of using the sa login for any attach databse and drop databse commands.

-brokeMyLegBiking