Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wonder what is the best practice to recompile Oracle 10g programmable objects that become invalid due to changes in one of them.

To be more specific, I have a few packages, that use schema level types. I also have triggers in the system that call functions/procedures from packages. From what I understand, changes in package body don't require any further actions (except recompiling the body). However, if I change package , I have to recompile bunch of triggers that use this package and other packages that have dependencies on it.

So far I just grabbed list of invalid objects and recompiled them or used DBMS_UTILITY.compile_schema.

Thank you.

share|improve this question
up vote 4 down vote accepted

The trick is get the packages and dependent code recompiled in one go. If you are refreshing a development database with new data you will have an enormous list of invalid procedures. As well, with dependent code you find yourself recompiling over and over. You can use this command located in $ORACLE_HOME/rdbms/admin/utlrcmp.sql:


(available from 9i but improved for 10g and 11)

If you have packages that are not valid and will not be valid, for whatever reason, you can use this package from Martin Mares which will recursively compile all invalid objects except the ones you specify.

As far as best practice goes I try to limit the dependency chain. It's always a toss up between "Don't repeat yourself" which encourages dependencies and having stand alone packages.

My rule of thumb is that if the package/trigger/object interacts with another database try to reduce dependencies so if there is a issue you have less places to look for sources of the problem.

share|improve this answer
Thank you, my main concern is trigger->package dependencies... – a1ex07 Nov 15 '12 at 19:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.