Denial of permission while deleting SQL Server 2005 Express database file on Vista

198 views Asked by At

I am using MS SQL Server 2005 as DBMS for my WinForms App. Data is stored in encrypted archives containing .mdf and .log files. App is running with admin rights.

While app is using a given data file, .mdf and .ldf files are extracted to users temp folder and attached to DBMS. When file is closed from app menu, db is detached and db files are archived to original archive file, and deleted from users temp storage.

Everything has been working fine on my Win7, XP and Vista machines. But on some of clients Vista machines denial of access errors are logged, while app is moving detached .mdf and .ldf files to archive them. At the same time there are no such errors on other machines, having same OS (Vista) and antivirus (avast)

1

There are 1 answers

1
Jason Williams On BEST ANSWER

The main things to check are:

  • Be sure you really do have admin rights. If the PCs are on a different domain, check that "administrator" gives you the rights you think you'll get.
  • SQL Server may still have the database files open. It may be as simple as waiting for a few seconds after dismounting to be sure it's finished before you start working on the database files.

A better approach may be to ask SQL Server to handle the databases for you: restore/backup the database from/to your archive and drop it using SQL calls, rather than trying to modify the raw files yourself.