1

I have tried to run the following command on my server that is using sql 2008 merge replication

sp_addscriptexec MyPub, '\\my-server\MSSQL\updateTablePermissions.sql', 1

and I get the following error message

Msg 21330, Level 16, State 1, Procedure sp_MSreplcopyscriptfile, Line 40

Cannot create a sub-directory under the snapshot folder (if not exist "\my-server\mssql\repldata\unc\my-server_my_db_MyPub\UserScripts" md "\my-server\mssql\repldata\unc\my-server_my_db_MyPub\UserScripts"). Ensure that there is enough disk space available, and that the account under which the Snapshot Agent runs has permissions to create a sub-directory under the snapshot folder.

There is plenty of space, and my snapshots run with no problem. I'm sure I am missing something simple, but for the life of me I don't see it. A similar command was run on the parent to this server with no problems.

PlTaylor
  • 1,067
  • 7
  • 8

1 Answers1

0

This is most likely a permissions issue.

According to sp_addscriptexec, to use sp_addscriptexec, the SQL Server service account must have read and write permissions on the snapshot location and read permissions on the location where any scripts are stored.

To use sp_addscriptexec, the SQL Server service account must have read and write permissions on the snapshot location and read permissions on the location where any scripts are stored.

Please verify your SQL Server service account has read and write permissions on the snapshot directory and try again.

  • It should, snapshots run regularly, and have no permissions error. Having said that what is the easiest way to figure what account this is actually running under? – PlTaylor Feb 23 '15 at 23:32
  • 1
    The error you are receiving is misleading. It refers to the Snapshot Agent account but you should be checking if the SQL Server service account has read and write permissions on the snapshot directory. – Brandon Williams Feb 24 '15 at 00:54
  • 1
    Yup, thanks for pointing out that it is the SQL Service Account. – PlTaylor Feb 24 '15 at 01:07