--> Cursor for fetching all publications in all databases DECLARE curPublishedDatabases CURSOR LOCAL FAST_FORWARD FOR SELECT [name] FROM sys.databases WHERE is_published > 0
OPEN curPublishedDatabases FETCH curPublishedDatabases INTO @PublishedDBName WHILE @@FETCH_STATUS = 0 BEGIN SET @SQL = N'SELECT ''' + @PublishedDBName + ''', [name] FROM ' + @PublishedDBName + '.dbo.syspublications' INSERT INTO @Publications (PublicationDatabase, PublicationName) EXEC sp_executesql @SQL
FETCH NEXT FROM curPublishedDatabases INTO @PublishedDBName END
CLOSE curPublishedDatabases DEALLOCATE curPublishedDatabases
--> Cursor for posting tracer tokens DECLARE curPublications CURSOR LOCAL FAST_FORWARD FOR SELECT PublicationPK, PublicationDatabase, PublicationName FROM @Publications
OPEN curPublications FETCH curPublications INTO @PublicationPK, @PublicationDatabase, @PublicationName WHILE @@FETCH_STATUS = 0 BEGIN SET @Parmameters = N'@PublicationName varchar(200), @TracerTokenID_OUT int OUTPUT'; SET @SQL = N'EXEC ' + @PublicationDatabase + '.sys.sp_posttracertoken @publication = @PublicationName, @tracer_token_id = @TracerTokenID_OUT OUTPUT' EXEC sp_executesql @SQL, @Parmameters, @PublicationName = @PublicationName, @TracerTokenID_OUT = @TracerTokenID OUTPUT
UPDATE @Publications SET TracerTokenID = @TracerTokenID, TracerTokenPostTime = GETDATE() WHERE PublicationPK = @PublicationPK
FETCH NEXT FROM curPublications INTO @PublicationPK, @PublicationDatabase, @PublicationName END CLOSE curPublications DEALLOCATE curPublications
--> Wait two minutes for all tokens to be commited at all subscribers WAITFOR DELAY '000:02:00.000'
--> Then check the results for each posted token DECLARE curTokens CURSOR LOCAL FAST_FORWARD FOR SELECT PublicationPK, PublicationDatabase, PublicationName, TracerTokenID FROM @Publications
OPEN curTokens FETCH curTokens INTO @PublicationPK, @PublicationDatabase, @PublicationName, @TracerTokenID WHILE @@FETCH_STATUS = 0 BEGIN --> Insert token history for each token SET @SQL = N'EXEC ' + @PublicationDatabase + '.dbo.sp_helptracertokenhistory @publication = ''' + @PublicationName + ''', @tracer_id = ' + CAST(@TracerTokenID AS VARCHAR(50)) + '' INSERT INTO @Latency (DistributorLatency, Subscriber, SubscriberDB, SubscriberLatency, OverallLatency) EXEC sp_executesql @SQL
--> Make sure that the PublicationPK is added to the token history UPDATE @Latency SET PublicationPK = @PublicationPK WHERE PublicationPK IS NULL
--> Clean up the tracer token SET @SQL = N'EXEC ' + @PublicationDatabase + '.sys.sp_deletetracertokenhistory @publication = ''' + @PublicationName + ''', @tracer_id = ' + CAST(@TracerTokenID AS VARCHAR(50)) + '' EXEC sp_executesql @SQL
FETCH NEXT FROM curTokens INTO @PublicationPK, @PublicationDatabase, @PublicationName, @TracerTokenID END CLOSE curTokens DEALLOCATE curTokens
SELECT b.PublicationDatabase, b.PublicationName, a.Subscriber, a.SubscriberDB, a.OverallLatency, b.TracerTokenPostTime FROM @Latency a INNER JOIN @Publications b ON a.PublicationPK = b.PublicationPK
I am trying some replication sample.I create a table with thousands of records in the publisher side. as I create a subscription(the subscription database is on a remote machine), the whole table is created on the remote database.
I wanted to measure the performence as: 1. how much time was taken in filling the whole table in the subscriber side? 2. If i insert some 10000 records on publisher side, I want to measure, how much time was taken in inserting the same records on the subscriber?
How do I measure this ? Can I use some Log reader stuff.
I have setup transactional replication everything on one box. later(two or three weeks later), Replication monitor is show red X Under my publishers (publications is disconnected). this is SQL2005.
I have a transactional replication that was running fine for about few months, but eversince there was a massive update of records at the publisher site and when I use the replication monitor, i notice Status: Performace Critical, Subscription:[localservername]:[Orders_Repl], Performance:Critical, Latency:03:34:47.
I was thinking of redoing the whole replication but before i am about to proceed. Can you guys explained what happen and what does it meant when Latency:03:34:47. I don't remember seeing a Latency:03:34:47.
I am hoping to solve this critical performance issue hope you guys can help. Thanks
We have setup up transactional replication with dedicated distributor in SQL Server 2005 environment. I have noticed that during particular time of the day latency is increasing dramatically. I have been checking Tracer Tokens and Total latency during that time is around 30-40 min (both publisher to distributor and distributor to subscriber is taking much longer that normal). Normally, it is less than 10 sec. I was wondering if there is a way to pinpoint exact cause of the latency. This is pull subscription. I would appreciate if someone can share (or point to the right direction) best practice on transactional replication setup/maintenance. My understanding is that only committed transactions are replicated, correct? I checked database on publisher and didn't see any outstanding long running transaction.
I have been working on a project to evaluate transactional replication in SQL Server 2005 to find out if it will be suitable to provide real time reporting without impacting the primary database server. Thus far I have not seen latency better than several seconds replicating a change to a table or by utilizing the "tracer tokens" troubleshooting functionality. It usually takes a couple seconds from the publisher to the distributor and a couple more from the distributor to the subscriber.
I guess my question is actually whether it is possible to achieve sub-second (milliseconds) latency for transactional replication under any circumstances. Someone on another forum told me it was not, so I thought I would ask a separate community to confirm. Regarding the hardware, the latency on ping is less than 1ms between the servers and the servers themselves are decently powered quad processor boxes w/ 4GB of ram each. It seems to have the same latency of 3-5 seconds regardless of whether I publish a single table or all of the tables in the database. I currently have it configured with the publisher on one server and the distributor/subscriber on the second with the log reader and distributor agents set to run continuously. If it is possible, please recommend configuration of the agents or the topology of the PDS to achieve this. Thanks in advance for any insight you provide.
Hi Everybody, Can anybody tell me how to get the number of commands delivered per minute in case of Merge Replication with Publisher and subscribers. This way, we can be sure that even if there is a latency (due to high volume transaction processing), replication is in good shape and things will catch up soon. Also if there are any other similar measures which can be monitored to make sure that replication is going on fine, it would be great
Please let me know If anyone has got information on same.
I have multiple questions and would appreciate any suggestions in resolving them. I'm a novice to these issues.
1) First of all, what is the exact command to setup the trunc. log on chkpt. option on for a transactional log of a SQL Server 2000 database? Is this option on by default? I have noticed for one of the databases I'm managing that the transaction log was over 12 GB, while the db was only 425 MB.
2) How's it possible to run a DBCC TRACEON to see the content of the transaction log to see if we are having any issues with any uncommitted transactions, i.e. updates, inserts, and/or deletes.
3) What are the commands to truncate inactive transactions and increasing the readbatchsize?
4) lastly, how do I validate transactional replication via checksum and find valid latency between a small number of changes that need to be committed between publisher and subscriber.
I have 2 servers; 1 in the head office and the 2nd at a remote location connected over a satellite. The satellite connection has typical latency and bandwidth. 2 mb down and 128kb up. Latency is average of 700ms.
Both servers have plenty of processing power and RAM and are very underutilized.
I have 1 push publication at the publisher at the remote location. The publication has 1 article. The table that is contained in the article only grows; ie inserts are the only statements applied, no updates or deletes. The table grows by 5 inserts every second(approximate). the table has 5 columns. none of the columns are blobs etc. An ID field, 1 datetime, 2 integers and 1 float column.
I have the agents set for continuous with a 2 second polling interval.
I am aware of the following command parameters for the agents but not sure which way to go to maximize the throughput of the data.
The subscriber table also has an insert after trigger to update another small table with the current value. Under normal network conditions, the trigger works great. Over the sat connection with high latency, the smaller target table seems to get a lock placed on it. I can only guess that the lock is from the inserts and perhaps a large number of inserts per transaction?
Under normal network conditions, the latency between publisher - distribution - subsciber is about 4 seconds.
What would be good command parameter settings for the agents to compensate for the latency?
I'm experiencing some very odd behavior in Enterprise Manager.I have a process that performs the following:1.) Restores a published database from Server A onto Server B. Thedatabasesare identical and they are both published.2.) I run a script that then deletes the subscriptions to thepublication onServer B. I do this via SP_DROPSUBSCRIPTION.3.) I run a script that then deletes the publication. I do this viaSP_DROPPUBLICATION.4.) Deletes the distribution database.5.) Deletes the old jobs.6.) Creates the publication from pregenerated scripts.7.) Adds the subscriber.8.) Adds the subscription.9.) Generates the snapshot and applies it.What's happening is that I'm seeing the job name that's assigned to thedistribution job increment by 1 each time this process is run. Also,I'mseeing ten instances of the publication showing up in the tree view.Everything appears to be rtunning just fine, transactions beingreplicated,etc. I'm just wondering is there something I'm missing in my steps.Plus,after two or three months of this, might not look so good having 90publications showing up in the tree view.Thanks!
There seems to be a problem with the replication monitor correctly telling you the progress of applying database schema.
Here is my setup:
Running SQL 2005 SP2. Publishing with merge replication (push) via a VPN. Approx 100 tables with lots of filtering, using data partitions filtered on host_name()
When you create and initialize a new subscription if you go to the Replication Monitor and open the Sync History window for that new subscription. You will see that it is setting up the schema in the subscriber but it does not update the status at the bottom of the window it just continually says:
If it helps you can see an image of this below you will notice that it is already 15 minutes into a process that will probibly take 2 hours but it still says 0% complete.
If you require any further info or have any suggestions as to why this is not a bug (just me being dumb) please let me know.
You can see an image of this problem here: https://applications.ccusa.com/2/images/snychistory.jpg
I have to write a little vb6 app to monitor sql 2000 replication. The app must run on the same desktop as the subscriber.
I've tried the samples that comes with sql (replsampl) but that is to do the replication, I need to just monitor replication that was set up in sql 2000.
With monitor I mean to show a red light when replication is busy, so that the user doesn't disconnect from the network while replication is in progress.
I have developed a smart device application using SqlServerCE that replicates data to the backend server. I need to provide to the user a status of this replication process. I read about the "MergeSubscriberMonitor" in SQL Server but can't find it in SqlServerCe. Is this possible? Can someone please point me in the right direction?
We have some mobile devices that are setup to replicate with our sql 2005 server via web sync. It seems that the devices are added multiple times within replication monitor. Is there a way to purge the bogus items. For example we have a mobile unit labeled as Device12 we have it listed under the subscriptions 5x. I would like to purge four of them as they are not currently being the replicated one.
When Replication monitor shows an error icon, I removed all the publication jobs completedly. After I reconfigured publishing, subscriber,Distribution, why the replication monitor still shows an error icon even though there is no replication job scheduled?
I have a wired situation..!I set up transactional replication on one of my development server (SQL2000 Dev Edition with sp4).It is running fine without any issues and all of a sudden, i noticed inmy repication monitor tab under Publisher where I usually see thepublication is empty now.I do see the snapshot agent, log reader and distribution agent under myagents inside the replication Monitor. But its usefull to see all 3agents in one window under publisher before. What happend? Is there anyway to get that inside that monitor? Has someone encountered thissitation before? Please advise....After that I tried to create a new set of replication on differentdatabase on the same server and i dont see those either underReplication Monitor - Publishers....All it says is (No Items)....I would appreciate any help to correct this issue... Thanks in advance..
We have a database on the live server which powers a website. Then our client has a copy of the database at their office. Their is Merge replication set up between the two running every half a hour.
Now they want to be able to look at the merge replication history. With my little knowledge, I believe that the place to get this data from is the distribution database on the publishing machine which is the live server. Now for obvious reasons we cannot replicate the distrubution database to their side so we need to come up with some way of giving them the data. They also want a history of replication. So the way I was thinking of fixing it was to have a job that copies some of the last days data from the distrubution database onto the main database and add that table to the replication so they got it every day. Also writing a ASP page so they can look at the last days data straight from the distrubution database.
Here are my questions:
Question 1: How long does the replication store history for?
Question 2: Is thier any simpler way of allowing them to see the replication history?
Question 3: Are their any other things I should be worried about?
when I look into the replication monitor of our sql 2005 server I see a lot of subscriptions that are no longer used.
I wrote a program for a smartphone using the sql compact edition (sql ce db). Just in case there are some problems i do not want to mentioned here, i use an preconfigured sql ce db, reinitialize it and afterwards synchronize it. Then the old subscription is no longer used.
The problem is that up to now I did find a way to delete this unused subscriptions at the publisher database. As a hint: there is no way to get access to the old sql ce db for removement issues. The dbs are gone.
So, is there a way to solve my problem?
We are using sql 2005 server as publisher and are using merge replication.
I have setup sql 2005 transactional replication system with three machines (publisher, distributor and subscriber). Couple weeks later, publisher with publications is disconnected from replication monitor (under My Publishers €“ show X on the publisher machine name). I didn€™t change any things. Can you help for this please?
Both pcs are connected to each other via the internet as i am using Aliases ,they can both access and see each other using SQL Auth.
I want to implement Merge Replication to Synchronize TestDB ,
I have NO DOMAIN connnecting them.
I Created a new publication ,under security i asked the agent to use the Sa account to connect
When launching the rep monitor i get the following error:
"Replication Monitor could not connect to Distributor 'laptop'."
"Login failed for user ''. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)"
Both Publisher and Distributer are on my Laptop ,why cant they connect to each other?
Another Question : could i implement Traditional Merge replication to synchronize my DBs or do i need to configure Web Synch in Merge rep to enable connecting via the internet?!
To monitor the status of replication in SQL 2000 we insert the resuts of sp_MShelp_replication_status into a temp table and review the status. In SQL 2005 this stored procedure has changed and now does it's own insert into execute command. Since insert execute commands can not be nested we must find another way to programically monitor replication using TSQL. We could call sys.sp_replmonitorhelppublisherhelper but we can't seem to find it in the distribution database. It must be hidden somehow. Any ideas?
We're testen a simple lan SQL 2005 SP2 one way transactional replication config. Data is replicated ok, but in the Replication Monitor we found some strange issues:
- The subscription is giving a latency warning. When we insert a tracer tocken the total latency is 5 secs. Is there a way to alter the warning level for a subscription??
- Undistributed Commands tab Changes do arrive at the client, but the distributed commands counter shows an increase in value for every (as far as we can tel succesfull) change
If we do insert a tracer token -wich arrives within 5secs.- the the counter is reset to zero.
Hi guys does anyone know of a quick solution to remove the replication monitor icon within Enterprise Manager please I have tried all sorts but it is still appearing and starting to irritate me as I don't use replication on this server. cheers
The client production server CPU starts thrashing. Task manager indicates that SQL server is gobbling CPU cycles. Having a look at the replication monitor, it is obvious that indivual synchronisations to the mobile devices are taking significantly longer expected.
Observing an indivual synchronisation attempt, the Upload changes to Publisher rows are very quickly resolved.
The Download changes to Subscriber seems to take up a very long time.
Along the way, the estimated completion does a few interesting things, like going from 100% complete with no estimated time to complete, back to seomthing like 77% with 2 minutes left to complete.
This sort of behaviour occurs when there are only a hundred rows to download.
Synchronisations for minimal amounts of data suddenly taking anywhere from 2 to 15 minutes. Totally unacceptable form the client perspective but seems that 2005 behaves quite different from 2000 and the tricks are yet to reveal themselves.
Note - It is a server hardware issue as there is in excess of 3 GB ram, the database is on a SAN and there are 4 3Ghz CPUS in operation.
Any possible help appreciated as this issue is beginning to drag on.
We have a publisher that got red-crossed(Run to problem). I decide to remove and recreate it. However, after remove it, the publisher still stays in Replication Monitor. The remain thing has no distributor and logreader, but only snapshot agent. When to check the property of the agent, we got a error message basically say the job does not exist, which makes sense.
Now, it does not show up in any places, except Replication Monitor. Well, it cannot be removed from Replication Monitor. Can any one tell us how to clear it from Replication Monitor?
Thank you.
More Infor: The replication was set up on 2000.(2000 pub, 2000 dis and 2000 sub) with 2005 Management Studio, and the publication was removed with 2005 Management Studio.
We are using SQL Server 2005 64 bit standard edition on both ends (subscriber distributor and publisher ) publisher is its own distributor. Now i want to investigate the replication performance and delayed in replication for this purpose i found that tracer tokens can be settedup but when i open replication monitor but unable to see tracer token tab.
Plz let me know something.why i am unable to see this tab, is there some problem of rights ? , permission, or installtion.
Have two servers, one production server and one backup server. Both are Windows 2003 Server having SQL Server 2000 installed.
I have created replication on these servers using a wizard. I then generated SQL scripts to delete and create the replication. These scripts work well, but to test to remove the replication on both servers I used sp_removedbreplication 'DBNAME' on both servers. Not all were removed and on Replication Monitor and sub items plus Log Reader Agent there were added an icon, a red 'X' as in error. The replication seems to work.
Does anyone have any idea on why this happened and what I can do about it. It is not very nice to have errors in replication on a customers servers.
During an upgrade, we had problems with PK errors on sp_MSget_repl_commands. I recreated the SP with the varbinary characteristic as we have seen in many posts and it was sucessful in starting. However, the sp now appears as a 'user' sp, not a 'system' sp, however I an not sure that is a real issue.
The problem I am seeing is that none of the agents are appearing in replication monitor under their agent folders. Replication appears to be working fine and the publications are showing on the distributor in the Replication Monitor - Publication folder under the appropriate publisher. But all of the agent specific folders (i.e. Snapshot agent, distribution agent, etc) are empty.
Another interesting point, is that if replication fails, the failure 'X' shows up on the Agents folder as well as the publisher, but again, no sign of the agent in the folder.
I Want to monitor Replication count of object (Table )if it is not equal to Publication (Table ) and subscriber (Table ), It have to send mail with count difference.
I set up a sql server 2005 database as publisher for about 50 sql mobile subscriptions. Yet in the replication monitor windows, it shows in subscription columns is 26549. Does it mean I have 26549 subsriptions or it means 26549 synchronizations?