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

The Process coult not execute 'sp_repldone/sp_replcounters' on 'XXXXX'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011)

$
0
0

HI

  I have configured the Transactional Replication in the cluster server 'XXXX' ,Once i fail over the server and get back to old node and check that the replication is not running. I get the following error, Please help me

Error messages:
The process could not execute 'sp_repldone/sp_replcounters' on 'XXXXX'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011)
Get help: http://help/MSSQL_REPL20011
Unable to execute procedure. The database is not published. Execute the procedure in a database that is published for replication. (Source: MSSQLServer, Error number: 18757)
Get help: http://help/18757
The process could not set the last distributed transaction. (Source: MSSQL_REPL, Error number: MSSQL_REPL22017)
Get help: http://help/MSSQL_REPL22017
The process could not execute 'sp_repldone/sp_replcounters' on 'XXXXX'. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037)
Get help: http://help/MSSQL_REPL22037


Thanks & Regards Manoj


SQL server Job failed as null values were tried to be inserted.

$
0
0
How can i make my job run without failure by making the stored procedure that the job runs to skip a null value?

SQL script

$
0
0

Hi guys,

I am running out of ideas on how to exclude records with letters in between right after dots like below.

when i run the following script 

select mmatter ,SUBSTRING (mmatter,8,8),LEN(SUBSTRING (mmatter,8,8)) from matter where mmatter like '%F%'

i get :-

                    

019032.F0003F00035
019032.F0010F00105
019032.F0011F00115  

The script i am working on feeds a table and it is suppose to exclude those numbers with letters in between. The letters could be from A to Z. Please help. thanks.

Log file not shrinking

$
0
0

Hi Experts

I am very new to replication and need your expert advice to resolve a replication issue.  The issue is log file not shrinking after the log backup.

sys.databases's log_reuse_wait_desc column show REPLICATION.  

dbcc opentran output following message

Transaction information for database 'XXX'. 

Replicated Transaction Information:

        Oldest distributed LSN     : (3236825:762348:5)
        Oldest non-distributed LSN : (3236825:762350:1)

DBCC execution completed. If DBCC printed error messages, contact your system administrator.

to resolve it, I execute  

EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0,    @time = 0, @reset = 1

But this breaks replication and we have to re-snapshot the database to configure the replication.

My question are

1. How can i identify the rouge transaction?

2. How to stop it happening

3. How to resolve it without breaking the replication

Thanks


Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker

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

Change SQL display result (Group by Name)

$
0
0

My SQL query can show the following result:

Name   Project  Date
Peter    A           2014-12-11
Peter    C           2014-12-12
Peter    D           2014-12-13
John     B           2014-12-12

I want to display the result like the following. (Same names are not shown)

Name   Project   Date
Peter    A            2014-12-11
            C            2014-12-12
            D            2014-12-13
John    B             2014-12-12

My database server is MS SQL Server 2012 Standard . How to get the above result by SQL query? 

Thanks,

Tony

Not display duplicate data in SQL table result

$
0
0

My SQL query can show the following result:

Name   Project  Task   Date
Peter    A            1       2014-12-11
Peter    A            1       2014-12-12
Peter    C            1       2014-12-12
Peter    C            2       2014-12-13
John     B            3       2014-12-14

I want to display the result like the following. (Same names are not shown)

Name   Project  Task   Date
Peter    A           1        2014-12-11
                                   2014-12-12
            C           1        2014-12-12
                         2        2014-12-13
John     B          3        2014-12-14

My database server is MS SQL Server 2012 Standard . How to get the above result by SQL query? 

Thanks,

Tony


Transactional Replication - Order of Replicated Tables

$
0
0

I have an issue with SQL Server Transactional Replication. My topology is as follows (and this cannot be changed, so I'm trying to work within the limitations that it has).

I have a publisher database (SourceDB) that is used by a new application. Some of the data entered there needs to be made available to an old application that is being replaced by the new one; the old application uses TargetDB, (the data in the TargetDB will be read only and used for reporting and downstream feeds). Both databases contain broadly similar data, but structured very differently. Data needs to be available as close to real time as possible. We have a remote distributor.

So we have set up a proxy version of SourceDB which acts as a subscriber (SourceProxyDB). This contains the subset of tables required for replication. Hanging off these tables are triggers which will transform the data and enter it into TargetDB.

SourceDB and the remote distributor are both SQL Server 2012 SP1; TargetDB is SQL Server 2008R2 SP2.

So basically:

  1. data entered in SourceDB
  2. transactional replication moves it to SourceProxyDB
  3. triggers transform and enter data in TargetDB

So far, so good. For the most part this has been working well... until we started seeing some issues as follows: 

There is a parent-child table relationship in SourceDB that needs to get into TargetDB

  • Typically one parent record is created followed by around 130 child records
  • Each child record contains a reference to the parent record's ID, which is an identity column
  • Sometimes we see the parent record arrive first in SourceProxyDB, followed by the child records as expected
  • Sometimes we see the parent record arrive out of order; either after all the child records arrive, or in the middle of the set of child records
  • There is no pattern to this
  • When the child records arrive first, they all contain a reference to the parent record which follows them, implying that the records are entered in the correct order in SourceDB but replicated in the wrong order
  • All child records always arrive in the correct sequential order; the only record out of order is the parent one

What we know/have tried so far:

  • confirmed that the parent and child records are added to SourceDB in a single transaction
  • used SQL Profiler to confirm that the parent and child records are added to SourceDB in the correct order
  • used SQL Profiler to confirm that the parent and child records are replicated to SourceProxyDB in the wrong order
  • added a FK relationship to SourceDB to tie the parent and child records together
  • marked the FK relationship 'False' for 'Not for Replication'
  • reinitialized replication for the parent and child tables (note - after doing this, the FK didn't appear in SourceProxyDB, which made me suspicious)
  • set SubscriptionStreams to 1

... and I'm still periodically seeing the parent record replicated either after or in the middle of the associated child records at SourceProxyDB. 

We're not seeing any FK errors or violations at the subscriber (SourceProxyDB) - as noted above, the FK didn't make it to SourceProxyDB after replication was re-initialized. The nature of the logic in the triggers requires the parent record to be available to the child records however so we are seeing logic errors.

I was under the impression that transactional replication would preserve the order of insertion of records, particularly those with FK relationships. 

I'm at a real loss as to where to look next. Any insights as to why this is happening and any possible solution(s) will be gratefully received; I've been tearing my hair out for days over this now...


what is the alternative of peer to peer replication?

$
0
0
what is the alternative of peer to peer replication?

Thanks

What is the proper way to get back the Replicated data

$
0
0

Hello,

I have replicated a database to another server. Suppose replication is from A to B.

A and B databases are on different servers.

Now if my server A fails and I want all of my data back to the A, which is stored in B.

What is the best way to recover all my data to A from the replicated DB B.

I have tried performing replication again like from B to A, is this correct to do this job.

Please suggest!

Rename a table Published in Transactional replication

$
0
0

Hi All,

I have replicated some table from Oracle(Publisher) to SQL server 2008 R2(Subscriber) and now i am trying to rename the published articles.I can do it using Drop article and then adding it back but in that case these is a risk of data loss.Is there any other way to rename a published article.

Thanks in advance.

Problem with bidirectional replication

$
0
0

Hi all

i have a problem with a bidirectional transactional replication.

when i create two replications : 1 from db A to db B  and a second one from db B to db A , but not on the same tables , the replications work but if even one table is in both replications , when I update a row in a table in db A, the replication does not work and an error is raised: Can't drop table X because it is used in a replication.

I would thank for and idea

Shlomy

Problem with bidirectional Replication

$
0
0

Hi all

i have a problem with a bidirectional transactional replication.

when i create two replications : 1 from db A to db B  and a second one from db B to db A , but not on the same tables , the replications work but if even one table is in both replications , when I update a row in a table in db A, the replication does not work and an error is raised: Can't drop table X because it is used in a replication.

I would thank for and idea

Shlomy

Add the NOT FOR REPLICATION Option to Existing Tables

$
0
0

 

Hello,

 

How to add the NOT FOR REPLICATION Option to Existing Tables( IDENTITY column,FOREIGN KEY constraints  )- TSQL.

 

Thanks,

 

Kanna.

 

 

replication scenario

$
0
0

hi

we have configured replication in environment, and it is running fine. Table 'X' in publisher size is around 1TB and the same table size in subscriber is 3TB,may I know the reason for this this change\increase

with regards,

ram 


setup transactional replication with pull subscription using the option @allow_initialize_from_backup

$
0
0

I am trying to setup  transactional replication with pull subscription using the option @allow_initialize_from_backup = true and I am a bit confused on steps involved because at teh end of setup it shows ‘uninitialized subscriber’ in replication monitor.

Publisher, distributor and subscriber are three separte SQL server 2008 R2 servers.

I executed below steps -

  1.       On publisher SQL server executed sp_addpublication with  options @immediate_sync ='true and   @allow_initialize_from_backup = true  
  2.       On publisher SQL server executed  sp_addarticle to add the articles
  3.       On distribution  SQL server disabled distribution cleanup agent and stopped the distribution cleanup job
  4.       On publisher SQL server created full backup of the publication db
  5.       On subscriber SQL server restored above backup with recovery
  6.       On publisher  executed  sp_addsubscription using options  @subscription_type = N'pull', and @sync_type = N'initialize with backup'
  7.       On subscriber  executed  sp_addpullsubscription  using options  @independent_agent = N'True',@subscription_type = N'pull',@description = N'',@update_mode = N'read only',@immediate_sync = 1
  8.       On distribution  SQL server enabled distribution cleanup agent and started the distribution cleanup job

At the end of these steps it shows ‘uninitialized subscriber’ in replication monitor.  What am I doing wrong ?

 In the above steps what is the difference between sp_addsubscription and sp_addpullsubscription ? 

When I setup transactional replication with push subscription using the option @allow_initialize_from_backup = true, I only execute sp_addsubscription on publisher.


Ravi Kumar


SQL Server 2012 Merge Replication - Delete operations on Merge Tables now require ALTER TRACE permisson due to Extended Stored Proceedure call master..sp_repl_generateevent. Some Advise would be appreciated.

$
0
0

Hi All,

In reference to http://dba.stackexchange.com/questions/29141/why-do-replication-deletes-require-sysadmin-access

I have the same issue as reported in the above link. The immediate issue has been bypassed in that I have granted ALTER TRACE permission to the main Applications account that does DELETE operations on the tables in question but in all honesty I don't want to grant that access just to bypass the error.

Msg 8189, Level 14, State 10,Procedure sp_repl_generateevent, Line 1
You do not have permission to run 'SP_TRACE_GENERATEEVENT'.

Has anyone else ran into this and come up with a better solution other than biting the bullet and giving all accounts that run DELETE operations on the merge Tables ALTER TRACE permission?

I could try some impersonation within the Replication Triggers to overcome this but of course if the replication is recreated then i would need to manually administrate the trigger code to manage the impersonation so that doesn't seem that practical to me.

Does this mean that its now a requirement for all accounts that run delete operations on Merge replication Tables to have Alter Trace Permission? o.O

Some advice would be greatly appreciated.

Kind regards,

killerchef

Violation of PRIMARY KEY constraint 'PK_test'. Cannot insert duplicate key in object 'dbo.test'. The duplicate key value is (12610). (Source: MSSQLServer, Error number: 2627) ?

$
0
0

Hi team,

How resolve the below error 

Violation of PRIMARY KEY constraint 'PK_test'. Cannot insert duplicate key in object 'dbo.test'. The duplicate key value is (12610). (Source: MSSQLServer, Error number: 2627) ?

Thanks,

Ram


RAM

SQL Server 2008 R2 native replication with Column Level Collation

$
0
0

In my SQL Server 2008 R2 environment -

Created a 'source' and 'target' database and altered the database collation as follows -

In my SQL Server 2008 R2 environment -

Created a 'source' and 'target' database and altered the database collation as follows -

use master

go

ALTERDATABASE source

COLLATE Chinese_PRC_CI_AS

GO

ALTERDATABASE target

COLLATE Chinese_PRC_CI_AS

GO

I created the below table in my source and target databases.

createtable dbo.tcolcs1(

    c0 int notnullprimarykey,

    c1 varchar(30)collate SQL_Latin1_General_Cp1_CI_AS,

    c2 char(30)collate SQL_Latin1_General_Cp1_CI_AS,

    c3 text collate SQL_Latin1_General_Cp1_CI_AS,

    c4 nvarchar(30)collate SQL_Latin1_General_Cp1_CI_AS,

    c5 nchar(30)collate SQL_Latin1_General_Cp1_CI_AS,

    c6 ntext collate SQL_Latin1_General_Cp1_CI_AS,

    cA varchar(30)collate Chinese_PRC_CI_AS,

    cB char(30)collate Chinese_PRC_CI_AS,

    cC text collate Chinese_PRC_CI_AS,

    cD nvarchar(30)collate Chinese_PRC_CI_AS,

    cE nchar(30)collate Chinese_PRC_CI_AS,

    cF ntext collate Chinese_PRC_CI_AS

)

go

I have inserted the below record in my source database.

insertinto dbo.tcolcs1values(10, nchar(0x00c4),nchar(0x00c4),'A',nchar(0x00c4),'B', nchar(0x00c4),NCHAR(0x4EBC),NCHAR(0x4EBC),NCHAR(0x4EBC),NCHAR(0x4EBC),NCHAR(0x4EBC),NCHAR(0x4EBC))

Just for information, character '0x00c4' is available in Latin1 code page but does not exist in Chinese_PRC_CI_AS code page.

Once the SQL Server replication does its job, I found the below record in target database.

c0  c1  c2  c3  c4  c5  c6  cA  cB  cC  cD  cE  cF

10 ?  ?   A  Ä   B  Ä         

Now, the problem is that SQL Server is not replicating the column C1 and C2 correctly. Both columns are having latin1 collation and character '0x00c4' exists in Latin code page.

My questions -

1. Is this a limitation of SQL Server or any specific settings need to be enabled ?

2. Does SQL Server native replication use ODBC or OLEDB ? How can I know this ?




Replication monitoring

$
0
0

I'm trying to turn on 'verbose' logging for a replication failure. We're running snapshot replication from Oracle to SQL Server. When I open 'Replication Monitor' I should see the snapshot agents, correct? I don't see anything under snapshot. My goal is to troubleshoot this replication issue w/ verbose logging or some other method. Can anybody assist?

Thanks,

phil

Viewing all 4054 articles
Browse latest View live


Latest Images