Transaction replication blocking

Hello,
I am seeing that transaction replication inserts are causing a lot of blocking in the subscriber database. The blocked statements are select statements. Does Transaction replication lock tables when it inserts?Can this blocking be prevented?
Thanks

Best way to handle this is either decrease the commitbatchsize and commitbatchsizethresholds on the distribution agent profile, or the use the snapshot isolation level (READ_COMMITTED_SNAPSHOT)
on your subscriber database.
You might want to also change the fill factor on the problem tables, examine the indexes there to see if they are used, and then examine the blocking workload to see if there is anything you can do to reduce its impact. Indexing may help.
Replication may cause blocking, especially if more than 5000 rows are being inserted in a batch. Disabling lock escalation will help here - if table level locks are being held. Disabling lock escalation is not always a good thing to do - you will need to
carefully examine locking/blocking to determine what your best approach is.
looking for a book on SQL Server 2008 Administration?
http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search?
http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941

Similar Messages

  • Transactional replication very slow with indexes on Subscriber table

    I have setup Transactional Replication for one of our databases where one table with about 5mln records is replicated to a Subsriber database. With every replication about 500-600.000 changed records are send to the Subscriber.
    Since one month I see very strange behaviour when I add about 10 indexes to the Subscriber table. As soon as I have added the indexes replication speed becomes extremely slow (almost 3 hours for 600k records). As soon as I remove the indexes the replication
    is again very fast, about 3 minutes for the same amount of records.
    I've searched a lot on the internet to solve this issue but can't find any explaination for this strange behaviour after adding the indexes. As far as I know it doesn't have to be a problem to add indexes to a Subscriber table, and it hasn't been before on
    another replication configuration we use.
    Some information from the Replication Log:
    With indexes on the Subscriber table
    Total Run Time (ms) : 9589938 Total Work Time : 9586782
    Total Num Trans : 3 Num Trans/Sec : 0.00
    Total Num Cmds : 616245 Num Cmds/Sec : 64.28
    Total Idle Time : 0 
    Writer Thread Stats
    Total Number of Retries : 0 
    Time Spent on Exec : 9580752 
    Time Spent on Commits (ms): 2687 Commits/Sec : 0.00
    Time to Apply Cmds (ms) : 9586782 Cmds/Sec : 64.28
    Time Cmd Queue Empty (ms) : 5499 Empty Q Waits > 10ms: 172
    Total Time Request Blk(ms): 5499 
    P2P Work Time (ms) : 0 P2P Cmds Skipped : 0
    Reader Thread Stats
    Calls to Retrieve Cmds : 2 
    Time to Retrieve Cmds (ms): 10378 Cmds/Sec : 59379.94
    Time Cmd Queue Full (ms) : 9577919 Full Q Waits > 10ms : 6072
    Without indexes on the Subscriber table
    Total Run Time (ms) : 89282 Total Work Time : 88891
    Total Num Trans : 3 Num Trans/Sec : 0.03
    Total Num Cmds : 437324 Num Cmds/Sec : 4919.78
    Total Idle Time : 0 
    Writer Thread Stats
    Total Number of Retries : 0 
    Time Spent on Exec : 86298 
    Time Spent on Commits (ms): 282 Commits/Sec : 0.03
    Time to Apply Cmds (ms) : 88891 Cmds/Sec : 4919.78
    Time Cmd Queue Empty (ms) : 1827 Empty Q Waits > 10ms: 113
    Total Time Request Blk(ms): 1827 
    P2P Work Time (ms) : 0 P2P Cmds Skipped : 0
    Reader Thread Stats
    Calls to Retrieve Cmds : 2 
    Time to Retrieve Cmds (ms): 2812 Cmds/Sec : 155520.63
    Time Cmd Queue Full (ms) : 86032 Full Q Waits > 10ms : 4026
    Can someone please help me with this issue? Any ideas? 
    Pim 

    Hi Megens:
    Insert statement might be slow with not only indexes and few others things too
    0) SQL DB Blocking during inserts
    1) If any insert triggers are existed
    2) Constraints - if any
    3) Index fragmentation
    4) Page splits / fill factor
    Without indexes inserts will be fast because, each time when new row going to insert to the table, SQL Server will do
    1) it will check for the room, if no room page splits will happen and record will placed at right place
    2) Once the record updated all the index should be update
    3) all these extra update work will cause can make insert statement bit slow
    Its better to have index maintenance jobs frequently to avoid fragmentation.
    If every thing is clear on SQL Server Side, you need look up on DISK IO, N/W Latency between the servers and so on
    Thanks,
    Thanks, Satish Kumar. Please mark as this post as answered if my anser helps you to resolves your issue :)

  • Transactional Replication: Alter view changes are not reflect on Subscription database

    Hi All,
    we are configured transactional replication in our environment on sql server 2008 R2 , Yesterday I made a view alter on publisher database the view also present in replicated articles but unfortunately the changes not reflect in subscription, I already have
    checked the : Replicate Schema change option in Subscription option its also true, there is not latency exist in replication monitor , i have checked the blocking on subscription and publication. one more thing I tested the changes on replicated table its
    working fine
    Please help me to fix the issue.
    Regards,
    Pawan Singh
    Thanks

    Hi Pawan,
    According to your description, the alter on the view in publication doesn't be reflected in subscription database. As my analysis, the issue could be caused by that the distribution agent job doesn’t run after altering the view.
    I make a test on my computer, and set up transactional replication to replicate tables and views. Firstly, when creating subscription, I set the distribution agent job ‘Run continuously’(as the screenshot below), and alter the view in publication database,
    then the change is successfully reflected to the corresponding view in subscription database.
    However, I also make another test with setting the distribution agent job ‘Run on demand only’(It is determined by you), and find that it is not reflected to subscription database unless I run the distribute agent job manually.
    The distribution agent is used to read the updated transactions written to the distribution database and applies the change to the subscription database, so please check if your distribution agent job runs after you alter the view. If not, please run the
    job and check if the issue still occurs.
    Regards,
    Michelle Li

  • Transactional Replication sp_MSupd RUNNABLE and never ends

    Hello,
    I came across not understandable problem connecting transactional pull replication. Once or twice a month I have a problem that stored procedure on subscription server (sp_MSupd) cannot be finished. It is not blocked by any other session and does not have
    any wait type. It simply hangs and remains in task status RUNNABLE. The only one way to recover the replication is initilizing it from backup or snapshot. Do you have any suggestions. Have you faced similiar problem?

    Hi, Lydia
    Thank you for your reply. What do you mean that this is the "busy update on the publication". Could you please describe it in more details? Does it mean that on the publisher there was a huge update on a huge amount of rows? On the Publisher to
    Distributor History I can see that there is no problem. All transactions are delivered without any delays (few seconds). But in Distributor to Subscriber History I have all actions completed in few seconds except the last one that hangs. How can I check if
    it is the "busy update on the publication" problem? What should be done if it hangs more than few hours?
    I found out that sp_MSget_repl_commands hangs on Publisher for remote Subscriber. It hangs with ASYNC_NETWORK_IO
    Hi KirKuz,
    I originally mean distribution agent reader &writer latency issue, and you can use SQL profiler or DMVs to examine in detail the Transaction Replication, which is described in this
    blog.
    Regarding to ASYNC_NETWORK_IO, based on my research, it's simply waiting for something external to SQL. The drive with your distribution database might be a bottleneck of such issue, or maybe the distribution tables are getting too large. Please check your
    disk performance, also check your indexes on the replication tables for fragmentation.
    Here is a similar thread for your reference.
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d0117651-f94c-488a-83e8-30038e38d510/transactional-replication-slow-running-spmsgetreplcommands?forum=sqlreplication
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • Invalid rowid error while running the snapshot agent in transactional replication

    Hi All,
    I am getting an Invalid rowid error while replicating an large tables i.e around 30 millions rows from oracle(publisher) to sql server(Subscriber) while running the snapshot agent in transactional replication.
    Its taking around 18 hours and its then its throwing this error.
    Is there any faster way that i can replicate the initial snapshot this large table as 18 hours is very high on time.
    Kindly suggest.i am always got quick and accurate response always..hope the same in this case also.
    Thanks,

    Hi,
    Could you please create a replication with some small tables for a test?
    You can disable the firewall on both sides and rerun snapshot. Enable verbose logging to level 4 for snapshot agent and check the results if it fails.
    http://support.microsoft.com/kb/312292
    Here is a document says for the error: ORA-10632: Invalid rowid Cause: Segment Highwatermark was overwritten due to shrink and space reused Action: Reissue this command.
    I also suggest you contact the Oracle support team for further help.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Error while setting up Transactional Replication

    Hi Team,
    I am getting below error while configuring Transactional Replication.
    Specifically, when I started configuring the distributor that when I am getting below error. I am getting this in GUI as well TSQL script as well.
    SQL Server could not configure 'TEST-PC\SQL2K8' as a Distributor.
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    Destination path D:\SQL2K8DATA is not valid. Unable to list directory contents. Specify a valid destination path.
    Changed database context to 'master'. (Microsoft SQL Server, Error: 14430)
    Background of the error.
    ========================
    I installed 3 sql instances of "SQL Server 2008 Developer edition, SP3 (x64)".
    I started configuring a remote distributor using one of the instance and error started popping up.
    Initially I had the replication running fine and I removed it and tried to reconfigure distributor thats when the error starting popping up.
    The folder physically exists and the service account has full permissions and I have logged in as service account and trying to setup Transactional Replication.
    He is local administrator on the box and also sysadmin login at sql server level.
    Not sure why this error is popping up.....
    After wasting a lot of time. I tried to install 3 new fresh instances with same service pack level i.e. sp3, but still the error remains the same.
    Appreciate if anyone can guide me resolving this issue.
    Thank you.

    Hi Brandon,
    I generated the script and tried again. No Luck. It is throwing error at creation of distribution database itself i.e. exec sp_adddistributiondb .
    /****** Scripting replication configuration. Script Date: 2/25/2014 11:43:31 AM ******/
    /****** Please Note: For security reasons, all password parameters were scripted with either NULL or an empty string. ******/
    /****** Installing the server as a Distributor. Script Date: 2/25/2014 11:43:31 AM ******/
    use master
    go
    exec sp_adddistributor
    @distributor = N'TEST-PC\S2',
    @password = N'123'
    GO
    exec sp_adddistributiondb
    @database = N'distribution',
    @data_folder = N'C:\Program Files\Microsoft SQL Server\MSSQL10.S2\MSSQL\Data',
    @log_folder = N'C:\Program Files\Microsoft SQL Server\MSSQL10.S2\MSSQL\Data',
    @log_file_size = 2,
    @min_distretention = 0,
    @max_distretention = 72,
    @history_retention = 48,
    @security_mode = 1
    GO
    Error Message :
    Msg 14430, Level 16, State 1, Procedure sp_adddistributiondb, Line 227
    Destination path C:\Program Files\Microsoft SQL Server\MSSQL10.S2\MSSQL\Data is not valid. Unable to list directory contents. Specify a valid destination path.
    use [distribution]
    if (not exists (select * from sysobjects where name = 'UIProperties' and type = 'U '))
        create table UIProperties(id int)
    if (exists (select * from ::fn_listextendedproperty('SnapshotFolder', 'user', 'dbo', 'table', 'UIProperties', null, null)))
        EXEC sp_updateextendedproperty N'SnapshotFolder', N'\\TEST-PC\repldata', 'user', dbo, 'table', 'UIProperties'
    else
        EXEC sp_addextendedproperty N'SnapshotFolder', N'\\TEST-PC\repldata', 'user', dbo, 'table', 'UIProperties'
    GO
    exec sp_adddistpublisher @publisher = N'TEST-pc\s1',
    @distribution_db = N'distribution',
    @security_mode = 1,
    @working_directory = N'\\TEST-PC\repldata',
    @trusted = N'false',
    @thirdparty_flag = 0,
    @publisher_type = N'MSSQLSERVER'
    GO

  • Running transactional replication on SQL server 2008R2 but: "The process could not connect to subscriber 'SERVER NAME'"

    I've set up Replication (transactional replication) between two remote servers. On the one of server that I configure Distribution & publication .another server is subscription. The subscription is all set & snapshot agent is started .but the actual
    replication doesn't take place.
    When viewing the Synchronization Status of the subscription, i get an error, saying "The process could not connect to Subscriber ‘Server name'."
    Clicking on start, this is the error message I get:
    The agent could not be started.
    Additional information:
    An exception while executing a Transact-SQL statement or batch.
    SQL Server Agent Error: Request to run job Server1-EDUSRV-Pubs-Server2-14 (from User Server1\Administrator) refused because the job is already running from a request by User sa.
    Change database context to 'EDUSRV'.(Microsoft SQL Server Error:22022)
    What can i do?
    Please help me.Thanks

    The error The process could not connect to Subscriber 'Server name' indicates that the Distribution Agent process account does not have enough permissions to connect to the Subscriber.
    If this is a push subscription, verify the Distribution Agent process account is db_owner in the distribution and subscription databases, is a member of the PAL, and has read permissions on the snapshot share.
    If this is a pull subscription, verify the Distribution Agent process account is db_owner in the subscription database, is a member of the PAL, and has read permissions on the snapshot share.
    The permissions required are covered in
    Replication Agent Security Model.
    If you have anymore questions, please let me know.  I hope this helps.
    Brandon Williams (blog |
    linkedin)

  • Transactional replication from a failover cluster instance to a SQL Server Express DB

    Hello,
    I have been poking around on Google trying to understand if there are any gotchas in configuring transactional replication on a instance DB of a failover cluster, to a SQL Server Express DB. Also, this client would like to replicate a set of tables between
    two instances DB's which both reside on nodes of the cluster.
    Everything I've read suggests there is no problem using transactional replication on clustered instance as long as you use a shared snapshot folder. I still have some concerns:
    1) Should the distributor need to live on a separate instance?
    2) What happens in the event of an automatic, or manual failover of a publisher, especially if the distributor does not need to live on a separate instance? I know that when a failover occurs, all jobs in progress are stopped and this seems like a recipe for
    inconsistency between the publisher and subscriber.
    There is a paramount concern, that this particular client won't have staff on hand to troubleshoot replication if there are problems, hence my hesitancy to implement a solution that relies on it.
    Thanks in advance.

    1) Should the distributor need to live on a separate instance?
    Answer: It is recommended to configure the distributor on the different server, but it also be configured on Publisher/subscriber server. (Subscriber in our case is not possible as its a Express edition)
    2) What happens in the event of an automatic, or manual failover of a publisher, especially if the distributor does not need to live on a separate instance? I know that when a failover occurs, all jobs in progress are stopped and this seems like a recipe for
    inconsistency between the publisher and subscriber. There is a paramount concern, that this particular client won't have staff on hand to troubleshoot replication if there are problems, hence my hesitancy to implement a solution that relies on it.
    Answer: If you configure both publisher and distributor on the same server and the SQL instance is failed over, the data synchronization/replication is suspended till the instance comes online. 
    Once the instance is up,all the replication jobs will start again and it will continue to synchronize the data to subscriber. No manual intervention is required.

  • Taking snapshot of oracle tables to sql server using transactional replication is taking a long time

    Hi All,
    I am trying to replicate around 200 oracle tables onto sql server using transaction replication and it taking a long time i.e the initial snapshot is taking more than 24 hrs and it still going on.
    Is there any way to replicate those these tables faster?
    Kindly help me out..
    Thanks

    Hi,
    According to the description, I know the replication is working fine. But it is very slow. 
    1. Check the CPU usage on Oracle publisher and SQL Server. This issue may due to slow client processing (Oracle performance) or Network performance issues.
    2. Based on SQL Server 2008 Books Online ‘Performance Tuning for Oracle Publishers’ (http://msdn.microsoft.com/en-us/library/ms151179(SQL.100).aspx). You can enable the transaction
    job set and follow the instructions based on
    http://msdn.microsoft.com/en-us/library/ms147884(v=sql.100).aspx.
    2. You can enable replication agent logging to check the replication behavior. You may follow these steps to collect them:
    To enable Distribution Agent verbose logging. Please follow these steps:
    a. Open SQL Server Agent on the distribution server.
    b. Under Jobs folder, find out the Distribution Agent.
    c. Right click the job and choose Properties.
    d. Select Steps tap, it should be like this:
    e. Click Run agent and click Edit button, add following scripts by the end of scripts in the command box:
            -Output C:\Temp\OUTPUTFILE.txt -Outputverboselevel 2
    f. Exit the dialogs
     For more information about the steps, please refer to:
    http://support.microsoft.com/kb/312292
    Hope the information helps.
    Tracy Cai
    TechNet Community Support

  • Transactional Replication Stalled.

    Hi,
    We are having a Transactional  replication issue where the Data does not get replicated  and the log Just keeps grawing.
    Last week we had an accidental load 15 Million records, on one of  the T replication enabled   Db's .Then  the replication stopped working i mean i look at the replication monitor it says NO transactions to replicate but we have a lot difference
    with the DATA.I  also see that the logfile file for the DB is growing.  
    1.I did a few things like stopping the log reader and restarting.
    2.Reinitialize the Snapshot ,the snapshot is taken but is not being applied  to the subscriber .No error msg that i can see.
    So had to drop the replication entirely , shrink the log  and recreate it adding few bunches of articles, creating a snapshot for them wait until they are applied and then add the other articles which worked fine for few days , and  DB replication
    stopped again and log started growing.This time it is also effecting other replications this time too.
    I am running out of options can some one plz help!
    THanks,
    Jack

    That message means the log reader agent is going through the log reading commands from it. If your ETL operation does large batch operations replication many not be able to keep up. You might need to break these batches up into smaller batches - batchsize
    works well here.
    Another thing to consider is to do your ETL operation on both sides. This works well if the only source of changes occurs from the ETL process - then you would not publish these tables.
    If not - think about use MaxCmdsInTran - you can set this to something like 10,000 which means that if you do a million row update - the log reader agent will start to read the commands out of the log for every 10,000 changes and replicate them to the subscriber
    - before the transaction is committed on the publisher.
    This is a command that you can put in your log reader agent profile so you can turn it off when the ETL process is done and replicated.
    looking for a book on SQL Server 2008 Administration?
    http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search?
    http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941

  • MultiClient Transaction is blocked for posting from S9974326432 to ABRVPDOP

    Hi All,
    I am trying to post a transaction in CJ88. I am getting the below error.
    Can someone please help me to unblock the multi client postings.
    *MultiClient Transaction is blocked for posting from S9974326432 to ABRVPDOPER.*
    *Message no. ZI164*

    Hi,
       This looks like a user defined message since it starts with 'Z'. Please check this at your end
    regards
    Waman

  • In SQL Server Transactional replication what all changes I can do on subscriber table

    In SQL Server Transactional replication what changes I can do on subscriber table
    Thanks

    Hi Ajay.G,
    According to your description, if you want to do some updates at the Subscriber, you need to note the following things.
    •If TIMESTAMP or IDENTITY columns are used, and they are replicated as their base data types, values in these columns should not be updated at the Subscriber.
    •Subscribers cannot update or insert text, ntext or image values . Instead, you could partition the text and image columns into a separate table and modify the two tables within a transaction.To update large objects at a Subscriber, use the
    data types varchar(max), nvarchar(max), varbinary(max) instead of text, ntext, and image data types, respectively.
    •Updates to unique keys (including primary keys) that generate duplicates and then they are not allowed and will be rejected because of a uniqueness violation.
    •If the Subscriber database is partitioned horizontally and there are rows in the partition that exist at the Subscriber but not at the Publisher, the Subscriber cannot update the pre-existing rows.
    For more information, see: Updatable Subscriptions for Transactional Replication
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • How to verify replication is in sync or not in transactional replication

    Hi Freinds,
    How o verify whether transactional replication is in sync.
    Thanks in advancce.
    Shashikala

    They are many ways,
    Monitoring Replication with Replication Monitor
    http://msdn.microsoft.com/en-us/library/ms151780%28v=sql.105%29.aspx
    Through Programing:
    http://msdn.microsoft.com/en-us/library/ms147874%28v=sql.105%29.aspx
    By row counts
    http://www.sqlservercentral.com/articles/Replication/70545/
    By using Validate option
    http://sqlblog.com/blogs/maria_zakourdaev/archive/2012/03/06/transactional-replication-are-you-sure-your-data-is-totally-synchronized.aspx
    Thanks,
    Thanks, Satish Kumar. Please mark as this post as answered if my anser helps you to resolves your issue :)

  • Transactional replication issue

    Hi,
    i have configured transactional replication with separate distributor server, the data copied and snapshot delivered,last 2days it is running, publisher to distributor is good, but distributor to subscriber it show heavy latency and it is showing critical
    status,when i see in the replication monitor, it shows undistributed commands 65000 records, when i see in snchronization status it showing 'deliverimg replication', when i compare to publisher and subscriber records difference is there, i checked the file
    tranfer speed 100mbps and bandwidth speed is als good....how to fix it

    Was there any issue which caused replication to stop for some time or was there any huge updates that happened at publisher..
    Take a look at this link..
    http://blogs.msdn.com/b/chrissk/archive/2009/05/25/transactional-replication-conversations.aspx
    It explains very clearly to troubleshoot this.. You might only have to look at the distribution agent latency part, as per your description...
    Apart from this, check if there are any triggers in the subscriber end which is making the subscriber updates slow..
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Transactional Replication

    Please help me..
    After configuring Transactional Replication with  a publisher, distributor , subscriber and with one database and one table . and in subscriber the database in read write mode. so, we can perform changes .   Here my question is....
    we performed some changes in table (other than primary key column) in subscriber db.  
    Then both db's have different vales ( publisher db and subscriber db). how will face this scenario? 

    Hi,
    As Hilary said, if you make changes in the publisher database, the data which you changed on the same row in the subscriber database will be replaced.
    Do you want to synchronize the changes between subscriber and publisher in both directions? If so, you need to Merge replication.
    Merge replication, like transactional replication, typically starts with a snapshot of the publication database objects and data. Subsequent data changes and schema modifications made at the Publisher and Subscribers are tracked with triggers.
    The Subscriber synchronizes with the Publisher when connected to the network and exchanges all rows that have changed between the Publisher and Subscriber since the last time synchronization occurred.
    Thanks.
    Tracy Cai
    TechNet Community Support

Maybe you are looking for

  • All of a sudden, files are brown in Lightroom, but not when exported or viewed in Bridge.

    Look at the Histogram. The color layer on top is usually gray tones (not brown). The thumbnails are white dishes on white. As a yesterday, all the images displayed correctly. I opened LR4 today to this. I have not changed or updated my OS since. I ha

  • How to install the JRE that comes with JME 3.0 to a Windows Mobile device

    From Sun's JME download page: Integration with 3rd party emulators and Windows Mobile devices The new Java ME Platform SDK architecture allows integration of 3rd party emulators and devices. Java ME Platform SDK comes with Sun's Java runtime environm

  • How to get the value in the XML tag?

    hi all, i am new to JAXP. i tried the sample program provided in the following link. it just counts the number of tags in the XML file. XML file name is given as command line argument. Now, if i want to display the value in the XML tag( say <NAME>xxx

  • Time issues

    Hi folks, We've correctly set the TIME_AGENT settings on a device and actually it seems that during the synchronization device gets the middleware time(date and time).. But, I am just wondering about time zones... 1) Initially I thought the middlewar

  • Gaming on the Mega

    I've got a Mega 180 and recently put a ATI 9600XT into it. I don't play very many games on it as I haven't had it very long. Anyways, my first attempt to play a game was Rome: Total War. Probably not the best option based on the number of problems th