AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / dba / Perguntas / 29822
Accepted
Wes
Wes
Asked: 2012-12-05 14:03:47 +0800 CST2012-12-05 14:03:47 +0800 CST 2012-12-05 14:03:47 +0800 CST

Falha na replicação de mesclagem do SQL Server 2005

  • 772

Temos um cliente que ao tentar sincronizar um cliente (assinante) ao servidor (editor), recebe o seguinte erro:

2012-11-30 21:03:33.334 Percent Complete: 18
2012-11-30 21:03:33.334 Data validation failed for one or more articles. When troubleshooting, check the output log files for any errors that may be preventing data from being synchronized properly. Note that when error compensation or delete tracking functionalities are disabled for an article, non-convergence can occur.
2012-11-30 21:03:33.334 OLE DB Distributor 'EnvisionSQL\SQL2005': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2012-11-30 21:03:33.506 Percent Complete: 0
2012-11-30 21:03:33.506 Category:NULL
Source:  Merge Process
Number:  -2147200953
Message: Data validation failed for one or more articles. When troubleshooting, check the output log files for any errors that may be preventing data from being synchronized properly. Note that when error compensation or delete tracking functionalities are disabled for an article, non-convergence can occur.
2012-11-30 21:03:33.521 Percent Complete: 0
2012-11-30 21:03:33.521 Category:NULL
Source:  Merge Process
Number:  -2147200953 
Message: Article 'TB_CORE_DAILY' failed data validation (rowcount only). Rowcount actual: 80367, expected: 0.
2012-11-30 21:03:33.537 Percent Complete: 0
2012-11-30 21:03:33.537 Category:NULL
Source:  Merge Process
Number:  -2147200953
Message: Article 'TB_CORE_INSPECTION_VIOL' failed data validation (rowcount only). Rowcount actual: 19451, expected: 0.

O servidor é 2005 e o mecanismo de banco de dados local é 2005 express.

O que poderia estar causando a incompatibilidade das contagens de linhas reais/esperadas?


Estou tentando fazer mais pesquisas sobre isso, então pensei em reacender esta discussão para ver se mais alguém tem alguma opinião.

Entendo como a rowcountvalidação funciona, mas por que receberia um valor esperado de 0 em uma tabela que possui dados conhecidos?

sql-server replication
  • 3 3 respostas
  • 633 Views

3 respostas

  • Voted
  1. Adel Khayata
    2012-12-05T19:29:42+08:002012-12-05T19:29:42+08:00

    Verifique se você tem algum conflito entre o assinante e o editor e tente resolver esses conflitos.

    • 2
  2. Marcello Miorelli
    2019-07-25T11:17:49+08:002019-07-25T11:17:49+08:00

    Posso ver em suas mensagens de erro que data validationnão foi possível fazer isso, embora, como você disse , as tabelas publishere as tenham exatamente o mesmo arquivo .subscriberrowcount

    Eu não acho que seria um conflito, embora você possa verificar isso.

    para quaisquer erros relacionados à could not be verifiedreplicação de mesclagem no sql 2005, algo assim:

    insira a descrição da imagem aqui

    Mensagens de erro: • A assinatura da publicação 'MERLIN_PUBLICATION' não pôde ser verificada. Certifique-se de que todos os parâmetros de linha de comando do Merge Agent sejam especificados corretamente e que a assinatura esteja configurada corretamente. Se o Editor não tiver mais informações sobre esta assinatura, elimine e recrie a assinatura. (Fonte: MSSQL_REPL, Número do erro: MSSQL_REPL-2147201019) Obtenha ajuda: http://help/MSSQL_REPL-2147201019 Nome de objeto inválido 'dbo.sysmergepublications'. (Fonte: MSSQLServer, Número do erro: 208) Obtenha ajuda: http://help/208

    Tudo depende de como você configurou sua replicação de mesclagem. por exemplo, se você tiver tudo dividido, o que significa que cada assinante obtém apenas seu próprio compartilhamento e para verificar tudo o que eles precisam para se conectar ao servidor principal, executar um instantâneo não é grande coisa na maioria das vezes.

    se, no entanto, todos tiverem tudo em suas máquinas, a execução do snapshot pode demorar um pouco. Eu tento não chegar a isso, sempre que possível.

    há algumas coisas que eu poderia dizer, provavelmente teria que postar mais de uma resposta.

    Na replicação de mesclagem, todas as coisas que você precisa ver estão dentro dos próprios bancos de dados.

    faça o que fizer, faça backup de todas as tabelas antes de fazê-lo.

    por exemplo:

    select * into MSMerge_Replinfo_20130116 from MSMerge_Replinfo
    

    digamos que eu tenho um servidor chamado ODSe todos os meus assinantes são nomeados MERLIN SOMETHING meu banco de dados é chamadoconcord_ord

    Veja isso:

    -- #### ODS
    
    use concord_ods
    go
    
    select top 10 
    recgen,recguid,sentgen,sentguid,pubid,subid,replnickname 
     from sysmergesubscriptions with (nolock)
    where subscriber_server = 'MERLIN026'
    
    
    -- ODS the original after the reinitialisation
    -- ODS recgen   recguid                                 sentgen sentguid    
    -- ODS 71374    7D24ABFE-DC96-4C7C-BCC7-F48830F82493    6336565 7D24ABFE-DC96-4C7C-BCC7-F48830F82493    
    
    
    -- ODS - I modified but it did not work
    -- ODS recgen   recguid                                 sentgen sentguid                                pubid                                   subid                                   replnickname
    -- ODS 5933523  1530D5D0-61E9-4000-9BD5-F01F3D08601A    6278697 1F0CBCD4-B959-44C9-B120-77FC09EC5082    8E72F963-2C85-4005-BC5F-8494A1BE23BE    9F26E61E-AF33-4F83-95E6-32AD98155048    0xAF339F26E61E
    
    
    -- ### merlin026
    
    --merlin026 bef.rei. recgen  recguid                                sentgen sentguid
    --merlin026 bef.rei. 6278697 1F0CBCD4-B959-44C9-B120-77FC09EC5082   5933523 1530D5D0-61E9-4000-9BD5-F01F3D08601A
    
    --merlin026 aft.rei. recgen  recguid                                sentgen sentguid
    --merlin026 aft.rei. 6454923 621E577A-80D3-4177-AFF1-A226F912E779   6454674 16D59CEE-9191-44E5-B8A2-C6C45570A004
    

    então vá para seus assinantes e verifique os dados lá: por exemplo:

    use concord_ods
    go
    
    
    select top 10 
    recgen,recguid,sentgen,sentguid,pubid,subid,replnickname 
     from sysmergesubscriptions with (nolock)
    where subscriber_server = 'TCP-ODS01'
    
    -- ODS - I modified but it did not work
    -- ODS recgen   recguid                                 sentgen sentguid                                pubid                                   subid                                   replnickname
    -- ODS 5933523  1530D5D0-61E9-4000-9BD5-F01F3D08601A    6278697 1F0CBCD4-B959-44C9-B120-77FC09EC5082    8E72F963-2C85-4005-BC5F-8494A1BE23BE    9F26E61E-AF33-4F83-95E6-32AD98155048    0xAF339F26E61E
    
    
    -- 026 recgen   recguid                                 sentgen sentguid                                pubid                                   subid                                   replnickname
    -- 026 6278697  1F0CBCD4-B959-44C9-B120-77FC09EC5082    5933523 1530D5D0-61E9-4000-9BD5-F01F3D08601A    8E72F963-2C85-4005-BC5F-8494A1BE23BE    8E72F963-2C85-4005-BC5F-8494A1BE23BE    0x2C858E72F963
    
    -- After the reinitialisation
    -- 026 recgen   recguid                                 sentgen sentguid                                pubid                                   subid                                   replnickname
    -- 026 6454923  621E577A-80D3-4177-AFF1-A226F912E779    6454674 16D59CEE-9191-44E5-B8A2-C6C45570A004    8E72F963-2C85-4005-BC5F-8494A1BE23BE    8E72F963-2C85-4005-BC5F-8494A1BE23BE    0x2C858E72F963
    
    
    select top 10 
    subscriber_server ,recgen,recguid,sentgen,sentguid,pubid,subid,replnickname 
     from sysmergesubscriptions with (nolock)
    
    --on MERLIN026
    --three subscriptions?
    --subid:
    --85A04E38-78AA-41F6-9956-3538656F0912
    --A27948E7-54C3-4EBB-9D3F-DFF46D723313
    --534EFA1C-3CE7-4C93-9943-F580CD7364F4
    
    -- none of these match to ODS subid:
    --9F26E61E-AF33-4F83-95E6-32AD98155048
    
    -- hypothesis: mismatched subid is causing synchronisation failure
    
    -- proposed solution: update to subid to bring it in line with ODS subid
    -- this should allow the two databases to connect
    
    -- check to see where the subid appears in the database
    select * from sys.columns
    where name = 'subid'
    
    select * from sys.tables
    where object_id in (
        select object_id from sys.columns
        where name = 'subid'
        )
    
    
    -- check these tables for data    
    select * from MSmerge_identity_range -- 51 rows
    select top 10 * from MSmerge_altsyncpartners -- 0
    select top 10 * from MSmerge_supportability_settings -- 0
    select * from MSmerge_sessions -- 10 rows
    select top 10 * from MSmerge_log_files -- 0
    
    
    -- keep data, just in case it all goes wrong and we need to roll back the change
    select * into  dbo.MSmerge_sessions_20130116 from MSmerge_sessions 
    
    select * from MSmerge_sessions 
    
    --I spotted that over 8 records had a different subid, and the rest 
    --rest of the records had the correct subid, therefore I deleted those
    --which had a wrong subid
    delete from MSmerge_sessions where subid <> '9F26E61E-AF33-4F83-95E6-32AD98155048'
    
    -- we also need to align the replnickname
    -- so make sure this isn't used anywhere else
    
    select * from sys.tables
    where object_id in (
        select object_id from sys.columns
        where name = 'replnickname'
        )
    -- just in sysmergesubscriptions
    
    -- the subid is repid in MSMerge_Replinfo
    select * from MSMerge_Replinfo
    
    -- I found 2 rows on MSMerge_Replinfo
    -- where the repid is not '9F26E61E-AF33-4F83-95E6-32AD98155048'
    -- I will remove them
    
    select * into MSMerge_Replinfo_20130116 from MSMerge_Replinfo
    
    select * from MSMerge_Replinfo
    
    delete from MSMerge_Replinfo
    where repid <> '9F26E61E-AF33-4F83-95E6-32AD98155048'
    
    
    -- make sure this doesn't appear anywhere else
    select * from sys.tables
    where object_id in (
        select object_id from sys.columns
        where name = 'repid'
        )
    -- just in MSMerge_Replinfo
    
    
        select status, replnickname from sysmergesubscriptions
        where subid = '8E72F963-2C85-4005-BC5F-8494A1BE23BE'
    
    -- use a transaction so that we can make further checks post-update
    begin transaction
    select @@trancount
    
        -- update tables
        update sysmergesubscriptions
        set subid = '9F26E61E-AF33-4F83-95E6-32AD98155048'
            , status = 1
            , replnickname = 0xAF339F26E61E
        where subid = '8E72F963-2C85-4005-BC5F-8494A1BE23BE'
    
        update  MSMerge_Replinfo
        set repid = '9F26E61E-AF33-4F83-95E6-32AD98155048'
        where repid = '85A04E38-78AA-41F6-9956-3538656F0912'
    
        update MSmerge_sessions 
        set subid = '9F26E61E-AF33-4F83-95E6-32AD98155048'
    
        update MSmerge_identity_range 
        set subid = '9F26E61E-AF33-4F83-95E6-32AD98155048'
    
        -- check result
        select * from sysmergesubscriptions with (readuncommitted)
        select * from MSMerge_Replinfo with (readuncommitted)
        select * from MSmerge_sessions with (readuncommitted)
        select * from MSmerge_identity_range with (readuncommitted)
    
    -- result is good, commit
    --rollback transaction
    commit transaction
    select @@trancount -- 0
    
    
    
    select subscriber_server,pubid, subid,replnickname,recgen,sentgen,recguid,sentguid 
    from sysmergesubscriptions with (readuncommitted)
    where subscriber_server = 'MERLIN026'
       or subscriber_server = 'MERLIN864'
    
    
    --merlin026 - not working
    --subscriber_server pubid                                   subid                                   replnickname    recgen  sentgen recguid                                 sentguid
    --TCP-ODS01         8E72F963-2C85-4005-BC5F-8494A1BE23BE    9F26E61E-AF33-4F83-95E6-32AD98155048    0xAF339F26E61E  6278697 5933523 1F0CBCD4-B959-44C9-B120-77FC09EC5082    1530D5D0-61E9-4000-9BD5-F01F3D08601A
    --MERLIN026         8E72F963-2C85-4005-BC5F-8494A1BE23BE    85A04E38-78AA-41F6-9956-3538656F0912    0xBD244C8F11E7  NULL    NULL    NULL                                    NULL
    --MERLIN026         2F0867E6-4580-4DB9-9405-9C836413B7D2    A27948E7-54C3-4EBB-9D3F-DFF46D723313    0x78AA85A04E38  NULL    NULL    NULL                                    NULL
    --MERLIN026 7       C2C1785-0FE1-4717-9E53-BAAFD889B89A     534EFA1C-3CE7-4C93-9943-F580CD7364F4    0xBD244C8F11E7  NULL    NULL    NULL                                    NULL
    
    
    
    --merlin864 - working fine
    --sysmergesubscriptions 
    --subscriber_server pubid                                   subid                                   replnickname    recgen  sentgen recguid                                 sentguid
    --TCP-ODS01         8E72F963-2C85-4005-BC5F-8494A1BE23BE    8E72F963-2C85-4005-BC5F-8494A1BE23BE    0x2C858E72F963  6456716 2857356 18607229-F77A-4768-89D3-DEF82775340A    6A93A5F5-AC77-4A96-9472-4B64EAFF4435
    --MERLIN864         8E72F963-2C85-4005-BC5F-8494A1BE23BE    776E13B8-6997-4ABD-9F55-C277EF86A3B0    0xEFBB4CCC71C0  NULL    NULL    NULL                                    NULL
    
    -- ODS
    --subscriber_server pubid                                   subid                                   replnickname    recgen  sentgen recguid                                 sentguid
    --MERLIN026         8E72F963-2C85-4005-BC5F-8494A1BE23BE    9F26E61E-AF33-4F83-95E6-32AD98155048    0xAF339F26E61E  5933523 6278697 1530D5D0-61E9-4000-9BD5-F01F3D08601A    1F0CBCD4-B959-44C9-B120-77FC09EC5082
    --MERLIN864         8E72F963-2C85-4005-BC5F-8494A1BE23BE    776E13B8-6997-4ABD-9F55-C277EF86A3B0    0xEFBB4CCC71C0  2857356 6456716 6A93A5F5-AC77-4A96-9472-4B64EAFF4435    18607229-F77A-4768-89D3-DEF82775340A
    
    --merlin026 - after the reinitialisation
    --subscriber_server pubid                                   subid                                   replnickname    recgen  sentgen recguid sentguid
    --TCP-ODS01         8E72F963-2C85-4005-BC5F-8494A1BE23BE    8E72F963-2C85-4005-BC5F-8494A1BE23BE    0x2C858E72F963  6454923 6454674 621E577A-80D3-4177-AFF1-A226F912E779    16D59CEE-9191-44E5-B8A2-C6C45570A004
    --MERLIN026         8E72F963-2C85-4005-BC5F-8494A1BE23BE    9F26E61E-AF33-4F83-95E6-32AD98155048    0xAF339F26E61E  NULL    NULL    NULL                                    NULL
    
    
    -- MERLIN026 after update below
    --subscriber_server pubid                                   subid                                   replnickname    recgen  sentgen recguid                                 sentguid
    --TCP-ODS01         8E72F963-2C85-4005-BC5F-8494A1BE23BE    8E72F963-2C85-4005-BC5F-8494A1BE23BE    0x2C858E72F963  6278697 5933523 1F0CBCD4-B959-44C9-B120-77FC09EC5082    1530D5D0-61E9-4000-9BD5-F01F3D08601A
    --MERLIN026         8E72F963-2C85-4005-BC5F-8494A1BE23BE    9F26E61E-AF33-4F83-95E6-32AD98155048    0xAF339F26E61E  NULL    NULL    NULL                                    NULL
    
    --MERLIN026         2F0867E6-4580-4DB9-9405-9C836413B7D2    A27948E7-54C3-4EBB-9D3F-DFF46D723313    0x78AA85A04E38  NULL    NULL    NULL                                    NULL
    --MERLIN026         7C2C1785-0FE1-4717-9E53-BAAFD889B89A    534EFA1C-3CE7-4C93-9943-F580CD7364F4    0xBD244C8F11E7  NULL    NULL    NULL                                    NULL
    
    -- ## MERLIN026
    use concord_ods
    go
    
    select @@servername
    
    begin tran T01
    
        update sysmergesubscriptions 
        set subid = '8E72F963-2C85-4005-BC5F-8494A1BE23BE'
          ,replnickname = 0x2C858E72F963
        where subscriber_server = 'TCP-ODS01'
    
        update sysmergesubscriptions 
        set subid = '9F26E61E-AF33-4F83-95E6-32AD98155048'
          ,replnickname = 0xAF339F26E61E
        where subscriber_server = 'MERLIN026'
          and subid = '85A04E38-78AA-41F6-9956-3538656F0912'
    
        -- make sure that the status is 1 otherwise it does not verify
        update sysmergesubscriptions 
        set status = 1
        where subscriber_server = 'MERLIN026'
          and subid = '9F26E61E-AF33-4F83-95E6-32AD98155048'
    
    
        select subscriber_server,pubid, subid,replnickname,recgen,sentgen,recguid,sentguid 
        from sysmergesubscriptions with (readuncommitted)
    
    
    --rollback tran T01
    --commit tran T01
    
    select @@trancount
    

    Eu sei que é muito para assumir. Mas vale a pena, se você quiser evitar a execução de snaps.

    No caso acima, um servidor foi consertado e outro precisou se inscrever novamente.

    • 0
  3. Best Answer
    Marcello Miorelli
    2019-07-25T11:25:29+08:002019-07-25T11:25:29+08:00

    Apenas para complementar ou adicionar à outra resposta

    há momentos em que você recebe uma mensagem realmente cabeluda insira a descrição da imagem aqui

    a primeira coisa que faço é ativar o detalhado:

    Turn on verbose history (Replication monitor->Agent Profile->Verbose History) and use the -output parameter and select a destination for the output file (Subscriber Replication Job -> Edit Run Agent Job -> In the command window add -output C:\MyFilePath\FileName.log). 
    

    insira a descrição da imagem aqui

    insira a descrição da imagem aqui

    e:

    Dê uma olhada na parte mais recente do comando abaixo, você verá o parâmetro de saída.

    -Publisher [TCP-ODS01] -PublisherDB [concord_ods] -Publication [MERLIN_PUBLICATION] -Subscriber [MERLIN771] -SubscriberDB [ConCORD_ODS]   -Distributor [TCP-MERGE01] -DistributorSecurityMode 1 -HostName [MERLIN771]  -output C:\Replication\MERLIN771_1132.log
    

    Agora podemos dar uma olhada no arquivo de log.

    insira a descrição da imagem aqui

    Agora você pode dar uma olhada no log gerado e prosseguir a partir daí. Exemplo (veja a próxima foto abaixo):

    O comando no trabalho é:

    --This is the MERLIN307 subscriber, I am troubleshooting, outputting to the log at c:\replication and using the - VerbatimTextObjectScripting 0 option.
    -Publisher [TCP-ODS01] -PublisherDB [concord_ods] -Distributor [TCP-MERGE01] -Publication [MERLIN_PUBLICATION] -ReplicationType 2 -DistributorSecurityMode 1  -DynamicFilterHostName [MERLIN307] -DynamicSnapshotLocation [\\TCP-MERGE01\REPLDATA\\unc\TCP-ODS01_CONCORD_ODS_MERLIN_PUBLICATION\MERLIN307_9\] -PartitionId 9  -VerbatimTextObjectScripting 0 -output C:\Replication\MERLIN307-983.log
    

    insira a descrição da imagem aqui

    Não posso dar uma resposta direta para o seu caso em particular, mas com certeza posso ajudá-lo a descobrir qual é o problema, usando as etapas acima.

    Se parece confuso, deixe um comentário abaixo, tentarei ser mais específico.

    • 0

relate perguntas

  • Práticas recomendadas para executar a replicação atrasada do deslocamento de tempo

  • Quando devo usar uma restrição exclusiva em vez de um índice exclusivo?

  • Quais são as principais causas de deadlocks e podem ser evitadas?

  • Como determinar se um Índice é necessário ou necessário

  • Qual é a diferença entre a replicação do PostgreSQL 9.0 e o Slony-I?

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Como ver a lista de bancos de dados no Oracle?

    • 8 respostas
  • Marko Smith

    Quão grande deve ser o mysql innodb_buffer_pool_size?

    • 4 respostas
  • Marko Smith

    Listar todas as colunas de uma tabela especificada

    • 5 respostas
  • Marko Smith

    restaurar a tabela do arquivo .frm e .ibd?

    • 10 respostas
  • Marko Smith

    Como usar o sqlplus para se conectar a um banco de dados Oracle localizado em outro host sem modificar meu próprio tnsnames.ora

    • 4 respostas
  • Marko Smith

    Como você mysqldump tabela (s) específica (s)?

    • 4 respostas
  • Marko Smith

    Como selecionar a primeira linha de cada grupo?

    • 6 respostas
  • Marko Smith

    Listar os privilégios do banco de dados usando o psql

    • 10 respostas
  • Marko Smith

    Como inserir valores em uma tabela de uma consulta de seleção no PostgreSQL?

    • 4 respostas
  • Marko Smith

    Como faço para listar todos os bancos de dados e tabelas usando o psql?

    • 7 respostas
  • Martin Hope
    Mike Walsh Por que o log de transações continua crescendo ou fica sem espaço? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland Listar todas as colunas de uma tabela especificada 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney O MySQL pode realizar consultas razoavelmente em bilhões de linhas? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx Como posso monitorar o andamento de uma importação de um arquivo .sql grande? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison Como você mysqldump tabela (s) específica (s)? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    pedrosanta Listar os privilégios do banco de dados usando o psql 2011-08-04 11:01:21 +0800 CST
  • Martin Hope
    Jonas Como posso cronometrar consultas SQL usando psql? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas Como inserir valores em uma tabela de uma consulta de seleção no PostgreSQL? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas Como faço para listar todos os bancos de dados e tabelas usando o psql? 2011-02-18 00:45:49 +0800 CST
  • Martin Hope
    bernd_k Quando devo usar uma restrição exclusiva em vez de um índice exclusivo? 2011-01-05 02:32:27 +0800 CST

Hot tag

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve