Access error when running alter table on the table that is being replicated

31 Views Asked by At

I have the replication set up on the SQL Server from ServerName to ServerName2

  • The replication folder is shared as \\ServerName\repldata and
  • Replication snapshot-agent runs under the windows account ServerName\repl-snapshot, and the transactional log is under the account ServerName\repl-log. Both accounts have full acess to the replication folder, as well as the service account under which the sqlserveragent runs (nt service\sqlserveragent)

The replication itself works correctly, as far as I can tell.

Now, I need to alter the table that is the part of the replication, so I ran the following exec sp_register_custom_scripting 'CUSTOM_SCRIPT', '[dbo].[sp_storedProcedureSettingUpTheReplicationAndAddingArticles]', null, null

And then I attempt to run the the alter table command, and .. get the error

Msg 22048, Level 16, State 1, Line 0 xp_create_subdir() returned error 5, 'Access is denied.' Msg 21330, Level 16, State 1, Procedure distribution.dbo.sp_MSreplcopyscriptfile, Line 44 [Batch Start Line 0] Cannot create a sub-directory under the snapshot folder (\ServerName\repldata\20240102152344170). 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. Msg 3609, Level 16, State 2, Line 3 The transaction ended in the trigger. The batch has been aborted.

The very strange thing to me is that there is NO such folder/subfolder as \repldata\20240102152344170.

On the ServerName machine, the folder structure is

\repldata\unc\ServerName_publishDB_PublishDB\20240102154707

I am at loss now where to turn...

0

There are 0 best solutions below