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.

1 Answer 1

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.

3
  • 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, 2015 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. Feb 24, 2015 at 0:54
  • 1
    Yup, thanks for pointing out that it is the SQL Service Account.
    – PlTaylor
    Feb 24, 2015 at 1:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .