Export (0) Print
Expand All

Step 1: Create the Databases and Enable Replication

SQL Server 2000

To set up bidirectional replication

  1. Create the two databases for your application: test1 and test2.

  2. Enable the server as a Publisher, Subscriber, and Distributor. If the server is already enabled as a Publisher, Subscriber, and Distributor, you can skip this step.

  3. Enable the databases for replication.
Examples
1. Create the test databases
CREATE database test1
CREATE database test2
2. Enable the server as a Publisher, Subscriber, and Distributor
EXEC master..sp_adddistributor @distributor = @@SERVERNAME
GO
EXEC master..sp_adddistributiondb @database= 'distribution'
GO
EXEC master..sp_adddistpublisher @publisher = @@SERVERNAME, @distribution_db = 'distribution', @working_directory = 'C:\Program Files\Microsoft SQL Server\MSSQL\REPLDATA' 
GO
EXEC master..sp_addsubscriber @subscriber = @@SERVERNAME, @type = 0, @security_mode = 1
GO
EXEC master..sp_changesubscriber_schedule @subscriber = @@SERVERNAME, @agent_type = 1, @active_end_date = 0
GO
3. Enable the databases for replication
USE master
GO
EXEC sp_replicationdboption N'test1', N'publish', true
GO
EXEC sp_replicationdboption N'test2', N'publish', true
GO
Show:
© 2014 Microsoft