I had the following error on a production database yesterday :-
ORA-04031: unable to allocate 4096 bytes of shared memory ("shared pool","BEGIN
DBMS_OUTPUT.GET_LINES(...","PL/SQL MPCODE","BAMIMA: Bam Buffer")
(Oracle 184.108.40.206.0 - Solaris 8)
I upped the size of the shared pool on the database and increased its reserved size, this seems to have solved the problem (although it could have been the database bounce that sorted it)
Today, I had exactly the same error on a different database, so I'm wondering whether there is a problem with the box (both databases are on the same box) I also noticed that the shared_pool_reserved_size parameter is supposedly obsolete on 8.1.7 anyway...
Prior to this, I'd never seen this error, and had only heard of it on development boxes where large pl/sql compilations are occurring.