Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to establish an Oracle database connection. It throws the following exception:

ORA-04031: unable to allocate 4048 bytes of shared memory 
  ("shared pool","unknown object","sga heap(1,0)","kglsim heap")

I have tried connecting the database through JDBC as well as SQL Developer, however it throws the exception in both case.

How can I fix this?

share|improve this question

migrated from Jun 24 '13 at 11:57

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Paul White, RolandoMySQLDBA, Kin, ypercubeᵀᴹ, Mark Storey-Smith Feb 25 '14 at 7:51

This question was marked as an exact duplicate of an existing question.

First Google hit on your error message gives a lot of info. – Rene Jun 24 '13 at 9:02

Oracle 10g or earlier? Probably you already restarted the database. Then you can check SQL Area: SELECT sql_text, parsing_schema_name, executions FROM v$sqlarea ORDER BY executions desc; If there are tens of thousands SQLs with 1 execution - you are having shared pool fragmentation. To avoid future exceptions either rewrite SQLs (usually not using binding variables causes SQL area bloat) or upgrade to 11g. It better handles shared pool fragmentation.

share|improve this answer