Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

Oracle

Posted Apr 29, 2003

Getting Control of the Oracle Java Virtual Machine - Page 7

By Marin Komadina

Java Backup

A good backup is always a DBA's best friend, especially when the database has a large number of Java Classes, Java Resources, Java Grants and Policies. No special tool is provided by Oracle to handle the Java objects backup, you'll need to use standard utilities.

A Java Classes Backup is made by a full database export without rows.

Example of a full database export:

% exp userid=system full=y ROWS=N file=full_export_norows.dmp 

To restore Java Classes from previously taken backup:

 
% imp userid=system INGORE=Y full=y

Java Privileges Backup is simply a Java grants and policies extraction from the database. Here is the script to extract the Java information (Oracle Metalink, DocID: 183825):

spool setjvmprivs.sql 
set echo off 
set feedback off 
set heading off 
set linesize 80 
set pagesize 1000 
column stmt format a70 word_wrapped 
select 'exec '||stmt 
from (select seq, 'dbms_java.grant_permission('''||grantee||''','''|| 
             type_schema||':'||type_name||''','''||name||''','''||action|| 
             ''');' stmt 
      from dba_java_policy 
      where grantee not in ('JAVADEBUGPRIV', 'JAVASYSPRIV', 'JAVAUSERPRIV', 
                         'JAVA_ADMIN', 'JAVA_DEPLOY', 'SYS', 'PUBLIC') and 
            type_name!='oracle.aurora.rdbms.security.PolicyTablePermission' 
      union all 
      select seq,'dbms_java.grant_policy_permission('''||a.grantee||''','''|| 
             u.name||''','''||permition||''','''||action||''');' stmt 
      from sys.user$ u, 
           (select seq, grantee, 
                   to_number(substr(name,1,instr(name,':')-1)) userid, 
                   substr(name,instr(name,':')+1,instr(name,'#') - 
                          instr(name,':')-1) permition, 
                   substr(name,instr(name,'#')+1 ) action 
            from dba_java_policy 
            where grantee not in ('JAVADEBUGPRIV', 'JAVASYSPRIV', 
                                  'JAVAUSERPRIV', 'JAVA_ADMIN', 'JAVA_DEPLOY', 
                                  'SYS', 'PUBLIC') and 
                  type_name = 
                      'oracle.aurora.rdbms.security.PolicyTablePermission') a 
      where u.user#=userid) order by seq; 
column stmt clear 
set pagesize 24 
set heading on 
spool off 

Output from that script should produce Java recreation commands like:

exec dbms_java.grant_permission('SCOTT','SYS:java.io.FilePermission','temp\output.txt','read,write);

Conclusion

Recent surveys showed interesting answers to the question of 'why use Java'.

Some said because Java developers are easier to find than other developers, others are of the opinion that the development time is reduced due to Java code's simplicity and accessibility. Most of them believe that Java's performance will be comparable to other natively compiled languages in the future.

Once loaded, the Java option will need attention from a DBA.

When it is no longer needed, it should be removed, rather than just sizing down the Java pool.

» See All Articles by Columnist Marin Komadina



Oracle Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
Oracle Forum
Topic By Replies Updated
Oracle Data Mining: Classification jan.hasller 0 July 5th, 07:19 AM
Find duplicates - Unique IDs Lava 5 July 2nd, 08:30 AM
no matching unique or primary key rcanter 1 April 25th, 12:32 PM
Update values of one table based on condition of values in other table using Trigger Gladiator 3 February 29th, 06:01 PM