Quantcast
Channel: SQL Archives - SQL Authority with Pinal Dave
Viewing all articles
Browse latest Browse all 594

SQL SERVER – FIX: Unable to Create Distribution Database on a UNC Share – Configure Distribution

$
0
0

Whenever we try to use Configure Distribution option in SSMS in a SQL Server instance which is configured on a UNC Path, the wizard will not allow us to configure the Distribution database and we will get the below error:

The paths to the distribution database folder and transaction log folder must refer to drives that are local to ‘SQLNODE1’. The paths must begin with a local drive letter and colon (for example, C:). Mapped drive letters or network paths are not valid.

SQL SERVER - FIX: Unable to Create Distribution Database on a UNC Share - Configure Distribution distdb-unc-01

Don’t be surprised. SQL Server instances can be configured on a UNC Share. Starting with SQL Server 2012, system databases and user databases can be installed with Server Message Block (SMB) file server as a storage option. This applies to both SQL Server stand-alone and SQL Server failover cluster installations. The only exception is Filestream which is not currently supported on an SMB file share.

In this scenario, when we are trying to configure Distribution database, the Configure Distribution wizard was not happy with the UNC shares provided and we got an error. I’m not sure if this is a supported model, but it looks like it should be supported as SQL Server is supporting all other system databases.

WORKAROUND/SOLUTION

I adopted the T-SQL method to get the Distribution Database successfully configured. Below are the steps I followed.

In the Configure Distribution wizard, provide an existing path, C:\Temp (or any other valid path)

SQL SERVER - FIX: Unable to Create Distribution Database on a UNC Share - Configure Distribution distdb-unc-02

Then in the Wizard Actions page, uncheck “Configure Distribution” and check “Generate a Script …”

SQL SERVER - FIX: Unable to Create Distribution Database on a UNC Share - Configure Distribution distdb-unc-03

Go ahead and finish the wizard. Then open the script which was saved. It will look like the one below (partial script)

use master
exec sp_adddistributor @distributor = N'SQLAuthorityServer', @password = N'aVerY$tr0nggP@ssw00rd'
GO
exec sp_adddistributiondb @database = N'distribution', @data_folder = N'C:\Temp', @log_folder = N'C:\Temp', @log_file_size = 2, @min_distretention = 0, @max_distretention = 72, @history_retention = 48, @security_mode = 1
GO

We need to change the values “C:\Temp” above to the UNC path where we need to get the Distribution Database configured. Now the script will look like,

use master
exec sp_adddistributor @distributor = N'SQLAuthorityServer', @password = N'aVerY$tr0nggP@ssw00rd'
GO
exec sp_adddistributiondb @database = N'distribution', @data_folder = N' \\dc\ShareOnDC', @log_folder = N' \\dc\ShareOnDC', @log_file_size = 2, @min_distretention = 0, @max_distretention = 72, @history_retention = 48, @security_mode = 1
GO

Note: Make sure this UNC Path has been given all the required permissions. Refer here

Once the values have been changes, please go ahead and run this script in a Query Analyzer window. After the script has executed, you will see the Distribution database created. You can also verify the Distribution database by running,

USE [distribution]
GO
SELECT name
,physical_name
FROM   sys.database_files

Here is the output which confirms the file location.

SQL SERVER - FIX: Unable to Create Distribution Database on a UNC Share - Configure Distribution distdb-unc-04

Hope this helps someone who wants to have such special requirement and configuration.

Reference: Pinal Dave (https://blog.sqlauthority.com)

First appeared on SQL SERVER – FIX: Unable to Create Distribution Database on a UNC Share – Configure Distribution


Viewing all articles
Browse latest Browse all 594

Trending Articles