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

Replication doesn't work after installed SQL 2012 SP3 to SQL 2005

0
0

Hi Sir/Madam,

I installed SQL 2012 SP3(Enterprise Edition,Microsoft SQL Server 2012 (SP3) (KB3072779) - 11.0.6020.0 (X64) ) in a prodcution database server, in which we are using transactional replications to

1). SQL 2012 database server , it works fine;

2). SQL 2005 database server(Standard Edition, Microsoft SQL Server 2005 - 9.00.4340.00 (X64) ), it doesn't work;

The error message is,

Message: declare @event_type SMALLINT = 0, @distributor_major_version SMALLINT = 11, @distributor_minor_version SMALLINT = 0, @distributor_build_number SMALLINT = 6020 if object_id(N'sys.sp_repl_generate_subscriber_event') is not null
exec sys.sp_repl_generate_subscriber_event @event_state = @event_type, @distributor_major_version = @distributor_major_version, @distributor_minor_version = @distributor_minor_version, @distributor_build_number = @distributor_build_number
2016-01-22 19:22:02.180 Category:NULL
Source:  Microsoft SQL Server Native Client 11.0
Number:  139
Message: Cannot assign a default value to a local variable.
2016-01-22 19:22:02.180 Category:NULL
Source:  Microsoft SQL Server Native Client 11.0
Number:  137
Message: Must declare the scalar variable "@event_type".

I couldn't found any solution to fix it.

Please advise,

Thanks,


Snapshot agent Failing on a weird message

0
0

 Hi, We recently upgraded our Distributor\Subscriber servers to SQL 2016 and the publisher is on SQL 2014. I tried to run the snapshot agent this morning but it failed with the below error message. the Trannsactional publication is mix of Tables\UserDefined Functions. The snapshot agent works if I remove the UDF. but for some reason its not taking the UDFs. Appreciate any help on this! Thanks!

FYI, We don't have any natively compiled objects on the database

Error messages:
Source: Microsoft.SqlServer.Smo
Target Site: System.Collections.Generic.IEnumerable`1[System.String] ScriptWithList(Microsoft.SqlServer.Management.Smo.DependencyCollection, Microsoft.SqlServer.Management.Smo.SqlSmoObject[], Boolean)
Message: Script failed for UserDefinedFunction 'dbo.udffnData'. 
Stack:    at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects, Boolean discoveryRequired)
   at Microsoft.SqlServer.Management.Smo.Scripter.EnumScriptWithList(SqlSmoObject[] objects)
   at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(SqlSmoObject[] objects)
   at Microsoft.SqlServer.Replication.Snapshot.ArticleDependenciesAnalyzer.BaseDependencyNode.CreateMirrorCopy(String mirrorCopyName)
   at Microsoft.SqlServer.Replication.Snapshot.ArticleDependenciesAnalyzer.BaseDependencyNode.FetchBaseDependenciesWithMirrorCopyTransaction(SqlConnection connection)
   at Microsoft.SqlServer.Replication.RetryableSqlServerTransactionManager.ExecuteTransaction(Boolean bLeaveTransactionOpen)
   at Microsoft.SqlServer.Replication.Snapshot.ArticleDependenciesAnalyzer.BaseDependencyNode.FetchBaseDependenciesWithMirrorCopy()
   at Microsoft.SqlServer.Replication.Snapshot.ArticleDependenciesAnalyzer.FunctionDependencyNode.get_BaseDependencies()
   at Microsoft.SqlServer.Replication.Snapshot.ArticleDependenciesAnalyzer.BaseDependencyNode.GetEnumerator()
   at Microsoft.SqlServer.Replication.Snapshot.ArticleDependenciesAnalyzer.DepthFirstSearchVisit(IDependencyNode dependencyNode)
   at Microsoft.SqlServer.Replication.Snapshot.ArticleDependenciesAnalyzer.DepthFirstSearchVisit(IDependencyNode dependencyNode)
   at Microsoft.SqlServer.Replication.Snapshot.ArticleDependenciesAnalyzer.PerformArticleDependenciesAnalysis()
   at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.DoReplicationDependenciesAnalysis(Scripter scripter, SqlSmoObject[] smoObjectArray, IDictionary urnKeyArticleLookupTable)
   at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.DoScripting()
   at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.DoScripting()
   at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
   at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
   at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: Microsoft.SqlServer.Smo, Error number: 0)
Get help: http://help/0
Source: Microsoft.SqlServer.Smo
Target Site: Int32 PropertyNameToIDLookupWithException(System.String, Microsoft.SqlServer.Management.Smo.PropertyAccessPurpose)
Message: Cannot access property IsNativelyCompiled.This property is not available on SQL Server 2014.
Stack:    at Microsoft.SqlServer.Management.Smo.SqlPropertyMetadataProvider.PropertyNameToIDLookupWithException(String propertyName, PropertyAccessPurpose pap)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetPropertyOptional(String propName)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetPropValueOptional[T](String propName, T defaultValue)
   at Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase.AppendWithOption(StringBuilder sb, String propName, String optionText, Boolean& needsComma)
   at Microsoft.SqlServer.Management.Smo.UserDefinedFunction.ScriptUDF(StringCollection queries, ScriptingPreferences sp, Boolean bForCreate)
   at Microsoft.SqlServer.Management.Smo.UserDefinedFunction.ScriptCreate(StringCollection queries, ScriptingPreferences sp)
   at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptCreateInternal(StringCollection query, ScriptingPreferences sp, Boolean skipPropagateScript)
   at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreateObject(Urn urn, ScriptingPreferences sp, ObjectScriptingType& scriptType)
   at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreate(Urn urn, ScriptingPreferences sp, ObjectScriptingType& scriptType)
   at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreateObjects(IEnumerable`1 urns)
   at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptUrns(List`1 orderedUrns)
   at Microsoft.SqlServer.Management.Smo.ScriptMaker.DiscoverOrderScript(IEnumerable`1 urns)
   at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptWorker(List`1 urns, ISmoScriptWriter writer)
   at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithListWorker(DependencyCollection depList, SqlSmoObject[] objects, Boolean discoveryRequired)
   at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection depList, SqlSmoObject[] objects, Boolean discoveryRequired) (Source: Microsoft.SqlServer.Smo, Error number: 0)
Get help: http://help/0


Replication Queries for Status and Information

0
0
I have been working on several programs. I want one to report on the current number of replication records in process by publication. I am creating another report on the details of replication. My thought was, 'if I create this on the distribution server, I should be able to get all the comprehensive information I need."

There are so many tables available on the publisher and the distributor, it is kind of rediculous trying to build this without a solid Msft doc that says: Here is how to properly create this kind of query. 

Here is my question: Is there any problem using the catalog tables on the distributor? 

Q2: Is there any reason why I might want to create the second report on the publisher rather than the distribution server? 

Q3: Is this the best source for information on the entire description of a replicated table? Here is my FROM clause. 


FROM [dbo].[MSsubscriptions] s 
, [dbo].[MSpublications] p 
, [master].[dbo].[sysservers] masys 
, [master].[dbo].[sysservers] masys2 
, [dbo].[MSarticles] MSart
, [dbo].[MSdistribution_agents] MSdist 

Q4: Is sp_replmonitorsubscriptionpendingcmds considered the standard in terms of monitoring current transactions in processing? 

Thanks in advance for your feedback. Replication geeks! Where are you?
 

snapshot agent having the error message : The specified network name is no longer available

0
0

hi folks:

 Our snapshot replication is on a cluster server. Recently, I start to see errors from snapshot agent

Error message below:

Error messages:

Message: The specified network name is no longer available.
Stack:    at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.ThrowNativeBcpOutException(CConnection* pNativeConnectionWrapper)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.BcpOut(String strBcpObjectName, String strBcpObjectOwner, String strBaseBcpObjectName, Boolean fUnicodeConversion, String strDataFile, String strLoadOrderingHint, String strWhereClause, Boolean useTableLockHint, Int32 bcpFileFormatVersion)
   at Microsoft.SqlServer.Replication.Snapshot.SqlServer.BcpOutThreadProvider.DoWork(WorkItem workItem)
   at Microsoft.SqlServer.Replication.WorkerThread.NonExceptionBasedAgentThreadProc()
   at Microsoft.SqlServer.Replication.AgentCore.BaseAgentThread.AgentThreadProcWrapper() (Source: MSSQLServer, Error number: 0)
Get help: http://help/0

Does that mean the drive snapshot files sits on has some issue? how to confirm it? 

 Thanks

 Hui


--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

Remove Article Without Reinitialization

0
0

Is there any way to remove an article from transactional Replication without a reinitialization?

How do you calculate the space required for snapshot ?

0
0
Hi,

I do see something weird in transnational replication snapshot - Can you plz help me in finding the root cause ?

When I created the initial snapshot for one big table with 350GB data and 250GB index size (shouldn't be but...) on SQL Server 2012 (SP1), snapshot folder size was 900 GB. For some reasons, I had to scrap everything and re set up the replication. At this moment Snapshot folder size has crossed 1.7 TB and not even 50% of the records has been processed, I am running out of clue for this. There has not been significant changes in number of records and table size since last snapshot.

Appreciate your insight !

SQL Server Merge Replication Issues

0
0

Dear All,

I am having two SQL Server instances(WinCC) on two different Machines - HMI1 & HMI2.

I have few tables(Table01 to Table09) in database WinCCDB on both Servers. I want to establish the Merge replication between these two servers. I have tries to do the same using some videos shown on YOUTUBE. I am getting some problems at some intermediate stage. It is asking to enable ASCII PADDING, but it is already enabled. I am not able to identify the exact issue. Please Help!!! Thanks in Advance..

Regards.

AbhishekAJ

Datababase is appearing as a system database

0
0
Hi!

I´m working with Sqlserver 2012 SE and Windows 2008 R2

Recently I´ve trying to set a transacctional replication by setting the distribuitor in another server.

For any reason, the replication never worked, and then I decided to erase all the publicatión for then to start again from the beginning.

Then I noticed that my database now has become as a system database and it is placed with the other system databases (master, tempdb, model, msdb) in the Management Studio.

I researched about it  and I think that it is because database has been marked as distributor.

The query:
select is_distributor from sys.databases where database_id=6

is returning 1

Is the only database that have this value.

Then I begin again to investigate how to fix this and I note on a recurrent basis that I must use the following procedures, with the result that I will show:


EXEC sp_removedbreplication @dbname = N'My_DBname';

* This run correctly



EXEC sp_dropdistributiondb    @database = N'My_DBname';

*Msg 21122, Level 16, State 1, Procedure sp_dropdistributiondb, Line 124
Cannot drop the distribution database 'My_DBname' because it is currently in use.
*then I run SELECT spid FROM sys.sysprocesses WHERE dbid = db_id('distribution') and I kill the active sessions, but the result is the same



EXEC sp_dropdistpublisher @publisher = @@SERVERNAME;

*Msg 14080, Level 11, State 1, Procedure sp_dropdistpublisher, Line 120
The remote server "My_ServerName" does not exist, or has not been designated as a valid Publisher, or you may not have permission to see available Publishers.



EXEC sp_dropdistributor    @no_checks = 1

*Msg 21122, Level 16, State 1, Procedure sp_dropdistributiondb, Line 124
Cannot drop the distribution database 'My_DBname' because it is currently in use.


Basically, I have obtained these indications at this URL:
https://technet.microsoft.com/en-us/library/ms147921%28v=sql.105%29.aspx

In short, I find no way to return the database to its original state. I suspect that there may be some kind of corruption that is preventing.

Of course, any clarification or suggestion will be well received by me.

And finally, let me to my two questions:

Firstly... Is there any kind of implication by the fact that it the database appears as a system database?

And second (and sorry for this stupid question)...The sp_dropdistributiondb procedure that does exactly? ... because that name suggests that it could delete the database ... and that's not what I want to do. It is a production database.

thanks for your attention ... any help would be appreciated.

Regards

SQL Server Log full (replication)

0
0

Hello,

I am seeing my transaction log sitting at 120GB with only 5GB free space. I am taking taking transaction log backups once every 5 mins for that database. This is the subsriber database. The log file for publisher database is sitting at 5GB with 4 GB freesace. When I run select name,log_reuse_wait_desc from sys.databases I get dbname,replication for the subscriber database. How do I shrink my log file.

Thanks

Failover sql server publisher to one of subscriber

0
0

Hello Team,

I have design question on transactional replication with one publisher and 5 subscribers ( sql server standard 2014). replicating entire database for horizontal scaling.Publication size is more than 3 TB. We setup push replication with initialize with backup method.

During time of disaster recovery, whats the quick way to restore application when we publisher is crashed. Is there any quick way to promote one of the subscriber as master and re-configure replication.

Possible known options

1) Break replication, configure publication on one of the subscriber and re-configure replication with backup restore method
Drawback :- It takes 30 hrs to re-configure ( backup and restore)
2) save replication meta data, add subscriptions with @sync_type = N'replication support only'
Drawback :- If there is any latency between nodes before we breaking replication, then there could be data conflict issues

Thanks in advance,

Regards,

Chaitanya Konduri

Can we make a copy of the database on the same instance to a different database?

0
0

Hello,

How do we take a backup of a database and restore the database to different database name in the same sql server instance.

i need to back up the database ECS and restore as ECSCopy in the same sql server instance.

Does it work the same way in SQL express edition and Standard Edition?

Its Urgent please

thanks

Senthil

SQL Server 2008 R2 Replication - Performance Critical - Log Reader Agent not Running

0
0

I have a SQL Server instance called NLSQL06 and I'm replicating to another instance called NLSQL05. I'm only replicating 20 tables, most small, the biggest 3 tables have 6, 5 and 2 million rows, but not many records should be changing.

The distributor is also on NLSQL06 and the Subscriber on NLSQL05 is pulling.

Replication ran fine for a week or so, but now, after returning from the weekend I notice that replication is now critical and the Log Reader agent is not running. The Publisher-Distributor is working fine. The problem appears to be between the Distributor and the Subscriber.I can't figure out what is going on. Nothing is reporting any errors.

Any help appreciated. Thanks.


too many useless commands in MSrepl_commands

0
0

can I truncate it ?

Number of Tables is equal to Number of Jobs?

0
0

Hi there,

We have a database which consists of 12 tables. I want to create a SQL Job to copy the table data from one database to another (same server) hourly in a set schedule time. Data will be updated every hour at source database and that fresh data should be copied to my destination database time to time. So, in my Job step, I wrote a below query,

delete from <destination_table>
go
insert into <destination_table>
select * from [SourceDatabase].dbo.<Source_table>
go

And this query is working fine for 1 job and 1 table.

If I want to pass all 12 tables in the same job rather than creating 12 jobs for 12 tables, which query helps so that copying fresh data should be done by a single query for all 12 tables?

or shall we create 12 steps for 12 tables in that job? 

Please suggest.

Thanks,

Having issues in SQL AlwaysOn Replication + Multi-subnet Setup.

0
0

Hello,

I setup an SQL AlwaysOn Replication in a Multi-subnet. I followed this article (h t t p s://blogs.msdn.microsoft.com/alwaysonpro/2014/01/30/setting-up-replication-on-a-database-that-is-part-of-an-alwayson-availability-group/) when setting up the replication. But upon validating the Replication by running the stored procedure in step 6.

USE distribution;

GO

DECLARE @redirected_publisher sysname;

EXEC sys.sp_validate_replica_hosts_as_publishers

@original_publisher = ‘SRV1’,

@publisher_db = ‘MyNorthWind’,

@redirected_publisher = ‘AGListener’;

I'm encountering the error below.

OLE DB provider "SQLNCLI11" for linked server "[BEF84991-4461-4578-B0B0-7D1CD024E276]" returned message "Unable to complete login process due to delay in opening server connection".

Msg 21892, Level 16, State 1, Procedure sp_hadr_validate_replica_hosts_as_publishers, Line 67

Unable to query sys.availability_replicas at the availability group primary associated with virtual network name '[Listener Name]' for the server names of the member replicas: error = 7303, error message = Error 7303, Level 16, State 1, Message: Cannot initialize the data source object of OLE DB provider "SQLNCLI11" for linked server "[BEF84991-4461-4578-B0B0-7D1CD024E276]"..',


May someone please suggest a remediation on this issue or a workaround would be good too.


Merge Replication – Bug in Business Logic Update Handler

0
0

I have got a business logic update conflict handler working, but I have had to work round what appears to be a bug.

 

Please can someone confirm if this is indeed a bug – and if it is a known bug?

 

My conflict handler needs to take some columns from the publisher row and some from the subscriber row in the event of conflict.

 

I can quite happily generate a custom dataset which contains the winning row that I want – I can see that because I can step through the conflict handler with debug when a conflict occurs.

 

However, just returning ActionOnUpdateConflict.AcceptCustomConflictData from the UpdateConflictsHandler method does not set the publisher and subscriber columns correctly.  I end up with different values on the two databases.

 

I have found that the only way to get the correct rows on both publisher and subscriber is to create a new ADO connection to the publisher and actually perform an update – updating all the modified columns.  This now works reliably in my testing.

 

Fortunately, due to business rules the frequency of update conflicts are likely to be very infrequent, but I would very much like to avoid having to do the ‘unnecessary’ update.

 

Notes:

  • I am using column level tracking – but I have seen the problem with row level tracking too
  • I have mainly been using SP1 but have repeated the test on a configuration using the SP2 CTP – and the problem occurs there too
  • The problem is not due to complex logic in my code.  If the method just sets customDataSet = publisherDataSet.Copy  and then returns ActionOnUpdateConflict.AcceptCustomConflictData, the changed and winning publisher values are not sent to the subscriber

 

Any thoughts would be much appreciated

merge replication - adding indexes to metadata tables

0
0

Hi All,

What is the general consensus on adding additional indexes to replication metadata tables ?

If I use the dm_db_missing_index_group_stats DMV, amongst other things it (strongly) suggests adding an index to the following

[dbo].[MSmerge_identity_range], columns [artid], [is_pub_range]  nb this table has 350k rows

I'm aware that this could be a two-edged sword -  has anyone any advice on whether I should do this ?

Or are the metadata tables considered sacrosanct and for MS only; would this impact any support from them.

This is for merge rep, publisher at SQL 2014, ~500 subscribers on sqlexpress.

Thanks

BTTF

Unable to view Subscription in the Subscriber folder in Push Subscriptions

0
0

Hi there,

I am currently working with transactional replication to replicate table data from one server to other. Previously, we used snapshot replication for some tables to replicate from stage server (publisher) to prod server (subscriber) by push subscriptions and we can see that replication in the local subscriber folder in the prod server. As per my analysis, while creating new publication they have used “run under the sql server agent service account” to specify the domain account and “by impersonating the process account” to connect the publisher. And this snapshot replication working fine, that I can view the subscription in the subscriber.

Now I created a publisher in the stage server, this time Tranasactional replication, and I added the publisher successfully. I am planning to add a new development server (for testing) instead of prod server as a Subscriber and right click on the local subscriptions in stage server, new subscription, it was showing an error stating that “need server name instead of IP address”, I changed to Server name and tried to log on but another error “ms ssms is unable to access replication components because replication is not installed on the instance of the sql server”. I used same sql agent security account as we did before for the Snapshot replication, but no use. Then I added that prod server as a subscriber (created a new database in it) with push subscription and using the same sql agent service account. Here I was surprised that subscription is created successfully but while checking the Subscription folder in the prod server, I cannot able to view that subscription. Can anyone help me out of these issues.

Thanks.

Merge Replication Stopped Working After Latest Windows Updates

0
0

SQL2014 - This has been working fine for years! It stopped working after both machines received the regular windows updates. Note it runs OK if I start it within Management Studio. Any help appreciated.

Executed from a batch file. "C:\Program Files\Microsoft SQL Server\120\COM\replmerg.exe" -Publisher [GLMP00001] -PublisherDB [District] -Publication [District_Merge] -Subscriber [GLML00003] -SubscriberDB [District] -SubscriptionType 1 -SubscriberSecurityMode 1 -Distributor [GLMP00001]

2016-09-16 08:31:23.440 Microsoft SQL Server Merge Agent 12.0.4459.0
2016-09-16 08:31:23.440 Copyright (c) 2014 Microsoft Corporation
2016-09-16 08:31:23.440
2016-09-16 08:31:23.440 The timestamps prepended to the output lines are expressed in terms of UTC time.
2016-09-16 08:31:23.440 User-specified agent parameter values:
                        -Publisher GLMP00001
                        -PublisherDB District
                        -Publication District_Merge
                        -Subscriber GLML00003
                        -SubscriberDB District
                        -SubscriptionType 1
                        -SubscriberSecurityMode 1
                        -Distributor GLMP00001
2016-09-16 08:31:23.440 Connecting to Subscriber 'GLML00003'
2016-09-16 08:31:23.471 Connecting to Distributor 'GLMP00001'
2016-09-16 08:31:23.503 The process could not connect to Distributor 'GLMP00001'.
2016-09-16 08:31:23.518 Category:AGENT
Source:  Merge Process
Number:  20084
Message: The process could not connect to Distributor 'GLMP00001'.
2016-09-16 08:31:23.518 Category:SQLSERVER
Source:  GLMP00001
Number:  -2146893042
Message: SQL Server Network Interfaces: No credentials are available in the security package
2016-09-16 08:31:23.518 Category:SQLSERVER
Source:  GLMP00001
Number:  -2146893042
Message: Cannot generate SSPI context


Paul

merge replication, SQL2014 and the new cardinality estimator

0
0

Hi all,

I have just upgraded our publisher from SQL2008 to SQL2014.  We have 500 odd subscribers who sync on demand to SQL Express 2008.

Since then it seems the amount of blocking on the database between subscribers has increased , also some message in the sync log appearing more regularly,

The process is waiting for a response from the query '{?=call dbo.MSmerge_ins_sp_DEAC08624FE6482B7546B0DC89494557_batch ('89ECBC0F-DC97-4AF5-81AC-3A88CE22C620',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?'

The process is waiting for a response from the query '{call sys.sp_MSenumchanges_notbelongtopartition(?,?,?,?,?,?,?,?,0)}'

 I am wondering if the new cardinality estimator (which is enabled) , could be the cause of the issue, in causing some bad access paths to be taken.

Has anyone any experience of this being the case ?  Are there any options to address this , other than disabling the new CE via a trace flag ?

Thanks

BTTF

Viewing all 4054 articles
Browse latest View live




Latest Images