Why am I receiving the error message: ORA-04031: unable to allocate bytes of shared memory?
An example of the error message "ORA-04031: unable to allocate bytes of shared memory" is shown in the screenshot below:
This error message is caused because more shared memory is needed than was allocated in the shared pool. In the screenshot above it is the "large pool" that needs more memory than it has been allocated.
One way to resolve this error would be to allocate more memory to the relevant pool from the shared pool. However if the shared pool is out of memory, you can either use the "dbms_shared_pool" package to pin large packages, reduce your use of shared memory, or increase the amount of available shared memory by increasing the value of the INIT.ORA parameters "shared_pool_reserved_size" and "shared_pool_size". If the large pool is out of memory as in the screenshot above, you could increase the INIT.ORA parameter "large_pool_size".
A better way to resolve this however would be to use the functionality that exists within Oracle 10g. This is called Automatic Shared Memory Management (ASMM) which automatically sizes many of the memory pools while the database is running, allocating and de-allocating memory as needed.
following link describes the ASMM functionality and how to go about
Oracle 10g ASMM