Issue With Web Synchronization & Merge Replication Microsoft SQL Server / 2008 r2 - sql-server

I am extending our network by placing a xenserver box at a remote location to reduce outages for our web resources. All our servers are on xenserver, with MS Server 2008r2 and SQL Server 10. I must add I am a developer, not a sysadmin, so I have never done a db replication setup before.
I have successfully got one server working as publisher / distributor(SVR-DBDISTRIB) and another working as subscriber (SVR-DBREPLICA). They are happy to update each other with no faults. As one server has to go off site, I am planning to use web synchronization from one of our ms web servers (Server 2008r2 / IIS 7.5). I have added all the repl_merge, etc passwords, self-certified certificate, installed the SQL connectivity, etc features to the IIS box and I have got replisapi.dll working with certificates saved to trusted certificate root on the subscriber (so no certificate warnings come up when I call https://server.domain/SQLReplication/replisapi.dll). I have run the replisapi.dll?diag when logged in using the web servers admin password and everything is working. I can also log in with the IISSQLRepl password I have set up to hit the web server on basic authentication from the subscriber (again with no certificate issue). There are no proxies set up on the system.
When I create a new web synchronization publication on SVR-DBDISTRIB that works with non-web replication, the subscriber on SVR-DBREPLICA can communicate with the publisher as the subscription shows up in SVR-DBDISRIB. The agents at the distributor have no error messages but no table updates appear at the subscriber, although I do get the following (rather unhelpful) error message:
The system cannot find the file specified
Here is the job history:
Date 12/12/2013 18:42:28
Log Job History (SVR-DBDISTRIB-test-web-test-web-full-SVR-DBREPLICA-test-web- repl- 0)
Step ID 1
Server SVR-DBREPLICA
Job Name SVR-DBDISTRIB-test-web-test-web-full-SVR-DBREPLICA-test-web-repl- 0
Step Name Run agent.
Duration 00:00:01
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
2013-12-12 18:42:28.987 Copyright (c) 2008 Microsoft Corporation
2013-12-12 18:42:28.987 Microsoft SQL Server Replication Agent: replmerg
2013-12-12 18:42:28.987
2013-12-12 18:42:28.987 The timestamps prepended to the output lines are expressed in terms of UTC time.
2013-12-12 18:42:28.987 User-specified agent parameter values:
-Publisher SVR-DBDISTRIB
-PublisherDB test-web
-Publication test-web-full
-Subscriber SVR-DBREPLICA
-SubscriberDB test-web-repl
-SubscriptionType 1
-SubscriberSecurityMode 1
-Distributor SVR-DBDISTRIB
-XJOBID 0x03CFDF8BD2749449A5E4D81AF5270A97
-XJOBNAME SVR-DBDISTRIB-test-web-test-web-full-SVR-DBREPLICA-test-web-repl- 0
-XSTEPID 1
-XSUBSYSTEM Merge
-XSERVER SVR-DBREPLICA
-XCMDLINE 0
-XCancelEventHandle 0000000000000160
-XParentProcessHandle 000000000000064C
2013-12-12 18:42:29.022 Connecting to Subscriber 'SVR-DBREPLICA'
2013-12-12 18:42:29.127 Connecting to Subscriber 'SVR-DBREPLICA'
2013-12-12 18:42:29.206 The upload message to be sent to Publisher 'SVR-DBDISTRIB' is being generated
2013-12-12 18:42:29.210 The merge process is using Exchange ID '8E8BFAE7-B280-4016- AB07-517DC4961361' for this web synchronization session.
2013-12-12 18:42:29.240 **The system cannot find the file specified.**
2013-12-12 18:42:29.242 Category:NULL
Source: Merge Process
Number: -2147221502
Message: The system cannot find the file specified.
2013-12-12 18:42:29.244 Category:NULL
Source: Merge Process
Number: -2147199373
Message: The Merge Agent failed to connect to the Internet proxy server for user 'repl_merge' during Web synchronization. Ensure that the proxy server settings are correctly configured in Internet Explorer, or specify the -InternetProxyServer parameter when starting the Merge Agent.
2013-12-12 18:42:29.245 Category:NULL
Source: Merge Process(Web Sync Client)
Number: -2147024896
Message: The Merge Agent could not connect to the URL 'https://server.domain/SQLReplication/replisapi.dll' during Web synchronization. Please verify that the URL, Internet login credentials and proxy server settings are correct and that the Web server is reachable.
I understand that there is a 'verbose' setting and I am not sure if this is the verbose output. All the MS technet documentation talks about using SQL Enterprise Manager (discontinued from server 2000) to do this.
Any help or advice on where to look would be appreciated - this is the last job I need to finish before pushing it out the door and I have spend 2 days on this now...

if your networks are connected use network share instead of ftp or web sync. Much easier to maintain and you don;t need extra web server ;)

Related

Setting Up Multi-Server Administration---SQL Server Account

I am trying to set up Multi Server Administration so that I can easily update multiple instances of the same database across our network with ease. Where I am getting lost is how to set up the SQL SERVER AGENT service on the target machines.
Right now the SQL SERVER AGENT services on the machines are set to log on as NTSERVICE\SQL SERVER AGENT.
My SQL Server Agent process is set to log in as LocalSystem
My overall goal here is to figure out why I can't set any target servers from my machine, as I always run into the following error:
TITLE: Microsoft.SqlServer.Smo
------------------------------
MSX enlist failed for JobServer 'MYPC'.
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=15.0.18206.0+((SSMS_Rel).191029-2112)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=MSX+enlist+JobServer&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
The enlist operation failed (reason: SQLServerAgent Error: Unable to connect to MSX 'MYPC'.) (Microsoft SQL Server, Error: 22026)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=14.00.2027&EvtSrc=MSSQLServer&EvtID=22026&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
When looking at the log on my machine I see the following error when trying to enlist the target machine:
Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication.
I'm not clear on the service accounts you have configured. At one point you state that it uses NTSERVICE\SQL SERVER AGENT but then you state "set to log in as LocalSystem "
From the Docs page , When the SQL Server Agent service is run under the Local System account, master server-target server operations are supported only if both the master server and the target server reside on the same computer.
You mention that this is across a network, therefore you should be using Domain Accounts for your SQL Agent service
LocalSystem has far too many permissions to be a secure choice - especially with a MultiServer configuration where a single server compromise may open all your servers. Whenever a local or virtual account is used then the network communications occur as the Computer Domain Account - e.g. if my server was named s1 in the MyDomain then the computer account would be MyDomain\S1$
I recommend that you configure SQL Agent to use a dedicated domain account, following the guide for permissions here. Additionally, to use multiserver job processing, the SQL Server Agent service account must be a member of the msdb database role TargetServersRole on the master server. The Master Server Wizard automatically adds the service account to this role as part of the enlistment process.

SQL Replication 'The process could not connect to Distributor' between vps and laptop

I have 1 SQL server 2017 in London (VPS) and I connect with remote on port 1413 with 'sa' user , that work perfect. I config Distributor and Publisher successfully as shown as on server B :
And create subscriber on server A (my Laptop) as shown as bellow:
And subscriber created and started successfully but after 30 seconds show error 'The process could not connect to Distributor' as shown as :
Additional information:' (from User sa) refused because the job is already running from a request by User sa.
Changed database context to 'PUB4'. (.Net SqlClient Data Provider)'
This tutorial video solves my problem for best way login to distributor. And path snapshot folder must be path share folder with users, Like: \\DESKTOP-7Cxxx\myfolderForSnapshot else cant create snapshot file.

SSIS - the RPC server is unavailable

I've installed a instance of SQL Server and i select Integration Services in the setup wizard.
However, when I run SQL Server Management Studio as 'Administrator', I can see my instance under.
Database Engine
Analysis Services
Reporting Services
However, I can't see my instance under 'Integration Services'.
The service is running in Configuration Manager.
UPDATE 1
When trying to enter the server name manually it gives the following error:
the RPC server is unavailable
If you means this form:
For the first time you login you have to enter the integration services server name manually, Note that you don't have to enter the full instance name Server\Instance, you just need to enter the Server name.
Example:
If the machine name is MyPC and the SQL server instance is SQLDATA, then you should enter MyPC not MyPC\SQLDATA
UPDATE
the RPC server is unavailable
if you are sure that your account has sufficient privileges you can follow the links provided in the following MSDN answer.
The RPC Server is unavailable - Tried almost everything!
You may need to open port 135 (or whatever port SSIS is running under) in Windows Firewall on the server.
It would be good to specify the executable path (such as E:\Microsoft SQL Server\130\DTS\Binn\MsDtsSrvr.exe) as well as the specific network type that these connections should come from.

Login timeout Azure linked server

I want to query a supplier Azure SQL PDWH from our on-premises server (SQL 2014) to extract data from that Azure SQL PDWH and insert into a database that is located on the on-premises server. In the end this should automated via stored procedures that reside in the on-premises database and are scheduled.
To do so I have setup a linked server between the Azure SQL DWH and our on-premises server using the following scripts that I found here:
https://blogs.msdn.microsoft.com/sqlcat/2011/03/07/linked-servers-to-sql-azure/
/*
Create new linked server
*/
-- Make a link to the cloud
EXEC sp_addlinkedserver
#server=N'read_only_dwhs',
#srvproduct=N'Azure SQL Db',
#provider=N'SQLNCLI',
#datasrc=N'server.database.windows.net,1433',
#catalog='xxxxxx';
GO
--Set up login mapping
EXEC sp_addlinkedsrvlogin
#rmtsrvname = 'read_only_dwhs',
#useself = 'FALSE',
#locallogin=NULL,
#rmtuser = 'xxxxxx',
#rmtpassword = 'xxxxxx'
GO
These statements run without errors. However, when I execute the sp_testlinkedserver it returns a time-out error after about 10 seconds.
OLE DB provider "SQLNCLI11" for linked server "read_only_dwhs" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "read_only_dwhs" returned message "Unable to complete login process due to delay in prelogin response".
Msg 258, Level 16, State 1, Line 23
TCP Provider: Timeout error [258].
I checked with IT and they confirm that nothing is blocked by the firewall relating this and that TCP/IP is enabled. Our supplier also confirms that our IP is added to the Azure Firewall. I have no problem querying direct from the Azure SQL PDWH database via visual studio community 2015.
Also tools like these: http://sqlazuremw.codeplex.com/ give the same error on connecting.
I searched for hours, but whatever I do it keeps returning the same error message.
Any help is appreciated.
Update 2016 09 27:
After some more testing with IT it seems like this has to do with our firewall settings.
When I directly query via the database from the on-premises server (connected via remote desktop) to the Azure DWH I get no errors and everything works. I am than also able to query from my local machine, using the same on-premises database.
However, when another colleague logs on to the on-premises server I am not able anymore to query from my local machine (with the time-out errors above) until I login again to the (on-premises) server with my credentials.
I think that the firewall rule is too strict in only allowing information to be sent/received to the Azure DWH if my credentials are active on the on-premises server.
Update 2016 09 28:
The issue seems to be fixed for now. IT managed to apply the correct settings to the firewall. The server can now communicate with the Azure DWH even when colleagues are logged on to the server.
This might help some-one else.

Database Mirroring: Cannot set witness in Microsoft SQL Server 2014 using Azure

I am unable to connect to a witness server though Microsoft SQL Server 2014 for database mirroring. I am using Azure. Everything I have researched seems to point to this article https://support.microsoft.com/en-us/kb/940254 . But I cannot seem to get the DNS settings correct, or figure out how to set the host file, if that is even the fix.
I was mostly following this guide: https://msdn.microsoft.com/en-us/library/ms186384.aspx , for steps on setting up database mirroring.
Here is a brief summary of my scenario.
Principal Server
Cloud Service: MP
VM: MP (Windows Server 2012 R2 Datacenter)
Mirror and Witness Server
Cloud Service: MF
VM mirror: MF (Windows Server 2012 R2 Datacenter)
VM witness: MW (Windows Server 2012 R2 Datacenter)
I am getting this error when trying to run the SQL COMMAND:
ALTER DATABASE database SET WITNESS = 'TCP://MF.cloudapp.net:5023';
Msg 1456, Level 16, State 3, Line 1
The ALTER DATABASE command could not be sent to the remote server
instance 'TCP://MF.cloudapp.net:5023'. The database mirroring
configuration was not changed. Verify that the server is connected,
and try again.
I have opened specific ports on the firewall to allow connections and have set up Endpoints on the Azure portal. Any assistance you can provided will be very much appreciated.
In the meantime, I am going to try giving the witness server its own cloud service so the end points will all be the same (mentioned on this page: http://go4answers.webhost4life.com/Example/trouble-setting-witness-182317.aspx ). I also am going to try setting all 3 VMs on one cloud service then adding them to an availability set (mentioned on this page: https://cuteprogramming.wordpress.com/2014/10/16/database-mirroring-in-azure/ ).
Have you verified that there is bidirectional communication between the Database Mirroring replica and the Witness? Make sure that they can ping each other and that they are listening on their endpoints on both sides (check netstat). Make sure that the VMs are in the same VNET.
This happened to me twice and both times it was due to the SQL Server and agent service account. When I changed it to the Domain account I was able to add the witness in one shot.

Resources