Bajwa Consulting Need senior Oracle DBA help? Performance tuning, Cloud migrations, GoldenGate, backup and DR. Plus 70+ free DBA scripts.
Visit bajwaconsulting.com →

Friday, April 25, 2014

Allocate run time memory for java inside database

If you want to run a  java program inside the database for which you need lots of memory during run time.  
Here is what you do (assuming that JVM is already installed inside the database)
1.        Create the function to set java memory (you need to call this from your session before program)

 
create or replace function setMaxMemorySize(num number) return number
is language java name
'oracle.aurora.vm.OracleRuntime.setMaxMemorySize(long) returns long';
 
2.       To set the memory run this from your SQL> session.
 
Select setMaxMemorySize(1024*1024*1024) from dual;

3.       Create the function to see your set java session memory.
create or replace function getMaxMemorySize return number
is language java name
'oracle.aurora.vm.OracleRuntime.getMaxMemorySize() returns long';

4.       To see your current java allocated memory run
Select getMaxMemorySize from dual;

No comments:

Post a Comment