Assemblies in SQL Server keep unloading and loading again periodically

女生的网名这么多〃 提交于 2019-12-02 00:16:37

问题


SQL Server keeps loading and unloading my Assemblies, marking them as unsafe. Any ideas why it would do that.

I am attaching the log file down below.


回答1:


The Assemblies are being unloaded due to the exact reason stated in the log: memory pressure. There is nothing specific you can do to prevent that (i.e. no option to disable this behavior). The most you can do is reduce the chances of it happening by adding more memory and/or reducing the memory consumption of your queries and/or SQLCLR objects.

The above suggestions are not meaning that there is anything currently inefficient in either your queries or .NET code, just that if you need more memory, you either need to add more or use less of it. And if you are currently using as little as possible, then you pretty much need to add more memory.

Without seeing your .NET code, it is not possible to determine if there are any areas that could be improved. However, it is more likely that the issue is outside of your SQLCLR code. You need to determine how much memory you have and where it is being used. Try looking through this Question on DBA.StackExchange:

SQL Server 2012 memory consumption outside the buffer pool

Also, SQL Server is not marking the Assembly as UNSAFE. That is simply how you have the Assembly set. You might try altering the Assembly to instead be EXTERNAL_ACCESS if it really is only doing file system access operations.



来源:https://stackoverflow.com/questions/36158390/assemblies-in-sql-server-keep-unloading-and-loading-again-periodically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!