Hurriyet

12 Mart 2015 Perşembe

Oracle Database: Compiling Invalid Objects Continued - Invalid Objelerin Compile Edilmesi Devam

During our health check, ıt appeared to us that we were working with invalid objects and we thought that there must be some script Oracle has done for it. We found out that we were right .

Oracle has 2 scripts for it. "Utlprp.sql" and "Utlrp.sql" which are found under $ORACLE_HOME/rdbms/admin.

It asks for just one input value. Its answer must be given accordingly.
0 - The level of parallelism is derived based on the CPU_COUNT parameter.
1 - The recompilation is run serially, one object at a time.
N - The recompilation is run in parallel with "N" number of threads.

Both scripts must be run as the SYS user, or another user with SYSDBA, to work correctly.
However sometimes we need to some manuel compilation.

For example the following states a compilation of package.


 BEGIN  
  FOR cur_rec IN (SELECT owner,  
              object_name,  
              object_type,  
              DECODE(object_type, 'PACKAGE', 1,  
                        'PACKAGE BODY', 2, 2) AS recompile_order  
          FROM  dba_objects  
          WHERE object_type IN ('PACKAGE', 'PACKAGE BODY')  
          AND  status != 'VALID'  
          ORDER BY 4)  
  LOOP  
   BEGIN  
    IF cur_rec.object_type = 'PACKAGE' THEN  
     EXECUTE IMMEDIATE 'ALTER ' || cur_rec.object_type ||   
       ' "' || cur_rec.owner || '"."' || cur_rec.object_name || '" COMPILE';  
    ElSE  
     EXECUTE IMMEDIATE 'ALTER PACKAGE "' || cur_rec.owner ||   
       '"."' || cur_rec.object_name || '" COMPILE BODY';  
    END IF;  
   EXCEPTION  
    WHEN OTHERS THEN  
     DBMS_OUTPUT.put_line(cur_rec.object_type || ' : ' || cur_rec.owner ||   
                ' : ' || cur_rec.object_name);  
   END;  
  END LOOP;  
 END;  
 / 

References:

1- Compile Invalid Objects

http://oracle-base.com/articles/misc/recompiling-invalid-schema-objects.php

1 yorum:

  1. In this fashion my buddy Wesley Virgin's adventure launches in this SHOCKING AND CONTROVERSIAL VIDEO.

    You see, Wesley was in the army-and soon after leaving-he unveiled hidden, "MIND CONTROL" tactics that the CIA and others used to get anything they want.

    THESE are the same methods many famous people (notably those who "come out of nowhere") and top business people used to become wealthy and successful.

    You probably know how you use only 10% of your brain.

    Mostly, that's because most of your brain's power is UNCONSCIOUS.

    Maybe that thought has even taken place INSIDE OF YOUR own mind... as it did in my good friend Wesley Virgin's mind around seven years back, while driving a non-registered, trash bucket of a car with a suspended license and on his bank card.

    "I'm absolutely frustrated with living paycheck to paycheck! Why can't I become successful?"

    You've been a part of those those thoughts, right?

    Your success story is going to happen. Go and take a leap of faith in YOURSELF.

    UNLOCK YOUR SECRET BRAINPOWER

    YanıtlaSil