0

Does someone know if it is possible to modify the JVM settings at runtime (e.g. -dname=value)? I need this little trick to run my Java stored procedure (oracle 10g).

1
  • Questions like this beg for a view of the bigger picture. What is the over-all objective? Maybe there is a better path.... Commented Sep 18, 2008 at 17:45

4 Answers 4

5

Assuming you mean system properties (-D...; -d picks data model) System.setProperty(...) may do what you want.

Sign up to request clarification or add additional context in comments.

2 Comments

Also, keep in mind that a few system properties won't have any effect if set at runtime.
AND keep in mind that the SecurityManager currently in charge has to agree with you changing them System properties...
1

You can use the OracleRuntime class inside your java stored procedure.

    int times = 2;
 OracleRuntime.setMaxRunspaceSize(times *OracleRuntime.getMaxRunspaceSize());
 OracleRuntime.setSessionGCThreshold(times *OracleRuntime.getSessionGCThreshold());
 OracleRuntime.setNewspaceSize(times *OracleRuntime.getNewspaceSize());
 OracleRuntime.setMaxMemorySize(times *OracleRuntime.getMaxMemorySize());
 OracleRuntime.setJavaStackSize(times *OracleRuntime.getJavaStackSize());
 OracleRuntime.setThreadStackSize(times *OracleRuntime.getThreadStackSize());

This sample code multiplies by 2 memory status in oracle jvm. Note: import oracle.aurora.vm.OracleRuntime; will be resolved on oracle jvm, found on "aurora.zip"

Comments

0

You can definitely set system properties in a Java stored procedure using System.setProperty(). But, they will only be available to the current Oracle session.

For example, if you connect to Oracle, and run a Java stored procedure that sets system properties, then disconnect from Oracle. When you next connect to Oracle, the system property will not be present. Each session with Oracle has its own pseudo-separate JVM (even though all sessions really share a single JVM).

If the account you are using for your Oracle session has sufficient rights, you can run external operating system commands including a separate, external JVM.

Comments

0

You can change a system property using System.setProperty(), but whether or not this has an effect really depends on that system property. Some properties are read statically, i.e. at class loading time, and others might cache the value in some object field.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.