How to enable oracle xa support?

Hi ,

I need to enable oracle xa support for my database. I think that for that ,at the db side 2 scripts need to be run right?

ie. initjvm.sql and initxa.sql. what is the order here- i mean which script to run first? also does this require any restart of oracle server?

awaiting to know..

Who is Participating?
MohanKNairConnect With a Mentor Commented:
Minimal and recommended JVM related database memory parameters:

  shared_pool_size >= 60Mb       ->   recommended 65 MB
  java_pool_size>= 30Mb             ->   recommended 50 MB

  java_soft_sessionspace_limit            default 1 MB is used,  
  java_max_sessionspace_size            default of 4GB is used

Execute initjvm.sql script as sysdba

To determine Java status for the database we can query v$option dynamic view:

SQL > Select * from v$option;
SQL> SELECT count(*) FROM dba_objects  WHERE object_type LIKE '%JAVA%';
SQL> select count(*), owner from all_objects where object_type like '%JAVA%' group by owner;
SQL>  Describe DBMS_JAVA

Include ORACLE_HOME/jdbc/lib/ in the classpath and this will expose all client side XA classes.

Load the following Java class using loadjava

Run initxa.sql
Run the following as sysdba

Nirav_a_shahAuthor Commented:
Assuming that jvm is already installed, does running initjvm.sql cause any problems?

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

You can verify that Oracle JVM is correctly installed by running SQL*Plus, connecting as SYSDBA, and issuing the following query

SQL> select version, status from dba_registry where comp_id='JAVAVM';

Ensure that the version is correct and the status is VALID. If it is correctly installed then there is no need to install again.
Nirav_a_shahAuthor Commented:

Thanks a lot! Running your query, I get no rows returned:
SQL>  select version, status from dba_registry where comp_id='JAVAVM';

no rows selected

Does this mean that in addition to initjvm.sql I need to run some other scripts as well to set up the oracle jvm?

Did you install JVM?

See the links
How to Install Java on Oracle 8i

Oracle/Java FAQ

Java Installation and Configuration
Nirav_a_shahAuthor Commented:

Sorry I must be sounding dumb..but since this is an environment where 30 guys are working..I wanted to be sure..

the question is:
given the details, to do the xa set up(and set up the jvm etc), do i need to run only initjvm.sql and initxa.sql or do i need to run other scripts too..

in this area I am new hence I am not risking any of my vague could ou please help me again with answer to my above question. (is only initjvm.sql and initxa.sql needed to run or are other scripts needed too..)

Can not thank enough..
Nirav_a_shahAuthor Commented:

Thanks a ton! I am not sure on how to set the classpath..and using the loadjava.. we only have the path variable to set the classpath?
should it be set to <Ora_home>/jdbc/lib in the .profile? what is the syntax of loading the class?

Thanks again
LOADJAVA is a command line utility

loadjava -user <username>/<password> <classfile>

Loading and Dropping Java Objects

Oracle and Java Stored Procedures

The database replacement for CLASSPATH is schema. All classes loaded within the database are referred to as class schema objects and are loaded within certain schemas. All JVM classes, such as java.lang.*, are loaded within PUBLIC. For example, if your schema is SCOTT, the database resolver (the database replacement for CLASSPATH) searches the SCOTT schema before PUBLIC. The listing of schemas to search is known as a resolver spec. Resolver specs are for each class, whereas in a classic Java virtual machine, CLASSPATH is global to all classes.

To make searching for dependent classes easier, Oracle provides a default resolver and resolver spec that searches first the definer's schema and then PUBLIC. This covers most of the classes loaded within the database. However, if you are accessing classes within a schema other than your own or PUBLIC, you must define your own resolver spec.

loading using Oracle's default resolver, which searches the definer's schema and PUBLIC:
loadjava -resolve

loading using your own resolver spec definition containing the SCOTT schema, OTHER schema, and PUBLIC:
loadjava -resolve -resolver "((* SCOTT)(* OTHER)(* PUBLIC))"
Nirav_a_shahAuthor Commented:

This is awesome! I am just a novice as far as java is related.. could you please provide me just the syntax i need to give.

e.g. after running the initjvm.sql, do i have to specify:

loadjava -user  ORACLE_HOME/javavm/lib/

(what value i have to specify for user. is it sys?)

also the question about classpath, how to set it?
thanks a lot!
The USER is the same user running initxa.sql

loadjava -user sys/<passwd> ORACLE_HOME/javavm/lib/

Oracle will search for java classees in the current schema. Schema is the database replacement for CLASSPATH.
Nirav_a_shahAuthor Commented:
Thanks Mohan this is such a great help to me!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.