SQL Server transaction replication Fault Handling example

Source: Internet
Author: User

1. Transaction replication works normally. An error occurs on a certain day:

I was so scared that I thought I had to redo it.

2. Visit the peak hours, and do not have time to redo it. I am lucky to put my dog on...

3. Use a dead horse as a live horse and try again:

A. Run

 

Use [distribution] sp_browsereplcmds '0x00093ffa00002a0e00e000000000', '0x00093ffa00002a0e00e000000000'

Obtain the transaction details of the Error

{CALL [dbo]. [sp_MSdel_dbot_test] (27,425285 )}

I have been guessing for a long time and think that the role of this transaction is to delete some data in the dbo. t_test table. The subsequent numbers do not know what it means. B. I ran to the subscription server and executed it.

Use [test]
Exec sp_helptext [sp_MSdel_dbot_test]

Find out what the transaction is doing. create procedure [dbo]. [sp_MSdel_dbot_test]
@ Pkc1 int,
@ Pkc2 int
As
Begin
Delete [dbo]. [t_test]
Where [te_bakid] = @ pkc1
And [te_recid] = @ pkc2
If @ rowcount = 0
If @ microsoftversion> 0x07320000
Exec sp_MSreplraiserror 20598
End

 

3. A new puppy-a big white image

The two digits are the primary key (this table is the joint primary key)

Imagine that the publisher asked the subscriber to delete the data of a table and a primary key, just like the subscriber, but the subscriber had no such data and could not delete it, so he went on strike.

Why can't Microsoft make it clear when reporting error information and translation?

 

4. Try a brutal operation. Since you don't have it, you can't delete it. You can write a few lines. It is used to delete the lines.

N rows of insert code are omitted here

 

5. On the publisher, use the copy viewer to observe and finally run. The tortoise started to catch up with the white rabbit.

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.