Changing a Publisher's Distribution Database

If necessary you can change the distribution database used by a publication server. The technique you use to change the distribution database depends on whether or not you need to retain existing publications:

Except where otherwise noted, the following steps assume the use of SQL Enterprise Manager.

    To drop existing publications and change a publisher's distribution database
  1. Make a list of existing publications and subscriptions, so that they can later be re-created.

    Information on publications can be obtained using sp_helppublication and sp_helparticle. Information on subscriptions can be obtained using sp_helpsubscription.

  2. Make a list of existing subscription servers so that they can later be re-created.

    Information on subscription servers can be obtained using sp_helpserver and sp_helpsubscriberinfo.

  3. On the publication server, remove all published databases from the Publishing Databases list.

    With SQL Enterprise Manager, this list is accessed using the Replication Configuration/Publishing command from the Server menu.

    Note Removing a published database from the Publishing Databases list drops all of its publications, and all subscriptions associated with each publication.

  4. On the publication server, remove all subscription servers from the Enable Publishing to These Servers list.

    This list is also accessed using the Replication Configuration/Publishing command from the Server menu.

  5. On the publication server, run sp_serveroption to clear the distribution server setting. Type:

    sp_serveroption servername, 'dist', false

    If the publication server is configured as its own distributor, servername is the name of the local server. If the publication server is configured to use a remote distribution server, servername is the name of that remote distribution server.

  6. Disconnect from and then reconnect to the publication server.
  7. If the publication server was configured as its own distributor, drop the distribution database. However, if the publication server was configured to use a remote distribution server, skip this step.
  8. Install or select a distribution database.

    Select the publication server; from the Server menu, choose Replication Configuration; choose Install Publishing; and complete the Install Replication Publishing dialog box that appears.

  9. Continue with replication setup and completely configure replication.

If you need to retain existing publications, the procedure is slightly different. You do not remove published databases from the Publishing Databases list, which allows you to retain the server's publications.

    To retain existing publications and change a distribution database
  1. Make a list of existing publications and subscriptions.

    Information on publications can be obtained using sp_helppublication and sp_helparticle. Information on subscriptions can be obtained using sp_helpsubscription.

  2. Make a list of existing subscription servers.

    Information on subscription servers can be obtained using sp_helpserver and sp_helpsubscriberinfo.

  3. From all subscription servers of the publisher, drop all subscriptions to all publications of that publication server.
  4. On the publication server, remove all subscription servers from the Enable Publishing to These Servers list.

    With SQL Enterprise Manager, this list is accessed from the Replication Configuration/Publishing command from the Server menu.

    Important Do not clear the check boxes for published databases in the Publishing Databases list. If you do so, all publications for those databases will be dropped. If that occurs, to reestablish replication you will need to re-create all publications.

  5. On the publication server, run sp_serveroption to clear the distribution server setting. Type:

    sp_serveroption servername, 'dist', false

    If the publication server is configured as its own distributor, servername is the name of the local server. If the publication server is configured to use a remote distribution server, servername is the name of that remote distribution server.

  6. Disconnect from and then reconnect to the publication server.
  7. If the publication server was configured as its own distributor, drop the distribution database. However, if the publication server was configured to use a remote distribution server, skip this step.
  8. Install or select a distribution database.

    Select the publication server; from the Server menu, choose Replication Configuration; choose Install Publishing; and complete the Install Replication Publishing dialog box that appears.

  9. On the publication server, set the server publication options.

    In the Replication Publishing dialog box, add subscription servers to the Enable Publishing to These Servers list. For each subscriber, if it does not already exist, this adds a new entry in the sysservers table. The server status is set to "sub" (subscription server) and an associated entry for the server is placed in the MSsubscriber_info table of the distribution database. Finally, this creates a cleanup task for the server.

    If this dialog box does not appear after you install or select a distribution database, open it by selecting the server and choosing Replication Configuration/Publishing from the Server menu.

  10. On the distribution server, add a log reader task for each published database.

    To add a scheduled task, select the server from the Server Manager window; from the Tools menu, choose task scheduling; in the Task Scheduling dialog box, choose the New Task button; and complete the New Task dialog box that appears.

    For information about creating replication tasks, see Chapter 16, Scheduling Tasks.

  11. On the subscription servers, resubscribe to the publications and articles.

    The first subscription for each destination database will create a distribution task.