We are facing an issue with our replication server. We are currently setting up a new environment to replace the old replication server and we keep getting the following error.
Server XXX\YYY, Level 16, State 1, Procedure sp_MSreplremoveuncdir, Line 83 Could not remove directory '\\\XXXXXX\VTWSnapshot\unc\XXXX$YYYY\77_11\'. Check the security context of xp_cmdshell and close other processes that may be accessing the directory. (Source: MSSQLServer, Error number: 20015)
Sometimes when we run the job to generate a new snapshot, it fails and sometimes it succeeds. Since it sometimes succeeds, I'm sure it's not an issue with access or permissions, else it would always fail.
My second thought was that something is locking some of the files, not allowing SQL to delete anything from the folders. Sadly I only have permission on SQL and not on the server or file share, making this hard to check. Communication also goes a bit slow, me being in Belgium and the head office of their company being in America, that's why I'd like to get as much information as possible so I could ask everything at the same time.
[This may be coincidence, but I'll mention it anyway]
When we run the snapshot job X+1 times, it succeeds, with X being the number of subscriptions we have.
Meaning: If we have 3 subscriptions A, B and C
- Job fails the first time on folder A
- Job fails on folder B
- Job fails on folder C
- Job succeeds
This kind of made me believe that the folders are somehow locked and the lock gets released after the job has run, but failed. The next time the job runs, it can continue with the next folder until they are all unlocked?
[/end of conspiracy]
Any help, thoughts, ideas are welcome.