Friday, November 17, 2006

Tip : Oracle Home

When you have several oracle_home, here is a way to find which is the oracle home for a particular instance:

1) get the pid of a background process:
ps -edf | grep [o]ra_smon_ORAPRD01
oracle 307694 1 0 Jan 24 - 1:43 ora_smon_ORAPRD01

2) get its current working directory from /proc:
ls -l /proc/307694/cwd
lr-x------ 2 oracle dba 0 Feb 28 16:00 /proc/307694/cwd -> /app/oracle/product/9.2.0/dbs/

Here oracle_home is /app/oracle/product/9.2.0

Tip : dbms_java

By executing the following 2 statements in your session :

SET SERVEROUTPUT ON SIZE 1000000;
CALL DBMS_JAVA.SET_OUTPUT (1000000);

All the output of the System.out.println command in your stored procedures will be shown in your serveroutput. This gives you simple and fast way to debug your procedure like any other pl/sql procedure. It's jus like you would use the dbms_output.put_line proc.