This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes Oracle Error: ORA-04031: unable to allocate xxx bytes of shared memory ( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle Error: ORA-04031: unable to allocate xxx bytes of shared memory ("","","")" Watch "Oracle Error: ORA-04031: unable to allocate xxx bytes of shared memory ("","","")" New topic
Author

Oracle Error: ORA-04031: unable to allocate xxx bytes of shared memory ("","","")

Martin Lovell
Greenhorn

Joined: Mar 10, 2003
Posts: 5
I'm working on a web app using Tomcat and Oracle9i on Linux with the thin JDBC drivers.
Occasionally a query will fail and with an SQLException with the message:
ORA-04031: unable to allocate xxx bytes of shared memory ("","","").
The system is really not under much stress when it occurs, but if it is not random, is seems to sometimes be when there are a few complex queries done in a row.
When searching for information about the error, there is some vague information that leads me to believe it might be related to using Statements with dynamic SQL in a few places rather than PreparedStatements. Some information pointed to sorting, and I do use some queries with a long "order by" (6 fields). Some say to increase shared memory in the Oracle configuration, but I have a feeling that would just postpone the problem.
Has anyone run into this problem? Will using PreparedStatements exclusively solve the problem? Could it be related to sorting?
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Where I used to work, we had a web application that used to throw this error quite regularly. Particularly when the site was experiencing heavy load.

As I recall, it was finally tracked down to a memory leak within Oracle itself! Not the driver, but Oracle.

You might enquire on OTN or if you have enough pull, with a Oracle rep. I'm not even sure if it was Oracle that fessed up in the end, or the vendor whose product we were using on Oracle.
Kirtikumar Puthran
Ranch Hand

Joined: Mar 04, 2003
Posts: 37
We used to get this error on Oracle 8i particularly when our application experienced heavy traffic. Also, there were some procedures which used to do a lot of processing.
Ultimately, we solved this by increasing the initialisation parameter "Shared_Pool_Size".
But, I don't really know, why this occured in the first place. Can anyone throw more light on this ???
Rgds,
Kirtikumar Puthran


Regards,<br />Kirti
 
GeeCON Prague 2014
 
subject: Oracle Error: ORA-04031: unable to allocate xxx bytes of shared memory ("","","")