Friday, February 24, 2012

Distribution clean up: distribution job not removing snapshots

On SQL Server 2005 SP2 for Publisher and Distributor on the same instance, my old snapshots are not being cleaned up.

The following error is in the agent history:

Executed as user: Domain\MyUser. Could not remove directory '\\vmsql01\ReplData\unc\Publication_TRANSACTIONAL\20070702104416\'. Check the security context of xp_cmdshell and close other processes that may be accessing the directory. [SQLSTATE 42000] (Error 20015). The step failed.

xp_cmdshell is enabled and I can run commands like :

exec master.dbo.xp_cmdshell ' md c:\TestFolder\'

The permissions to the snapshot share and file system are that Domain\MyUser has full control.

I have logged into the machine as this user and can remove snapshots so it does not seem to be a permission issue.

On other machines I do not get any errors but the snapshot folder still is not cleaned up.

Any suggestion as to what the problem could be?

Thanks,

Amy

hi amy,

i think there's a sql job in msdb

if i quite remember well to do the

clean up

you may manually trigger

regards,

joey

|||

Update:

I ran filemonitor while the cleanup job was running and noticed it was telling me the user that owns the SQL Server Service had access denied errors. I gave that user permissions to the snapshot folder and it is now cleaning up (well any of the really old stuff it is not but anything that has expired lately it has cleaned up).

My SQLUser1 owns the SQL Server Server and SQLUser2 owns the SQL Server Agent Service.

I thought the SQLUser2 would be the one who required permissions to the snapshot folder to clean it up?

Does xp_cmdshell need to be enabled for the cleanup job to work? I have not found anything in BOL to suggest that but ...

The other machines are still running cleanup jobs without error and still not removing any snapshots.

Any suggestions?

Thanks,

Amy

No comments:

Post a Comment