Sunday, December 6, 2009

Loadjava

Loadjava
How to run:
There are 2 ways to invoke loadjava.
Method 1
The first way (and easiest) is by invoking the loadjava executable located in the DB Tier oracle home. However, in certain cases, specially when loading applications jar or class files, the DB Tier might not have access to the application classes. In this case, you either FTP the jar/class file to the DB tier, or use method 2.
Syntax for this method:
[orar12@ap9056pc ~]$ $ORACLE_HOME/bin/loadjava
loadjava: Usage: loadjava [-definer] [-encoding encoding] [-force] [-genmissing] [-genmissingjar jar] 
[-grant grants] [-help] [-nousage] [-noverify] [-oci8] [-order] [-resolve] [-resolver resolver] 
[-schema schema] [-synonym] [-thin] [-tableschema schema] [-user user/password@database] 
[-verbose] classes..jars..resources..properties...
Usually:
loadjava -u apps/@ -force -resolve -verbose 
Note that in this case, the connect string can be specified as a standard TNS alias as loadjava uses the OCI jdbc drivers to connect to the database.
Method 2
This way can be invoked as the applmgr user. The syntax for this method is
[applmgr@ap9056pc java]$ java -ms128m -mx256m oracle.aurora.server.tools.loadjava.LoadJavaMain
loadjava: Usage: loadjava [-definer] [-encoding encoding] [-force] [-grant grants] [-help] [-noverify] 
[-oci8] [-order] [-resolve] [-resolver resolver] [-schema schema] [-synonym] [-thin] 
[-user user/password@database] [-verbose] classes..jars..resources..properties...
Usually:
- Sample 1: using THIN JDBC drivers
java -ms128m -mx256m oracle.aurora.server.tools.loadjava.LoadJavaMain \
-force -thin -verbose -resolve -user "APPS/@::" \

- Sample 2: using OCI JDBC drivers
java -ms128m -mx256m oracle.aurora.server.tools.loadjava.LoadJavaMain \
-force -verbose -resolve -user "APPS/@" \

For sample 1, you need to know the username, password, hostname, port where the listener is listening and the instance name. For sample 2, you only need to know the username, password and the TNS alias for the instance you desire to connect to. For clarification purposes, it doesn’t make a difference on the end result which method you use.

Dropjava example
java -ms128m -mx256m oracle.aurora.server.tools.loadjava.DropJavaMain -thin -verbose \
-user "APPS/@::" 
NOTE: Never drop any java object from the database unless instructed by the development team that owns the class. This entry exists just for documentation completion purposes.

No comments: