Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







dbms_java Tips

Oracle Database Tips by Donald BurlesonSeptember 13, 2015

Java  has been in existence for more than a decade and is one of the more powerful development languages.  Oracle, for instance, has developed many tools utilizing Java.


Oracle 11g comes with a lot of improvements in the Java language such as having the best native Java compiles, supporting Content Repository API for Java, having scalable Java with the automatic creation of 100% native Java code and more.


The dbms_java  package is available when Oracle JVM is installed, which has been supported since Oracle 8i. This package lets developers use Java to create, store and deploy code within Oracle databases. we will highlight some of the more common uses of the dbms_java package. Functions and procedures will be demonstrated, and a brief description will be noted about each command.


The first example grants execute privileges to all files located in the /bin directory to the pkg user.


<  Code  7.12 - dbms_java.sql

conn sys@ora11g as sysdba


Connected to Oracle 11g Enterprise Edition Release

conn / as sysdba


--Grant permission to execute any command on /bin directory to pkg user
      grantee => 'pkg',
      permission_type => '',
      permission_name => '/bin/*',
      permission_action => 'execute');

--Check the permission granted by consulting dba_java_policy view
col "kind" for a8
col "grantee"  for a10
col "type" for a25
col "name" for a10
col "action" for a10
   kind "kind",
   grantee "grantee",
   type_name "type",
   name "name" ,
   action "action"


Kind     Grantee    Type                      Name       Action

-------- ---------- ------------------------- ---------- ----------

grant    pkg    /bin/*     execute


To change any native compiler option for a user session, use the set_native_compile_option procedure followed by the native_compile_options function to get the results.


--Change a native compile option for user session
      optionName => 'optimizerLoopPagedConversion',
      value => 'false');

--Get current native compile options

--Compile a java class
--Find the java to be compiled
   name like 'java/io/FilePermissionCollection';
--Compile it using compile_class function!  
      classname => 'java/io/FilePermissionCollection')


In order to get the full name of a Java object, use the longname function as shown in the next example:


--Long object name
   dbms_java.longname (object_name)
   object_type ='java class'
   status = 'valid'
and object_name like '%DelegateInvocationH%';


With more than 100 procedures and functions, the dbms_java package cannot be fully covered in this book. Most of the procedures and functions are executed by GUI or other programs and the user usually will not need to run them manually.  This being said, it is wise to have at least a basic understanding of it and be familiar with how they are working within the database.

Inside the DBMS Packages

The DBMS packages form the foundation of Oracle DBA functionality.  Now, Paulo Portugal writes a landmark book Advanced Oracle DBMS Packages:  The Definitive Reference

This is a must-have book complete with a code depot of working examples for all of the major DBMS packages.  Order directly from Rampant and save 30%. 



Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster