Solved

Merge Replication initialization error

Posted on 2008-10-29
3
2,127 Views
Last Modified: 2008-12-01
I have 2 Different server using SQL Server 2005 with SP2 in the same domain using LAN.

I establish Merge Replication between the 2 servers on one table "MMS_PO".

Note: MMS_PO table have many child tables with a foreign Keys.

At point of initialization, I got the following Error Message:
"
Error messages:
The schema script 'MMS_PO_2.sch' could not be propagated to the subscriber. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)
Get help: http://help/MSSQL_REPL-2147201001
Could not drop object 'dbo.MMS_PO' because it is referenced by a FOREIGN KEY constraint. (Source: MSSQLServer, Error number: 3726)
Get help: http://help/3726
"

So I went to Publication properties, and I changed the Article properties in the Publication to be "Keep existing object unchanged"
Then I run the snapshot agent and mark the sunscriber for reinitialize.

I got another error :

"
Command attempted:
{call sp_MSsetconflicttable (N'EMP', N'MSmerge_conflict_REP_ABC_TEST_EMP', N'W-TIP-0302', N'ABC', N'REP_ABC_TEST')}

Error messages:
Incorrect syntax near 'EMP_NO'. (Source: MSSQLServer, Error number: 102)
Get help: http://help/102
The merge process was unable to deliver the snapshot to the Subscriber. If using Web synchronization, the merge process may have been unable to create or write to the message file. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to which to write. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)
Get help: http://help/MSSQL_REPL-2147201001
"

MMS_PO Table schema is as follows:

"
USE [WMMSDATA]
GO
/****** Object:  Table [dbo].[MMS_PO]    Script Date: 11/02/2008 14:44:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MMS_PO](
      [REFERENCE_ID] [varchar](20) NULL DEFAULT ('MMS'),
      [FINISH_PUB] [varchar](1) NULL DEFAULT ('N'),
      [PO_CODE] [varchar](50) NOT NULL,
      [PO_IND] [varchar](50) NULL,
      [PO_SUPPLIER] [varchar](50) NULL,
      [PO_FRDAGENT] [varchar](50) NULL,
      [PO_VENDOR] [varchar](50) NULL,
      [PO_EXPDELVDAT] [datetime] NULL,
      [PO_ORIGINOFSU] [varchar](50) NULL,
      [PO_CURRENCYS] [varchar](20) NULL,
      [PO_DESCRIPTIO] [varchar](50) NULL,
      [PO_EXPSTATUS] [varchar](1) NULL,
      [PO_POSTATUS] [varchar](1) NULL,
      [PO_POPREP] [varchar](1) NULL,
      [PO_POSTOREDEP] [varchar](50) NULL,
      [PO_CLSDATE] [datetime] NULL,
      [PO_CONFRMDATE] [datetime] NULL,
      [PO_APPROVEDCO] [varchar](50) NULL,
      [PO_FLAG] [varchar](1) NULL,
      [PO_POCLOSINGR] [varchar](50) NULL,
      [PO_PODATE] [datetime] NULL,
      [PO_CONFRMEDBY] [varchar](50) NULL,
      [PO_PEND] [varchar](50) NULL,
      [PO_LIQDAMDAYS] [int] NULL DEFAULT ((0)),
      [PO_LIQDAMDATE] [datetime] NULL,
      [PO_ACKNOLEGMENT] [varchar](100) NULL,
      [PO_ACKDATE] [datetime] NULL,
      [PO_COMMENT] [varchar](4000) NULL,
      [PO_QUOTE] [varchar](50) NULL,
      [PO_QUEDATE] [datetime] NULL,
      [PO_QUEENQUIRY] [varchar](50) NULL,
      [PO_CURRRATE] [float] NULL DEFAULT ((0)),
      [PO_ADVISEDBY] [varchar](50) NULL,
      [PO_ADVICEDATE] [datetime] NULL,
      [PO_LG] [varchar](50) NULL,
      [PO_LC] [varchar](50) NULL,
      [PO_LCREQDATE] [datetime] NULL,
      [PO_LGREQDATE] [datetime] NULL,
      [PO_REVISEDQUOTE] [varchar](1) NULL,
      [PO_LASTQUOTE] [varchar](1) NULL,
      [PO_BUYER] [varchar](50) NULL,
      [PO_INVOICED] [varchar](1) NULL,
      [PO_INVOICEDVAL] [float] NULL DEFAULT ((0)),
      [CLSDATE] [datetime] NULL,
      [PO_CLASS] [varchar](50) NULL,
      [PO_CLOSEREF] [varchar](50) NULL,
      [PO_CLOSETYPE] [varchar](50) NULL,
      [PO_REQINV] [varchar](1) NULL,
      [DELDATE] [datetime] NULL,
      [PO_AMDREF] [varchar](50) NULL,
      [PO_AMTTXT] [varchar](100) NULL,
      [PO_AMDCOUNT] [int] NULL DEFAULT ((0)),
      [ENTRYDATE] [datetime] NULL DEFAULT (getdate()),
      [PO_NEEDMRR] [varchar](1) NULL,
      [ENTRYBY] [varchar](50) NULL,
      [PO_COMPDATE] [datetime] NULL,
      [PO_LUMPSUM] [float] NULL DEFAULT ((0)),
      [PO_TYPE] [varchar](50) NULL,
      [PO_VNDACCOUNT] [varchar](50) NULL,
      [PO_NOOFITEMS] [int] NULL DEFAULT ((0)),
      [msrepl_tran_version] [uniqueidentifier] NOT NULL CONSTRAINT [MSrepl_tran_version_default_FC902993_ED1B_44A4_A0F1_5A092FC31448_725577623]  DEFAULT (newid()),
      [rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL CONSTRAINT [MSmerge_df_rowguid_810C9FEB043140098DADC4624A31860A]  DEFAULT (newsequentialid()),
PRIMARY KEY CLUSTERED
(
      [PO_CODE] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[MMS_PO]  WITH NOCHECK ADD  CONSTRAINT [FK_MMS_PO_PO_FRDAGENT] FOREIGN KEY([PO_FRDAGENT])
REFERENCES [dbo].[CMN_VENDOR] ([VENDOR_CODE])
ON UPDATE CASCADE
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[MMS_PO] CHECK CONSTRAINT [FK_MMS_PO_PO_FRDAGENT]
GO
ALTER TABLE [dbo].[MMS_PO]  WITH NOCHECK ADD  CONSTRAINT [FK_MMS_PO_PO_QUOTE] FOREIGN KEY([PO_QUOTE])
REFERENCES [dbo].[MMS_QUOTE] ([QUOTE_CODE])
ON UPDATE CASCADE
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[MMS_PO] CHECK CONSTRAINT [FK_MMS_PO_PO_QUOTE]
"
I don't know what to do, any one can help ?
0
Comment
Question by:aaomara
  • 2
3 Comments
 

Author Comment

by:aaomara
ID: 22865871
I succeeded to initialize to a new database, and every thing is OK.
Also I reinitialize many times after adding some data and every thing is OK.

So I thing the problem in dropping and creation of the database structure (actually in the Drop process).

I try to add Pre-Snapshot script to drop ALL Foreign Keys, but I got another error:
"
Error messages:
The schema script 'drop_FK_0.sql' could not be propagated to the subscriber. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)
Get help: http://help/MSSQL_REPL-2147201001
"
0
 

Accepted Solution

by:
aaomara earned 0 total points
ID: 23073448
I concentrate on the First error I face :
"
Error messages:
The schema script 'MMS_PO_2.sch' could not be propagated to the subscriber. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)
Get help: http://help/MSSQL_REPL-2147201001
Could not drop object 'dbo.MMS_PO' because it is referenced by a FOREIGN KEY constraint. (Source: MSSQLServer, Error number: 3726)
Get help: http://help/3726
"

So I generate a script to drop all foreign keys using "sp_fkys" then I generate another script to create it again.

So after I drop all the FK in the subscriber database, I succeeded to Initialize the subscriber and deliver the snapshot.

Finally I create all the FK's again and every thing is fine. :))
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now