Resolving the following SQL Server Replication error is easy enough, and is general linked to access to replication folders on the Distributor file-system, from the Subscriber Agent account.
The full error message will look something like this:
The process could not read file ‘
When setting up replication, you are required to specify an account under which the Subscriber Agent will run, for example if you were using T-SQL to create a subscription, you will have to specify the following paramters:
@job_password = '[subscriber-agent-account-password]'
The error message indicates that the [subscriber-agent-account] used to create the subscription does not have access to shared folders required for that subscription.
Lets assume that you have a distributor machine called Dist1, which has a folder called D:\ReplData, this folder contains data used for replicating a publication, when you created the distributor, you specified this folder as a network location to use as a file share for the replication data, using either:
- Implicit File Share (not recommended): When you specify \\Dist1\$D\ReplData as the network location, this is implicit because you are traversing the file-system in order to reach the folder share, and the folder is not being explicitly shared.
- Explicit File Share (recommended): When you specify \\Dist1\ReplData, this is done by right-clicking on the folder in Windows Explorer, and selecting the “Share” option.
Implicit File Share Distribution Folder
In order to resolve the “Process could not read file due to OS Error 5″ error when using an implicit file share, you will have to give the subscriber agent account FULL administrative access to the file system (D: in our case), since the authentication need to be able to read the D:\ drive in order to reach the ReplData folder.
Explicit File Share Distribution Folder
In order to resolve the “Process could not read file due to OS Error 5″ error when using an explicit file share, you will have to give the subscriber agent account read access to the File Share location only. This security setting configuration can be done when setting up the folder as a Shared Folder.
Clearly the option with the least