Hi,
We have a SQL Server Merge Replication topology. Both Publisher a Subscribers are using SQL Server 2012.
As I have seen in http://msdn.microsoft.com/en-us/library/ms174360(v=sql.120).aspx
"Using sp_addscriptexec to
post a script file for publications using FTP for snapshot delivery is only supported for Microsoft SQL Server Subscribers."
So we should be OK...
The problem is that the Merge Agent is looking for the Script in the local PC instead of download it form theFTP Server.
Here is the Code at the publisher:
exec sp_addscriptexec 'IPoint_Pub','C:\IPoint_Files\ReplicationScripts\User\reIndex.sql'
This is how the subscription was created:
use IPoint
exec sp_addmergepullsubscription @publisher = @Central_Server_Name, @publication = N'IPoint_Pub', @publisher_db = @MGR_DB, @subscriber_type = N'Local', @subscription_priority = 0, @description = N'', @sync_type = N'Automatic'
exec sp_addmergepullsubscription_agent
@publisher = @Central_Server_Name,
@publisher_db = @MGR_DB,
@publication = N'IPoint_Pub',
@distributor = @Central_Server_Name,
@distributor_security_mode = 0, @distributor_login = 'XXX', @distributor_password = 'XXX',
@enabled_for_syncmgr = N'True',
@frequency_type = 4, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 1, @frequency_subday = 4, @frequency_subday_interval = 3, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 20100527, @active_end_date = 99991231,
@alt_snapshot_folder = N'', @working_directory = N'',
@use_ftp = N'True',
@job_login = null, @job_password = null,
@publisher_security_mode = 0, @publisher_login = 'XXX', @publisher_password = 'XXX',
@use_interactive_resolver = N'False', @dynamic_snapshot_location = null, @use_web_sync = 0,
@hostname =@SUCURSAL_ID
GO
And the log of the REPLMERG.EX
2014-03-29 13:01:49.009 Microsoft SQL Server Merge Agent 11.0.2100.60
2014-03-29 13:01:49.009 Copyright (c) 2008 Microsoft Corporation
2014-03-29 13:01:49.009
2014-03-29 13:01:49.009 The timestamps prepended to the output lines are expressed in terms of UTC time.
2014-03-29 13:01:49.009 User-specified agent parameter values:
-Publication Netul_Pub
-Publisher SRV01
-Subscriber NETUL-01\SQLEXPRESS
-Distributor SRV01
-PublisherDB IPoint_Netul
-SubscriberDB IPoint
-SubscriptionType 1
-ParallelUploadDownload 1
-DistributorLogin sucursal
-DistributorPassword **********
-DistributorSecurityMode 0
-PublisherLogin sucursal
-PublisherPassword **********
-PublisherSecurityMode 0
-SubscriberSecurityMode 1
-OutputVerboseLevel 1
-Validate 0
2014-03-29 13:01:49.019 Connecting to Subscriber 'NETUL-01\SQLEXPRESS'
2014-03-29 13:01:50.654 Connecting to Distributor 'SRV01'
2014-03-29 13:01:51.599 Initializing
2014-03-29 13:01:51.604 Validating publisher
2014-03-29 13:01:51.614 Connecting to Publisher 'SRV01'
2014-03-29 13:01:51.769 Retrieving publication information
2014-03-29 13:01:51.774 Retrieving subscription information.
2014-03-29 13:01:52.294 Connecting to Subscriber 'NETUL-01\SQLEXPRESS'
2014-03-29 13:01:52.304 Connecting to Distributor 'SRV01'
2014-03-29 13:01:52.414 Initializing
2014-03-29 13:01:52.429 Validating publisher
2014-03-29 13:01:52.439 Connecting to Publisher 'SRV01'
2014-03-29 13:01:52.604 Retrieving publication information
2014-03-29 13:01:52.619 Retrieving subscription information.
2014-03-29 13:01:53.274 [29%] [0 sec remaining] Snapshot files will be downloaded via ftp
2014-03-29 13:01:53.284 [29%] [0 sec remaining] Snapshot will be applied from a compressed cabinet file
2014-03-29 13:01:53.294 [29%] [0 sec remaining] Connecting to ftp site 'SRV01.real2b.com'
2014-03-29 13:01:55.019 [33%] [2 sec remaining] Extracting snapshot file 'Documento_Formc3f5d2f9_190.sch' from cabinet file
2014-03-29 13:01:55.064 [33%] [2 sec remaining] Extracted file 'Documento_Formc3f5d2f9_190.sch'
2014-03-29 13:01:57.299 [33%] [2 sec remaining] Applied script 'Documento_Formc3f5d2f9_190.sch'
2014-03-29 13:01:57.304 [33%] [2 sec remaining] Preparing table 'Documento_Formulario_Otros' for merge replication
2014-03-29 13:02:02.574 [51%] [8 sec remaining] Extracting snapshot file 'sysmergesubsetfilters_Documento_Formulario_Otros90.bcp' from cabinet file
2014-03-29 13:02:02.594 [51%] [8 sec remaining] Extracted file 'sysmergesubsetfilters_Documento_Formulario_Otros90.bcp'
2014-03-29 13:02:02.604 [55%] [7 sec remaining] Bulk copying data into table 'sysmergesubsetfilters'
2014-03-29 13:02:02.609 [55%] [7 sec remaining] Bulk copied data into table 'sysmergesubsetfilters' (0 rows)
2014-03-29 13:02:02.619 [55%] [7 sec remaining] Extracting snapshot file 'Documento_Formc3f5d2f9_190.dri' from cabinet file
2014-03-29 13:02:02.624 [55%] [7 sec remaining] Extracted file 'Documento_Formc3f5d2f9_190.dri'
2014-03-29 13:02:02.864 [55%] [7 sec remaining] Applied script 'Documento_Formc3f5d2f9_190.dri'
2014-03-29 13:02:02.874 [59%] [6 sec remaining] Extracting snapshot file 'Documento_Formc3f5d2f9_190.trg' from cabinet file
2014-03-29 13:02:02.884 [59%] [6 sec remaining] Extracted file 'Documento_Formc3f5d2f9_190.trg'
2014-03-29 13:02:02.889 [62%] [5 sec remaining] Applied script 'Documento_Formc3f5d2f9_190.trg'
2014-03-29 13:02:02.899 [62%] [5 sec remaining] Extracting snapshot file 'Documento_Formc3f5d2f9_190.prc' from cabinet file
2014-03-29 13:02:02.919 [62%] [5 sec remaining] Extracted file 'Documento_Formc3f5d2f9_190.prc'
2014-03-29 13:02:03.819 [62%] [5 sec remaining] Applied script 'Documento_Formc3f5d2f9_190.prc'
2014-03-29 13:02:09.334 [74%] [5 sec remaining] Launching sqlcmd to apply the script 'Create_Categorias_Tables.sql'
2014-03-29 13:02:09.974 [74%] [5 sec remaining] Applied script 'Create_Categorias_Tables.sql'
2014-03-29 13:02:09.979 [77%] [4 sec remaining] Launching sqlcmd to apply the script 'Create_Categorias_Tables.sql'
2014-03-29 13:02:10.144 [77%] [4 sec remaining] Applied script 'Create_Categorias_Tables.sql'
2014-03-29 13:02:10.174 [81%] [3 sec remaining] Launching sqlcmd to apply the script 'reIndex.sql'
2014-03-29 13:02:10.189 [81%] [3 sec remaining] Last 115 characters in 'sqlcmd' output buffer: Sqlcmd: 'C:\inetpub\ftproot\ReplData\ftp\SRV01_IPOINT_NETUL_NETUL_PUB\UserScripts\reIndex.sql': Invalid filename.
2014-03-29 13:02:10.194 [81%] [3 sec remaining] Failed to apply the script 'reIndex.sql' using the 'sqlcmd' utility.
2014-03-29 13:02:10.204 The schema script 'reIndex.sql' could not be propagated to the subscriber.
2014-03-29 13:02:10.254 Category:NULL
Source: Merge Replication Provider
Number: -2147201001
Message: The schema script 'reIndex.sql' could not be propagated to the subscriber.
2014-03-29 13:02:10.259 [100%] The process was successfully stopped.
2014-03-29 13:02:10.299 Category:NULL
Source: Merge Replication Provider
Number: -2147200963
Message: The process was successfully stopped.
As you can see, the FTP snapshot is working fine
"Extracted Documento_Formc3f5d2f9_190.trg"
But the it is looking for a file that only exists in the server.
'C:\inetpub\ftproot\ReplData\ftp\SRV01_IPOINT_NETUL_NETUL_PUB\UserScripts\reIndex.sql'
Do you have any idea?
Best Regards, Daniel.