How to reproduce ORA-04031

You are able to reproduce the ORA-04031 with shared pool depletion by pin dbms_shared_pool procedure by all the cursor on the SGA as shown below, it prohibits the release.
 

 conn / as sysdba
declare
i number;
j char (30);
sqlstr varchar2 (100);
cursor cur_pin is
select rawtohex (address) | | ',' | | to_char (hash_value)
from sys.v_ $ sql where kept_versions = 0;
rec_pin varchar2 (1000);
begin
i: = 1;
loop
loop
i: = i +1;
exit when i mod 1000 = 0;
sqlstr: = 'select''' | | i | |'' 'from dual';
execute immediate sqlstr into j;
end loop;
open cur_pin;
loop
fetch cur_pin into rec_pin;
exit when cur_pin% notfound;
dbms_shared_pool.keep (rec_pin, 'x');
end loop;
close cur_pin;
end loop;
end;
/ 
 
Source: http://www.doppo1.net/oracle/trouble/ORA-04031.html