Solved

SQL Server 2008 Out of Memory

Posted on 2013-05-28
10
281 Views
Last Modified: 2013-05-29
Hi..
I'm running a large stored procedure on SQL 2008 64bit and I get the following error
. Error message is: Exception of type 'System.OutOfMemoryException' was thrown.
It uses a cursor and the server has 16GB of memory.
Any ideas?
thanks
0
Comment
Question by:JElster
  • 6
  • 4
10 Comments
 
LVL 15

Expert Comment

by:David L. Hansen
Comment Utility
That seems like an awful lot of memory to get eaten up.  I suspect the stored procedure is not running correctly.
0
 
LVL 1

Author Comment

by:JElster
Comment Utility
The database has 100M rows. .The SP updates a table with 10M.
0
 
LVL 15

Expert Comment

by:David L. Hansen
Comment Utility
The stored procedure is updating 10 million rows??
0
 
LVL 1

Author Comment

by:JElster
Comment Utility
yes
0
 
LVL 15

Accepted Solution

by:
David L. Hansen earned 400 total points
Comment Utility
I'd break up the procedure into multiple ones.  So if your procedure handled all customers, for example, I'd have one procedure to handle last_names from A to F then one from G to L and so on.  Is this doable in your situation?  This is just off the top of my head.
0
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)

 
LVL 15

Expert Comment

by:David L. Hansen
Comment Utility
Hope that helps.  By the way, you could still accomplish all of this through one procedure (just have it use the other in whatever sequence makes the most sense.
0
 
LVL 1

Author Comment

by:JElster
Comment Utility
Must be some SQL settings to avoid this..
0
 
LVL 15

Expert Comment

by:David L. Hansen
Comment Utility
Perhaps, I'll look into it.  
BTW, are you using transactions in the script?  Transactions with rollbacks being held as a possible option, greatly impacts the amount of memory needed to accomplish such tasks.
0
 
LVL 1

Author Comment

by:JElster
Comment Utility
No tranascations
0
 
LVL 15

Expert Comment

by:David L. Hansen
Comment Utility
Here are the best tips I can give you as far as settings are concerned:
http://blog.sqlauthority.com/2010/02/16/sql-server-stored-procedure-optimization-tips-best-practices/
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

14 Experts available now in Live!

Get 1:1 Help Now