Sheculed agent cannot delete DB, why?!

Hi

I have an agent which looks up a certain ResultsDB on the server, deletes it if it exists and then creates a new blank one to store new results (documents) in there.

When I shculde this agent, if the ResultsDB exists, it cannot delete it and therefore cannot create a new one to replace it. It works if no ResultsDB exists (eg if I delete Results DB manually)!

Any ideas, why the same agent cannot delete the db when it is scheduled?!

I have full admin rights to the server with unrestricted agent rights etc. The agent is signed with my ID. The server is Linux.

I have also tried to run the scheduled agent several times automatically without touching the ResultsDB to see if the problem is that my pc keeps a handle to the resultsDB and does not drop it in time for the scheduled agent to be able to delete the db. But that is not it either.

Any suggestions will be much appreciated.

thanks

Bizhan

Subject: Make sure the database is not Open.

You don’t say how you are getting access to the database, but if you only access the database through a DIM statement, you can delete it.

e.g.:

CONST DB_TARGET = “resultsdb.nsf”

DIM dbTarget As New NotesDatabase(“”,DB_TARGET)

Call dbTarget.Remove

You can check to see if your database is open by flag = dbTarget.IsOpen. If it is open, you can probably remove (delete) it, but it won’t truly be removed until it is no longer in use (usually after your agent stops running).

Any errors in the log?

Subject: RE: Make sure the database is not Open.

Hi Robert

Yes the DB was open due to an operation carried out a few lines before wanting to remove it.

I have been using something like you suggetsed to gain access to it:

DIM dbTarget As New NotesDatabase(“”,DB_TARGET)

buit that othjer operation was probably responsible for keeping the db open. I should be able to delete it now before creating a new DB.

Many thanks

Bizhan