In the last weeks we updated two of our customers. Both got a new SQL-Server and both have now this error: "The prepared statement with handle xyz was not found."
The error occures several times throughout the day but not on all mid tier servers. If the error arises the transaction stops. In some cases the mid tier server shows this error for some minutes (not to all users) and works correct some time later. In most cases we have to restart the mid tier service.
This is what changed:
- both have now a VMWare VM (prior it was a Hardware Server)
- Windows Server changed from Win 2008 / Win 2012 to Win 2016
- SQL Server version changed from 2012 to 2017 (customer a) / 2014 to 2016 (customer b)
The error is logged in the Windows Eventlog on mid tier servers that interact with the databases and the users get a appropiate message box.
We don't see this at the SQL server. Maybe we don't look at the right log…
Do you have any hint or suggestion or advice what we can do, where we should look, what to change to get rid of this error?
Our customers use MS Dynamics NAV 2013R2.
Thanks in advance
Heinrich
Best Answer
You can potentially find the error message through Extended Events. Create and start the following session:
To make sure it is working, run a query that will definitely raise an exception:
Check the session to make sure this event populated:
Then you can periodically check the output of this query (maybe adding a filter like
AND [message] LIKE N'%prepared statement%'
). Hopefully that gives you some additional clues.