May 2008


When creating oracle jobs for running stored procedures, we have to create them as the user who has the procedure ownership. We should not create them as SYSTEM user.
If we create the job as SYSTEM user, it will not be able to execute the proc. As far as I know this is because it uses the roles to get access to execute the procedures.
We did this way and then the job failed. Then we recreated it using the correct schema/user and it started working fine.

Note: If you execute the procedure using exec :proc_name: while logged in as SYSTEM user it would probably succeed, but it does not do so when created as a job. Not sure though why it succeeds when you do an exec :proc_name:

Hitesh Agarwal has compiled a list of code snippets for Date manipulation in Java:

http://www.hiteshagrawal.com/java/date-manipulation-in-java

Analyze table is a feature in Oracle. When it is run on a particular table, it rebuilds the indexes and as the name suggests analyzes the data in the table so that Oracle is able to search data in it in a better, faster way. This helps Oracle to generate a better execution plan.

When to use it: Use it in case there has been a large data load in the table. This is especially true of tables that are target tables for bulk uploads, ETL processes or sync up of large data with master tables.

Signs that the table needs to be analyzed:

1. Search queries not responding or taking a lot of time to return data even when the search is made on the indexed column(s).
2. You get a time out exception on search queries that earlier returned data quickly.
3. Same query has performance issues on different environments.

Syntax: ANALYZE TABLE {Table_Name} COMPUTE STATISTICS.

You should be logged in as SYSTEM user on the database to run this.