Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm initializing SQL Server replication from a backup, by following instructions from here:

...but, when I execute

USE MyDatabase
EXEC sp_addsubscription 
@publication = MyDatabasePublication, 
@subscriber = 'AMAZONA-XXXXXXX', 
@destination_db = MyDatabase,
@sync_type = 'initialize with backup',
@backupdevicetype ='disk',
@backupdevicename = 'D:\Temp\MyDatabasepublication.bak'

I get the following error:

Msg 8115, Level 16, State 2, Procedure sp_MSsetupnosyncsubscriptionwithlsn, Line 237
Arithmetic overflow error converting expression to data type nvarchar.

Any idea why, or at least where can I find this stored procedure to troubleshoot further?

SQL Server 2012, Standard Edition.

UPDATE: It looks like that the problem is caused by the fact that database was created using SQL Server 2008R2 and then attached here. Anyway, still need a solution for it.


migration rejected from Dec 23 '14 at 10:15

This question came from our site for system and network administrators. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as unclear what you're asking by Paul White, RolandoMySQLDBA, Mark Storey-Smith, Max Vernon, Marian Dec 23 '14 at 10:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

I'm guessing that cross version initialization from backup isn't supported, but I'm checking for you. – mrdenny Apr 29 '13 at 12:54
So someone who has a similar configuration was able to test the config and it does work between SQL 2008 and SQL Server 2012. I'd recommend firing up profiler or an XEvent session on the subscriber and seeing what internal errors are being generated that aren't exposed. Might be useful info in there. – mrdenny Apr 29 '13 at 15:37
By chance, does it have billions of rows in the replicated tables? If so, it's a known bug:… – Brent Ozar Aug 6 '14 at 16:37
please check the SQL collations used for the old and new servers , also which type of replication are you indenting to create merge , transactional or snapshot??? – NiksDT101 Dec 11 '14 at 13:28

Here is something, although MS says it relates only to MS SQL Server 7.0 Standard Edition, you may wish to check it out.

This article on MSDN KB: FIX: Replication Agents May Fail With Arithmetic Overflow Errors Due to Large Latencies. It suggests that

When the delivery latencies of replication agents are high, the stored procedures that compute average delivery latency report the following error message: Error 8115 Sev 16 Arithmetic overflow error converting %ls to data type %ls.

There is a workaround provided with recomendation to install SP3 for SQL Server 7.0.


Ran into same issue today morning. I do not think this is because of the SQL 2008 r2 version database put on SQL 2012. Looks like a bug to me. Every time I dropped and recreated or attempted to recreate the subscription it was trying to use new AgentID and looks like the older versions SQL was running out of ID's. Removed replication completely and recreated publication one by one and did not run into any issues this time.

Though the article talks about 2005, this could be a bug in SQL 2012.