Solved

How do I troubleshoot this CLR error in SQL Server (64-bit) spatial

Posted on 2016-09-08
10
101 Views
Last Modified: 2016-09-26
I have the following query:

    Insert into PropertyTractsTemp
        Select 
    		P.field1 as field1 , 
    		P.field2 as field2, 
    		P.field3 as field3, 
    		P.field4 as field4, 
    		G.GEOID, 
    		P.field5 as field5
    	from PROPERTY_PARAMETERS P
    	join BH_EDW.dbo.REF_GEOID_GEOG G WITH(INDEX([geog_sidx]))on G.geom.STIntersects(P.GeoLocation) =1
    	where P.GEOID is null

Open in new window


This may have 1,000 to 100Mil records to match up.
Either way, the query stops and I receive this error:

    Msg 10316, Level 16, State 1, Line 3
    The app domain with specified version id (4) was unloaded due to memory pressure and could not be found.
    The statement has been terminated.

Open in new window


I'm told it's a CLR error, and it has something to do with the spatial index but no explanation on how to troubleshoot it.

Any wisdom would be greatly appreciated.
0
Comment
Question by:Evan Cutler
10 Comments
 
LVL 32

Expert Comment

by:Stefan Hoffmann
Comment Utility
1) How much memory has your server (hardware) and what are your SQL Server min memory and max memory settings?

2) What SQL Server version and bitness do you use?
0
 
LVL 9

Author Comment

by:Evan Cutler
Comment Utility
My server has 64 Gb of ram.
It is server 2012 64-bit.

Thank you.
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
My server has 64 Gb of ram.
How much is configured for SQL Server?
0
 
LVL 9

Author Comment

by:Evan Cutler
Comment Utility
64Gb is set on SQL Server.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 11

Assisted Solution

by:Nakul Vachhrajani
Nakul Vachhrajani earned 200 total points
Comment Utility
That may be one of the problem. Per best practices recommended by Microsoft, if RAM > 8GB is available on the server, a minimum of 4GB must be kept reserved for the OS. So, in this case SQL Server max memory should be 60GB (at a maximum, assuming there are no other applications or services running on the server).
0
 
LVL 45

Accepted Solution

by:
Vitor Montalvão earned 300 total points
Comment Utility
So you're not leaving nothing for the operating system.
My recommendation is that you leave a minimum of 4GB to Windows (set MSSQL max memory to 60GB). If you can double it then even better.
0
 
LVL 9

Author Comment

by:Evan Cutler
Comment Utility
ok.  trying.  please be patient.  I'm running this query on 80+ Million records.  The error doesn't appear until somewhere around 40-60M with a 1.1M / hr speed.  I'll do ask you ask, and let you know.

Thank you.
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
Evan, weekend passed. What is the point of situation today?
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
Comment Utility
The solution worked.

I appreciate your advice.
This was exactly the problem I had.
Thanks much.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now