N10ram
N10ram

Reputation: 81

How can I compile all invalid obects in PL/SQL?

I would like to write a PL/SQL procedure that finds all invalid objects, order in hierarchical manner (supertype ---> subtype) and than compile them.

Upvotes: 1

Views: 9431

Answers (2)

umut
umut

Reputation: 82

To find all invalid objects:

select * from dba_objects obj where status = 'INVALID'

To find dependencies of an object:

select * from dba_dependencies where owner = 'xxx' and name = 'yyy'

To compile an object:

alter procedure user.procedure_name
compile

I'm not pretty sure how you can order according to hierarchy, I'll think about it. Meanwhile maybe you can come up with a solution by using these tools. Hope it will help.

Upvotes: 0

Husqvik
Husqvik

Reputation: 5809

BEGIN
  DBMS_UTILITY.COMPILE_SCHEMA(schema => '<your schema>', compile_all => FALSE, reuse_settings => TRUE);
END;

see http://docs.oracle.com/database/121/ARPLS/d_util.htm#ARPLS73226

Upvotes: 8

Related Questions