: Access to the path 'C:\Program Files\Microsoft SQL Server\MSSQL15.TESTSERVER\MSSQL\ReplData\unc' is denied.

siva reddy 6 Reputation points
2021-11-12T06:34:08.373+00:00

HI

Actually i configured Transactional replication on SQL 2019 developer edition but i getting below error. I am gave all permission to folder but is show again this error

Source: mscorlib
Target Site: Void WinIOError(Int32, System.String)
Message: Access to the path 'C:\Program Files\Microsoft SQL Server\MSSQL15.TESTSERVER\MSSQL\ReplData\unc' is denied.
Stack: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at Microsoft.SqlServer.Replication.Utilities.CreateDirectoryWithExtendedErrorInformation(String directory)
at Microsoft.SqlServer.Replication.Snapshot.SnapshotProvider.CreateSnapshotFolders()
at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: mscorlib, Error number: 0)

Windows for business Windows Client for IT Pros Networking Network connectivity and file sharing
Windows for business Windows Client for IT Pros Devices and deployment Other
Windows for business Windows Server User experience Other
Developer technologies Transact-SQL
SQL Server Other
{count} vote

3 answers

Sort by: Most helpful
  1. Tom Phillips 17,771 Reputation points
    2021-11-15T13:24:04.767+00:00
    1 person found this answer helpful.
    0 comments No comments

  2. Seeya Xi-MSFT 16,586 Reputation points
    2021-11-12T08:25:44.04+00:00

    Hi @siva reddy ,

    I am gave all permission to folder but is show again this error.

    First of all, here is Troubleshooter: Find errors with SQL Server transactional replication.
    Yes, this should be a permission issue.
    You'll need to verify permissions to the folder where your snapshot is stored(according to your error path), and make sure that the account used to run the Snapshot Agent has permissions to access the share.
    You can check the permissions of the file user again from the following steps:
    1.Right click shared folder and click properties
    2.Go to Advanced Sharing > Permissions In dialog "permissions for "
    3.Add snapshot user
    4.Grant "Full Control" All should be ok now, and to verify
    Finally, this is a troubleshoot with some screenshots and examples, which is similar to the previous Microsoft document, I hope this is useful to you.
    https://codingsight.com/troubleshooting-sql-server-transactional-replication-issues/

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Georg Matviak 181 Reputation points
    2021-11-12T14:05:34.597+00:00

    Hi there,

    When you configure the Microsoft SQL Server service to run under an account that does not have sufficient privileges on the SQL Server installation folder, SQL Server does not start, and it returns an error message, depending on how you try to start the service.

    You can try the resolution explained in this forum https://learn.microsoft.com/en-us/troubleshoot/sql/admin/event-id-7000-access-denied

    -------------

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.