Link to home
Start Free TrialLog in
Avatar of Roger Alcindor
Roger Alcindor

asked on

"Could not find the distributor or the distribution database for the local server"

I am unable to set up a publisher for merge replication on an SQLServer 2005 database.
I am using the replication wizard to add a publisher and get the following error message :-
"Could not find the distributor or the distribution database for the local server"
The distributor database is on the same server and is registered.
The server name is not NULL.
I have spent a long time on this problem but o no avail ?
Any suggestions please ?
Avatar of St3veMax
St3veMax
Flag of United Kingdom of Great Britain and Northern Ireland image

In SQL Server Management Studio, Right click on 'Replication' and select 'Configure Distributor'

HTH
Avatar of Roger Alcindor
Roger Alcindor

ASKER

There is no 'Configure Distributor' option, there is a 'Distributor Properties' however, is that what you mean ?
If so then I have already looked at the distrubutor properties and it shows the distributor database and I have already checked that area and set sa and password.

Any other suggestions
In that case, select 'Disable...' and repeat the setup. That should kick things into life.

HTH
I had already tried that and have tried it again but in both cases I get the following error messages:-

"SQL Server could not disable publishing and distribution on 'server name'

Additional Information :
An Exception Occurred while executing a Transact SQL statement or batch
[Microsoft.Sqlserver.ConnectioIinfo]

The distributor has not been installed correctly. Could not disable database for publishing.
Changed database context to 'master'. [Microsoft SQL server error 20029]
I have now uninstalled SQL server 2005 and re-installed it from scratch.
I still have the same problem.
I have been through the configure distributor opton from right-clicking on Replication and it completed without error indicating success.
I cannot however disable publishing an distribution and get the same error message as last mentioned.
Any ideas please ??
Give me a moment, gonna have a play on a testbox.
OK,

First off, try this:

EXEC sp_get_distributor - What does it come back with? If 'Distribution Server' is NULL, then create a new database called 'distribution' then run the below statement:

EXEC sp_adddistributiondb 'Distribution'

I'm guessing this will fail with the below message:

"Replication components are not installed on this server. Run SQL Server Setup again and select the option to install replication."

Run SQL Setup and try the suggested.

HTH
I have re-installed SQL Server again and checked that the replication option was selected
I have configured distribution with the default database name of distribution and success was indicated.

When I run exec sp_get-distributor I get the name of the server plus three fields indicating distribution db installed, is distribution publisher, has remote distribution publisher; values of 1,1 and 0 respectively.

when I run exec sp_adddistributiondb 'distribution' ,I get an error message asfollows:-
"Could not add the distribution database 'distribution'. This distribution database already exists.

I still get the same messages if I try to add a publication or disable publishing and distribution as described previously.

I am getting desperate ?
The 2nd error I would have expected given the distributor is setup.

Have you enabled the DB for replication?

exec sp_replicationdboption 'DBName','publish','true'


?
I ran exec sp_replicationdboption 'WQ01','publish','true' and got an error as follows:-

Msg 20028, Level 16, State 1, Procedure sp_MSpublishdb, Line 55
The Distributor has not been installed correctly. Could not enable database for publishing.
The replication option 'publish' of database 'WQ01' has been set to false.


Roger
ASKER CERTIFIED SOLUTION
Avatar of St3veMax
St3veMax
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SQL Server 2005 Standard Edition 9.00.3042.00
Windows N.T. 5.00.2195   (Windows 2000 server) SP4

Roger
I have resolved the problem!
I believe that the root cause was due to having imported a database from another server (attach to a copy of the MDF file) whereby the database had been published on another server.
I fixed the problem by using  exec sp_removedbreplication @dbname =  'databasename'
then adding a distributor and everything worked as expected except that the "Disable publishing and Distribution " doesn't work but I don't need to do that.
Thanks for you help,

Roger
Excellent. Glad you got this one resolved!