Quantcast
Channel: SQL Server Replication forum
Viewing all 4054 articles
Browse latest View live

SQL Server 2017. Implementing Replication on a Failover Cluster failed

$
0
0

Hello 

I am trying to implement a replication on a failover cluster but I am getting the following error when I tried to create the distribution database:

"Could not load file or assembly 'Microsoft.SqlServer.Replication.dll' or one of its dependencies. The specified module could not be found. (Microsoft.SqlServer.Rmo)"

Also I would like to hear from someone that had implementing a replication in a failover cluster in SQL Server 2017 or higher

Thanks in advance




SQL Server Cluster replication publication failing

$
0
0

Hi,

I am having trouble setting up replication from our SQL server cluster (2 clustered nodes) to another off site server. (all are SQL server 2019 Std) connecting to the cluster server name (SVR-SQLCL-01,1433\MSSQLSERVER) I have been following all the steps set out in the following documentation and setting it all up as my domain admin account

https://docs.microsoft.com/en-us/sql/relational-databases/replication/tutorial-preparing-the-server-for-replication?view=sql-server-ver15

https://docs.microsoft.com/en-us/sql/relational-databases/replication/tutorial-replicating-data-with-mobile-clients?view=sql-server-ver15

however when trying to start the agent I am getting errors, I have tried reducing the replication to one single table to see whether the error still occurs, which it does. the accounts for the replication (repl_snapshot etc) are domain accounts and have dbo mappings on the database. Have I missed something as I cant seem to find a fix to resolve this issue. Here are some of the error messages

This is from the Snapshot Agent History (An unspecified error had occured in the native SQL Server connection component)

Error messages:
Message: An unspecified error had occurred in the native SQL Server connection component.
Stack:    at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.ThrowNativeBcpOutException(CConnection* pNativeConnectionWrapper)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.ThrowConnectionFailureException(CConnection* pNativeConnectionWrapper)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.InitializeNativeBcpOutProvider(LogMessageCallback logMessageCallback, String strName, String strApplication, String strHost, String strServer, String strNetwork, Int32 encryptionLevel, String strDatabase, SecurityMode securityMode, String strLogin, SecureString strPassword, Int32 bcpBatchSize, Int32 loginTimeout, Int32 queryTimeout, Int32 packetSize, DeadlockPriority deadlockPriority, String strRowDelimiter, String strFieldDelimiter, Byte syncMethod, Boolean forceOdbcBcp, Boolean forceOleDbBcp, Boolean enableMultipleActiveResultSets, Boolean useReadPastHint, Boolean usePageLockHint, Boolean securePassword)
   at Microsoft.SqlServer.Replication.Snapshot.TransSnapshotProvider.InstantiateBcpOutProviderWorker(String strBcpConnectionName)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.InstantiateBcpOutProvider(String strBcpConnectionName)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServer.BcpOutThreadProvider.Initialize()
   at Microsoft.SqlServer.Replication.WorkerThread.NonExceptionBasedAgentThreadProc()
   at Microsoft.SqlServer.Replication.MainWorkerThread.AgentThreadProc()
   at Microsoft.SqlServer.Replication.AgentCore.BaseAgentThread.AgentThreadProcWrapper() (Source: MSSQL_REPL, Error number: MSSQL_REPL55012)

in the Job activity Monitor 

Date26/02/2020 08:20:36
LogJob History (SVR-SQLCL-01-Companion-CompanionTransMerge-2)

Step ID2
ServerSVR-SQLCL-01
Job NameSVR-SQLCL-01-Companion-CompanionTransMerge-2
Step NameRun agent.
Duration00:00:03
Sql Severity0
Sql Message ID0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted0

Message
2020-02-26 08:20:37.06 Microsoft (R) SQL Server Snapshot Agent
2020-02-26 08:20:37.06 [Assembly Version = 15.0.0.0, File Version = 15.0.2000.5]
2020-02-26 08:20:37.06 Copyright (c) 2016 Microsoft Corporation.
2020-02-26 08:20:37.06 The timestamps prepended to the output lines are expressed in terms of UTC time.
2020-02-26 08:20:37.06 User-specified agent parameter values:
2020-02-26 08:20:37.06 --------------------------------------
2020-02-26 08:20:37.06 -Publisher SVR-SQLCL-01
2020-02-26 08:20:37.06 -PublisherDB Companion
2020-02-26 08:20:37.06 -Publication CompanionTransMerge
2020-02-26 08:20:37.06 -Distributor SVR-SQLCL-01
2020-02-26 08:20:37.06 -DistributorSecurityMode 1
2020-02-26 08:20:37.06 -XJOBID 0x56C29F9FE0A370409ED23E81AB5354EA
2020-02-26 08:20:37.06 --------------------------------------
2020-02-26 08:20:37.06 Connecting to Distributor 'SVR-SQLCL-01'
2020-02-26 08:20:37.13 Parameter values obtained from agent profile:
2020-02-26 08:20:37.13 ---------------------------------------------
2020-02-26 08:20:37.13 -BcpBatchSize 100000
2020-02-26 08:20:37.13 -HistoryVerboseLevel 2
2020-02-26 08:20:37.13 -LoginTimeout 15
2020-02-26 08:20:37.13 -QueryTimeout 1800
2020-02-26 08:20:37.13 ---------------------------------------------
2020-02-26 08:20:37.13 Validating Publisher
2020-02-26 08:20:37.14 Connecting to Publisher 'SVR-SQLCL-01'
2020-02-26 08:20:37.14 Publisher database compatibility level is set to 100.
2020-02-26 08:20:37.14 Retrieving publication and article information from the publisher database 'SVR-SQLCL-01.Companion'
2020-02-26 08:20:37.19 [0%] Activated articles for publication 'CompanionTransMerge' at the publisher.
2020-02-26 08:20:37.19 [0%] The replication agent had encountered an exception.
2020-02-26 08:20:37.19 Source: Replication
2020-02-26 08:20:37.19 Exception Type: Microsoft.SqlServer.Replication.ReplicationAgentException
2020-02-26 08:20:37.19 Exception Message: An unspecified error had occurred in the native SQL Server connection component.
2020-02-26 08:20:37.19 Message Code: 55012
2020-02-26 08:20:37.19

any further detail required, please let me know



Trying to DELETE Publisher, Dropping Subscription Taking A Long Time

$
0
0
USE Published_DB;
EXEC sp_dropsubscription @publication = N'Published_DB_Publication',
@subscriber = N'all',
@destination_db = N'Published_DB',
@article = N'all';

I have a fairly large DB. It is replicating approx 7000 articles. When I run the script above, it's taking a long time (now 1 Hr+). Any ideas what I need to check here?

Adding, I have all REPL jobs disabled and I basically want to remove the DBs being published.


TIA

 


SQL Server 2019 snapshot agent error

$
0
0

Hello,

I was trying to configure an SQL Server 2019 transactional replication, but the snapshot agent returns the following error:

Error messages:
Message: An unspecified error had occurred in the native SQL Server connection component.
Stack:    at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.ThrowNativeBcpOutException(CConnection* pNativeConnectionWrapper)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.ThrowConnectionFailureException(CConnection* pNativeConnectionWrapper)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.InitializeNativeBcpOutProvider(LogMessageCallback logMessageCallback, String strName, String strApplication, String strHost, String strServer, String strNetwork, Int32 encryptionLevel, String strDatabase, SecurityMode securityMode, String strLogin, SecureString strPassword, Int32 bcpBatchSize, Int32 loginTimeout, Int32 queryTimeout, Int32 packetSize, DeadlockPriority deadlockPriority, String strRowDelimiter, String strFieldDelimiter, Byte syncMethod, Boolean forceOdbcBcp, Boolean forceOleDbBcp, Boolean enableMultipleActiveResultSets, Boolean useReadPastHint, Boolean usePageLockHint, Boolean securePassword)
   at Microsoft.SqlServer.Replication.Snapshot.TransSnapshotProvider.InstantiateBcpOutProviderWorker(String strBcpConnectionName)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.InstantiateBcpOutProvider(String strBcpConnectionName)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServer.BcpOutThreadProvider.Initialize()
   at Microsoft.SqlServer.Replication.WorkerThread.NonExceptionBasedAgentThreadProc()
   at Microsoft.SqlServer.Replication.AgentCore.BaseAgentThread.AgentThreadProcWrapper() (Source: MSSQL_REPL, Error number: MSSQL_REPL55012)
Get help: http://help/MSSQL_REPL55012

Any idea why?

Best regards,

José Cruz

SQL Server 2017 SQL Agent Crash when using Replication - KERNELBASE.dll

$
0
0

We are having a issue with SQL Agent 2017 crashing every 40-60 minutes with a KernelBase.dll failure.  It only happens when we are using Replication.  If we remove replication there are no issues.

1) We are running on the most recent CU for SQL 2017

2) All windows updates have been applied.

3) SFC /scannow comes back clean.

4) DSIM /online /cleanup-image /restorehealth comes back clean.

I am trying not to have to reinstall the server from scratch.  This is affecting 5 of our servers.  The good news is the agent recovers quickly.  There are no errors recorded in sql agent log, no errors recorded in replication except connectivity issues. Any help would be appreciated.

-EventData
SQLAGENT.EXE
2017.140.3281.6
5e2a7934
KERNELBASE.dll
10.0.14393.3383
5ddcba29
e06d7363
0000000000034c48
1930
01d5ee3a8e61dd38
C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Binn\SQLAGENT.EXE
C:\Windows\System32\KERNELBASE.dll
f420d3bb-8807-49de-9c7d-f915ee7195dd
-EventData
0
APPCRASH
Not available
0
SQLAGENT.EXE
2017.140.3281.6
5e2a7934
KERNELBASE.dll
10.0.14393.3383
5ddcba29
e06d7363
0000000000034c48
\\?\C:\Users\svc_sql_PhoenixDevDB\AppData\Local\Temp\WERD4B6.tmp.appcompat.txt \\?\C:\Users\svc_sql_PhoenixDevDB\AppData\Local\Temp\WERD64E.tmp.WERInternalMetadata.xml \\?\C:\Users\svc_sql_PhoenixDevDB\AppData\Local\Temp\WERD65E.tmp.WERDataCollectionFailure.txt
C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_SQLAGENT.EXE_e55bd6dc14e54b61637f1a912fa98d5a3814def_41a5fa9c_cab_13a5d65b
0
f420d3bb-8807-49de-9c7d-f915ee7195dd
4

Msg 14004 $s must be in the current database - but it is

$
0
0

Hi, I'm using sp_addarticle to help manage table replication.  This works very nicely - for most tables.  For some, it inexplicably (to me at least!) fails with a Msg 14004 error.

   Msg 14004, Level 16, State 1, Procedure sp_MSrepl_addarticle, Line 290

   <table name> must be in the current database.

I can run the same code for tables alphabetically before or after those that fail.  The same tables always have the same result, either the article is added or it doesn't. For example, it works for NAV table 'Purch. Cr. Memo Hdr.' and 'Posted Document Dimension' but not for 'Purch. Cr. Memo Line', 'Purch. Inv. Header' or 'Purch. Inv. Line'.

Note: This is NAV multi-company.  The results are the same for all companies - i.e. adding an article for table Purch. Cr. Memo Line fails for each of the companies in the database. Adding an article for Purch. Cr. Memo Hdr. works for exah of the companies!

Can anyone shed any light on this?

The alternative is to use the GUI which is painfully slow due to the large number of items displayed in the Objects to Publish panel.


Replication starts over and over after loading data

$
0
0

I have transactional replication running on SQL Server 2012. The publisher is on SQL Server 2012 Enterprise and the Subscriber is on SQL Server 2012 Standard. When I create the subscriber it loads all the data 244,000,000 rows and then starts over again at 0 and reloads all the data.

Why is it starting over again?

CDC capture job running for long time with waittype 'WAITFOR'. n the background it's running the stored procedure 'sp_MScdc_capture_job Any idea why this is happening.

$
0
0

CDC capture job running for long time with waittype 'WAITFOR'. n the background it's running the stored procedure 'sp_MScdc_capture_job Any idea why this is happening.




Replication not creating Insert sproc correctly.

$
0
0

Greetings. 

We replicate a 2.5 TB database to 6 replication servers. Over the weekend we purged about 1 TB of data. For long winded reasons, we set all of our tables to not replicate Inserts, Updates, and Deletes by doing the following on all tables once the apps were brought offline:

exec sp_changearticle 'myPub', 'FaStudentPell', 'ins_cmd', 'none'

exec sp_changearticle 'myPub', 'FaStudentPell', 'upd_cmd', 'none'

exec sp_changearticle 'myPub', 'FaStudentPell', 'del_cmd', 'none'

Then at the end of the weekend, before the apps were brought back up, I re-enabled:

exec sp_changearticle 'myPub', 'FaStudentPell', 'ins_cmd', 'CALL [sp_MSins_dboFaStudentPell]'

exec sp_changearticle 'myPub', 'FaStudentPell', 'upd_cmd', 'SCALL [sp_MSupd_dboFaStudentPell]'

exec sp_changearticle 'myPub', 'FaStudentPell', 'del_cmd', 'CALL [sp_MSdel_dboFaStudentPell]'

So today I wanted to rebuild two of the six replication servers. Due to the size of this guy we initialize w the backup/ restore method as opposed to a snapshot. To be clear, the DB's on two of the six servers were recreated today w backups from the OLTP environments. Anyways, I go through our well documented steps for recreating this stuff. Now here's where it gets weird -- about an hour after being rebuilt I get the following message on two of the severs:

Cannot insert the value NULL into column 'IsFallenHeroesEligible', table 'c2000.dbo.FaStudentPell'; column does not allow nulls. INSERT fails. (Source: MSSQLServer, Error number: 515) Get help: http://help/515

 Obviously this is bizarre since the DB was created with a backup from OLTP, where this column does not allow NULL's. Note that this message is only happening on the two instances I rebuilt today, not the other 4 instances. Also note those other 4 instance do NOT contain this column. Replication was set up before this column was added, and we don't replicate schema changes. 

From doing some digging I see that the replication sproc (sp_MSins_dboFaStudentPell) doesn't attempt to insert in to this column on these two servers, it's acting like the other 4 instances that do NOT contain this column. I suspect it has something to do with the sync object views that run behind the scenes, but I've already been down the rabbit hole on this thing and need to stop. 

If these DB's were created from OLTP backups, why isn't the sproc for them correct? This is pretty deep in the weeds I know, but at this point I'd like to better understand.

Thanks!


Thanks in advance! ChrisRDBA


AlwaysOn Primary Showing as Question Mark

$
0
0

If I look in the dashboard for my AlwaysOn implementation I can see my groups are synchronised and no data loss. They also failover successfully but when looking in the Group folder list under replicas on the secondary, the primary node is showing as having a question mark next to it.

Is it normal?

Getting list of subscriptions

$
0
0

We have one central HQ Server and Five (or 500) satellite servers.

Satellite Servers are Publishers and the HQ Server Subscribed to all five or 500 of them - transactional replication into HQ

How can I get the list of Satellite Publishers by querying the "Subscribed to" on the HQ Server.

ie. Give me a list of Servers that that are feeding the HQ Server via replication.


Travis McGee

Capturing Replication Article Settings - after the fact

$
0
0

Fellow SQLers

Walked into a situation where a UAT SQL instance needs to have a db replicated - to the same box.

The same scenario and same db is setup like this on a prod box.

I cannot script out the prod pub and sub objects and apply them to uat box because some tables may not be in uat.

I am rebuilding from scratch. Thus, i am trying to find out what settings were used in prod when the replication WAS initially created. For example, did it include constraints etc etc etc. I know indexes where created but not sure of the other items.

I cannot see that information when I script out the pub object. Is there a way to find what WAS used?

Thanks

MG

Where\what process is deleting the transaction replication snapshot files

$
0
0
Greetings having an issue with the snapshot files being deleted quickly, seems that they are being removed from the snapshot folder quickly and trying to determine what process does that? I thought it was the distribution clean up agent job? I checked the settings and they appear to be the same in the environment I am losing them in, as in other environments where they are not removed as quickly. Thanks

Quick query help

$
0
0

 Hi All,

 Need a quick query help. From sysaltfiles , I want to extract the characters excluding the actual filenames(i..e mdf and ldf)

 For example :
 select filename from master..sysaltfiles


C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA\master.mdf
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA\mastlog.ldf
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA\tempdb.mdf
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA\templog.ldf
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA\model.mdf
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA\modellog.ldf
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA\MSDBData.mdf
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA\MSDBLog.ldf


--expected output

C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA
C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\DATA

Thanks,
Sam

Questions on TDE ?

$
0
0

Hi All,

I have some questions related to SQL 2008 EE feature Transparent Data encryption (TDE).
While implementing TDE we create a certificate in master database as follows and immediately take the backup of it.

use master
go
CREATE CERTIFICATE TDECert WITH SUBJECT = 'Test TDE Certificate'
go

Question 1)

By default expiry date of the certificate is 1 year.Now let’s say, my certificate is expired, then what happens?
Even further, since certificate is expired, if I say, ALTER DATABASE <DBname> SET ENCRYPTION OFF; will I get back my original plaintext or my data is LOST? For certificate expiry date what are the measures to be taken care ? Usually, what value is set for expiry_Date?


Question 2) For some reason, If I lost my certificate or it got corrupted , how can i get my original data ?
Will ALTER DATABASE <DBname> SET ENCRYPTION OFF; would help in any way or no use?

Question 3) if the database is already in AG. let's say db1, now I implemented TDE on primary , before enabling the TDE on primary, do i need to remove that database from AG?,
then implement TDE and then add it back to AG?

Thanks,

Sam


Orphaned Foreign Key records in Child table Merge Replication

$
0
0

We have merge Replication setup between 2 datacenters US USQ & Europe. EUC. 
USQ is the publisher while EUC is subscriber. The merge agent runs every 10 min. 

All our Fkeys are set to NOT FOR REPLICATION.

We have a situation where parent record in USQ (publisher) gets deleted while the child records in EUC(subscriber) are created during the same replication cycle. 

The master record in USQ is propagated and the record is deleted from both publisher & subscriber. 

Since the Fkeys are set to NOT FOR REPLICATION, the child records created in subscriber are sent to publisher without generating any errors or conflicts. As a result I have orphaned records in both Publisher & Subscriber. 

Everything works by design, I am checking to see if this behavior can be corrected by the processes somehow?



Large Scale High Availability Testing

$
0
0
At a high level, we are trying to set up a testing environment that features multiple SQL servers in a High Availability group. The issue in testing is that we want to be able to ensure the integrity of the data, which can scale up to TB’s of data. I would like to be able to revert to a known state, but performing backups and restores are very expensive tasks that can take hours to accomplish. My question is if you have any recommendations for quickly cloning/restoring SQL server in a high availability group.

How can I move the distribution database to a new server?

$
0
0

I need to migrate an old distribution database to a new VM. My understanding is that you can detach/attach the distribution DB to make this easier. What are the 'gotchas' in this process? Do I need the detach/attach the system databases as well? The distributor is facilitating data from Oracle to SQL Server.

Another question.. what are some good benchmarks for figuring out how much horsepower I should have set up in my VM that running distribution?

Thanks,

phil

Collation issue while setuping transactional replication

$
0
0

Hello,

I am facing a collation issue on one of the Staging environment server which is been used by 20 around developers.

It has handed over to me so I can setup the transactional replication on it. 

I tried creating local publication and got the below error



I tried searching online but didn't get exact solution to react on it.

When I run below 

SET NOCOUNT ON
GO
SELECT SERVERPROPERTY('collation') SQLServerCollation
,DATABASEPROPERTYEX('master', 'Collation') AS MasterDBCollation
GO

I got

SQLServerCollation        MasterDBCollation
Latin1_General_CI_ASSQL_Latin1_General_CP1_CI_AI

I have only understood that the collation is different at server level and might be changed by someone.

Could someone put more light on the issue and help me out please?

Appreciate the help in advance

 


Dilip Patil..

Issue while adding subscriber for a oracle publisher on SQL server 2017

$
0
0

Hi All,

I am encountering this issue while trying to adding subscriber for a oracle publisher on SQL server 2017,I am able to perform the same step on SQL server 2014.

Msg 14071, Level 16, State 1, Procedure distribution.sys.sp_MSrepl_addsubscription, Line 191 [Batch Start Line 1295]
Could not find the Distributor or the distribution database for the local server. The Distributor may not be installed, or the local server may not be configured as a Publisher at the Distributor.
Msg 20021, Level 16, State 1, Procedure distribution.sys.sp_MSrepl_addpushsubscription_agent, Line 258 [Batch Start Line 1295]
The subscription could not be found.

Below is the command which i am using to add subscriber

use [distribution]
exec sp_addsubscription @publication = N'MPI_PUB', @subscriber = N'ServerName', @destination_db = N'Dest_db', @publisher = N'Oracle_publisher', @subscription_type = N'Push', @sync_type = N'automatic', @article = N'ALL', @update_mode = N'read only', @subscriber_type = 0

Can you please help me out,

Thanks,


Viewing all 4054 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>