Thanks for your reply Emilie
Unfortunately it is not a rights problem. The agent clearly has acces to the DB (can read ACL, Data docs etc.) and I meanwhile have written a quite slow but working workaround:
Have replace the n&= DB.AllDocuments.Count by a method, that first tries to use the normal AllDocuments method and if this one fails (error 4005) it creates a NotesNoteCollection for all DataDocuments and so gets the number of documents. But (!!!) this is very slow, it takes around 100-160 sec alone for this one DB ! The agent usually needs 20 seconds for all 400+ db's ... ;-)
But this is a workaround and not really a solution for this error. The question is what is going on in this DB. Is there more coming ?
Will today create a copy and then try to compact the whole DB.
Will keep you informed.
Joe