我的系统是java1.4+tomcat5.0,每隔半个月就会出现ORA-04031: unable to allocate 4200 bytes of shared memory 这种提示,重启一下数据库就好了,怎样才能根治?

解决方案 »

  1.   

    1.提高sql语句的重用率
    2.定期重整shared pool 空间,使用下面的语句
    alter system flush shared_pool;
      

  2.   

    如上所说,加大共享池能解决
    但是你的应用是java1.4+tomcat5.0,所以不能光考虑oracle一方的问题
    要看看java1.4+tomcat5.0对数据库的连接是否及时断开,SQL语句时候合理,内存是否及时释放
    虽然JAVA说内存会及时释放的,俺看不一定。。
      

  3.   

    楼主,你去找找绑定变量的资料来看吧!
    这个才是治本之道!
    ORA-04031: unable to allocate string bytes of shared memory ("string","string","string","string") 
    Cause: More shared memory is needed than was allocated in the shared pool.Action: If the shared pool is out of memory, 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, increase the INIT.ORA parameter "large_pool_size"