AppDomain 2 (mssqlsystemresource.dbo[runtime].1) is marked for unload due to memory pressure message in SQL Server Log

Without discounting anything stated in @Shanky's answer, it should be noted that the specific AppDomain being unloaded is in the [mssqlsystemresource] database. This is an internal database that stored built-in SQL Server functionality. Other built-in functionality resides in the [master] database. Even with the server-level configuration option of "CLR Enabled" turned off, you can still see one or both of these AppDomains being loaded if you use any of the following (and there could be other internal uses of CLR that are not in this list):

  • Datatypes:
    • HierarchyID
    • Geography
    • Geometry
  • Functions:
    • FORMAT
    • TRY_CONVERT
    • TRY_PARSE
  • Features:
    • Change Data Capture
    • Dynamic Management Framework
    • Replication
    • Policy-Based Management

Run the following:

SELECT * FROM sys.dm_clr_appdomains;
SELECT * FROM sys.dm_clr_loaded_assemblies;

If no rows returned, then run the following:

SELECT FORMAT(GETDATE(), 'dd');
SELECT * FROM sys.dm_clr_appdomains;
SELECT * FROM sys.dm_clr_loaded_assemblies;

And you should now see an entry for "master.sys[runtime].xx" (where the xx is some number), but still no loaded assemblies. Now run:

DECLARE @Test [HierarchyID];
SET @Test = '/1/';
SELECT * FROM sys.dm_clr_appdomains;
SELECT * FROM sys.dm_clr_loaded_assemblies;

And you should now see a loaded assembly as well. It should be assembly_id 1 and that is the same entry in all databases: Microsoft.SqlServer.Types. This assembly shows up in all databases if you run SELECT * FROM sys.assemblies;, but it only truly lives in [master].


To start with you have SQL Server 2012 patched to SP1. I would urge you, ASAP, patch SQL Server with SQL Server 2012 SP2

There has been some prominent memory related fix in SQl Server 2012 Sp2. Please read one of the KB Article documenting OOM error fix. If you look closely the fix is also for

AppDomain 3181 () is marked for unload due to memory pressure. AppDomain 3181 () unloaded. Error: 9602, Severity: 16, State: 1.

I am not saying with surety that you might be hitting the bug mentioned as it requires more thorough analysis.

only two times . I have already written in first statement from last two days i am getting this error

You confirmed that within two days you have only seen this message twice which makes me believe that this is not much to worry about. Sometimes such messages are benign when CLR is loaded and unloaded. The problem arises when this message is frequent. This would then require more analysis.

App domain messages used to be real issue in 32 bit system due to VAS limitation. In 64 bit system App domain unloaded message is mainly due to either corrupt .NET Framework or when you have incorrectly set max server memory value. But later was true till SQL Server 2008 r2. From 2012 onwards since memory for CLR is allocated from max server memory you have set this should not be much of issue. So I suggest you also look at messages related to .NET Framework. I don't have much experience how to go ahead with .NET troubleshooting.

Do you use SQLCLR objects ?. See Various error messages logged when you use SQLCLR. There is a blog by Bob Dorr about how to proceed when you see lots of such messages in SQL Server errorlog.

With

ABC 1008 Error Microsoft-Windows-Perflib Application 10/01/2015 2:21 ABC 2 Error TeamCentral Application 9/30/2015 4:20:41 PM.

I have a hunch this is somewhere related to .NET Framework.