To compile all invalid objects
how we can compile all invalid objects? is there any sample plsql code?
dbms_utility.compile_schema('shema_name');Please note that from Oracle 9i onwards this does not work. It compiles objects in alphabetical order rather than reverse dependency order, so you may end up with more objects uncompiled than you started with. This change occurred due to the introduction of Java (boo! hiss!) which allows circular dependencies.
Since then, the only safe way to compile objects is to use the %ORACLE_HOME%\rdbms\admin\utlirp.sql script (which requires sysdba access).
This has been packaged up in 10gR2 as UTL_RECOMP.
Thereby proving that searching is easy but finding the right answer is difficult.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/
Similar Messages
-
How to compile all invalid objects in SQL Developer
Hi
I am used to PL\SQL Developer and currently I am testing SQL Developer (version 2.1). I have question where can I find in SQL Developer functionality (or how to invoke those functions) like:
1 ) To list all invalid objects and then compile them.
2) Invoke window similar to “Command window” in PL\Sql Developer
Thanks for help
GroxyCould I please revive this and ask how do I use UTL_RECOMP?
Also, I could not find a description of the icons in SQL Developer. Some procedures are shown with a green plus sign (I am guessing here since I can't make out what it is) on them and the ones that I right-click and compile have this green go away. Can you explain?
Thanks a lot. -
Recompile all invalid objects in live database
Hi Expers,
Just need a clarification on recompiling all invalid objects in production database when the systems is busy.
i thought of recompile all the invalid objects using utlrp.sql script in my production database since some of few synonyms were invalid after application patch script been implemented last weekeend.
we have identifed the invalid objects now, i thought to run the utlrp.sql, what will be the consequences.
Regards,
SalaiHi Hemanth,
I'd reserve utlrp.sql for upgrades, downgrades and patchsets. I do agree 101% with above point, I a not denying on that.
If you really have a large number of invalid objects, you might choose to compile a few "selected" objects every hour instead of running a single-shot "compile all invalid objects". Rare but a possible requirement.I came across such requirement during early days of career during pushing product enhancement to production and we would have get to know the things and number of objects which would go invalid as we use to carry out testing on test databases.
I agree completely utlrp.sql is suggested and should opt for.
- Pavan Kumar N -
How to recompile all invalid objects of APPS?
Dear all:
How to recompile all invalid objects of APPS? my environment is ORACLE 9.2.0.5 32bit.
Regards
Terryvarun4dba wrote:
hi Terry,
did you tried adadmin?
thanks.Do you mean:
Compile/Reload Database Objects
1. Compile APPS schema
2. Compile menu information
3. Recreate grants and synonyms for APPS schema
4. Compile flexfield data in AOL tables
5. Reload JAR files to database
6. Return to Main Menu -
CURSOR to recompile all INVALID objects
Ok, I know I'm using the atler-compile pre-defined trigger here, and I'm cool with that.
I'm creating an anonymous block to recompile all INVALID objects. I've come up with a basic CURSOR to pull all INVALID objects into the cursor, and then using the alter_compile trigger to recomipile them.
However, I can't figure out how to call them all into the trigger...One of the inputs for the alter_compile trigger is the name of the object...hwo can I get around that?
DECLARE
CURSOR compile_cur
IS
SELECT object_name, status
FROM user_objects
WHERE status='INVALID';
BEGIN
FOR rec_cur IN compile_cur LOOP
DBMS_DDL.ALTER_COMPILE('PROCEDURE', 'SYSTEM','BB_JOBTEST');
END LOOP;
END;
/You can issue a single statement to compile all triggers, procedures, packages, functions in the schema.
SQL> EXEC DBMS_UTILITY.compile_schema(schema => 'Schema_Name');
This will compile all the objects regardless of it's current status.
Shailender Mehta -
Shell script to validate all invalid objects?
Hello DBA's.
New to DBA ing and so seek your help.. I am using oracle Oracle9i Release on a Solaris box.
I need a shell script that will check all invalid objects on a DB and would validate it by running utlrp.sql. I know i can do this manually but i am asked to automate the process..
Kindly suggest where i can find a shell script or share this script with me.. it would be much appreciated.
Regards!OK, this is possible, and here is one way entirely within SQL*Plus where it will try once more to recompile invalid objects, please note that this (top one) will work only on 11g or greater, and only getting around to testing this properly now:
#!/bin/ksh
. $HOME/.profile
export ORACLE_SID=<your_SID>
sqlplus '/ as sysdba' << EOF
set serveroutput on
set pagesize 1000
@${ORACLE_HOME}/rdbms/admin/utlrp.sql
begin
for cur in (select do.owner || '.' || do.object_name module, object_type from dba_objects do join obj$ o on (do.object_id = o.obj#) where o.status = 5)
loop
begin
execute immediate 'alter ' || cur.object_type || ' ' || cur.module || ' compile';
exception when others then continue;
end;
end loop;
end;
spool <path_and_filename_of_your_Invalid_Objects_output_file>
select do.owner || '.' || do.object_name from dba_objects do join obj$ o on (do.object_id = o.obj#) where o.status = 5;
spool off
quit
EOF
exit $?For < 11g:
#!/bin/ksh
. $HOME/.profile
export ORACLE_SID=<your_SID>
sqlplus '/ as sysdba' << EOF
set serveroutput on
set pagesize 0
set heading off
set termout off
set feedback off
@${ORACLE_HOME}/rdbms/admin/utlrp.sql
spool /tmp/recompile.sql
begin
for cur in (select do.owner || '.' || do.object_name module, object_type from dba_objects do join obj$ o on (do.object_id = o.obj#) where o.status = 5)
loop
dbms_output.put_line( 'alter ' || cur.object_type || ' ' || cur.module || ' compile;');
end loop;
end;
spool off
@/tmp/recompile.sql
!rm /tmp/recompile.sql
set heading on
set termout on
set pagesize 1000
spool <path_and_filename_of_your_Invalid_Objects_output_file>
select do.owner || '.' || do.object_name from dba_objects do join obj$ o on (do.object_id = o.obj#) where o.status = 5;
spool off
quit
EOF
exit $?Edited by: SeánMacGC on Apr 29, 2009 1:12 PM -
REUSE SETTINGS supresses error messages when compiling an invalid object
Hello,
my test:
Create a table and a packaged procedure referencing the table. Then drop the table and recompile the package:
CREATE TABLE x (
y NUMBER
CREATE OR REPLACE PACKAGE y
AS
PROCEDURE z;
END y;
SHOW ERRORS
CREATE OR REPLACE PACKAGE BODY y
AS
PROCEDURE z
IS
v_count PLS_INTEGER;
BEGIN
SELECT COUNT(*)
INTO v_count
FROM x;
END z;
END y;
SHOW ERRORS
DROP TABLE x;
PROMPT 1.Compile package
ALTER PACKAGE y COMPILE;
SHOW ERRORS
PROMPT 2.Compile package body
ALTER PACKAGE y COMPILE BODY;
SHOW ERRORS
PROMPT 3.Compile package with "REUSE SETTINGS"
ALTER PACKAGE y COMPILE REUSE SETTINGS;
SHOW ERRORS
PROMPT 4.Compile package body with "REUSE SETTINGS"
ALTER PACKAGE y COMPILE BODY REUSE SETTINGS;
SHOW ERRORS
SELECT object_name
,object_type
FROM user_objects
WHERE status = 'INVALID';
--DROP PACKAGE y;Partly unexpected output
Tabelle wurde erstellt.
Package wurde erstellt.
Keine Fehler.
Package Body wurde erstellt.
Keine Fehler.
Tabelle wurde gelöscht.
1.Compile package
Warnung: Paket wurde mit Kompilierungsfehlern geõndert.
Keine Fehler.
2.Compile package body
Warnung: Paketrumpf wurde mit Kompilierungsfehlern geõndert.
Fehler bei PACKAGE BODY Y:
LINE/COL ERROR
8/3 PL/SQL: SQL Statement ignored
10/8 PL/SQL: ORA-04044: procedure, function, package, or type is not
allowed here
3.Compile package with "REUSE SETTINGS"
Warnung: Paket wurde mit Kompilierungsfehlern geõndert.
Keine Fehler.
4.Compile package body with "REUSE SETTINGS"
Warnung: Paketrumpf wurde mit Kompilierungsfehlern geõndert.
Keine Fehler.
OBJECT_NAME OBJECT_TYPE
Y PACKAGE BODY
1 Zeile wurde ausgewõhlt.It says
- Table created
- Package created
- Package body created
- Table dropped
- Package header compiled with errors (why?)
- Package body compiled with errors (shown error is expected)
- Package header compiled with errors (again why?)
- Package body compiled with errors (no errors shown)
So why is the header compiled with errors, when the object is valid.
And why is no error shown for COMPILE REUSE SETTINGS when there are errors for the body?
I use REUSE SETTINGS when recompiling invalid objects that were compiled for debug with
ALTER PACKAGE abc COMPILE PLSQL_DEBUG = TRUE REUSE SETTINGSRegards
Marcus
Version:
SQL*Plus: Release 10.2.0.1.0 - Production on Di Jan 27 12:45:20 2009
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining optionsHi,
From SQL Reference Manual [REUSE SETTINGS|http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_1007.htm#BGBGEIGD]:
Specify REUSE SETTINGS to prevent Oracle from dropping and reacquiring compiler switch settings. With this clause, Oracle preserves the existing settings and uses them for the recompilation of any parameters for which values are not specified elsewhere in this statement.
For backward compatibility, Oracle Database sets the persistently stored value of the PLSQL_COMPILER_FLAGS initialization parameter to reflect the values of the PLSQL_CODE_TYPE and PLSQL_DEBUG parameters that result from this statement.
Regards, -
How to Compile Sys invalid objects
Dear,
We have found one invalid object in our database which owner is SYS.
How i compile this objects it's OBJECT_TYPE is package_body.
Please suggest me if any..
Wting
Rajhello.
I run this script, but sys's objects again to be with erros:
OWNER OBJECT_NAME
SYS ALL_WORKSPACES
SYS DBA_OUTLINES
SYS DBA_OUTLINE_HINTS
SYS DBA_WORKSPACES
SYS DBA_WORKSPACE_SESSIONS
SYS KU$_OUTLINE_VIEW
SYS LOGOFF_PROC
SYS LT
SYS LTADM
SYS LTDDL
SYS LTDTRG
SYS LTPRIV
SYS LTRIC
SYS LTUTIL
SYS LT_CTX_PKG
SYS NO_VM_CREATE
SYS NO_VM_CREATE_PROC
SYS NO_VM_DROP
SYS NO_VM_DROP_PROC
SYS OUTLN_PKG
SYS OWM_DDL_PKG
SYS OWM_MIG_PKG
SYS OWM_REPUTIL
SYS SYS_LOGOFF
SYS UD_TRIGS
SYS USER_OUTLINES
SYS USER_OUTLINE_HINTS
SYS USER_WORKSPACES
SYS WM$WORKSPACE_SESSIONS_VIEW
SYS WM_DDL_UTIL
SYS WM_INSTALLATION
MDSYS ALL_GEOMETRY_COLUMNS
MDSYS ALL_SDO_GEOM_METADATA
MDSYS ALL_SDO_INDEX_INFO
MDSYS ALL_SDO_INDEX_METADATA
MDSYS ALL_SDO_LRS_METADATA
MDSYS ALL_SDO_MAPS
MDSYS ALL_SDO_STYLES
MDSYS ALL_SDO_THEMES
MDSYS DBA_GEOMETRY_COLUMNS
MDSYS DBA_SDO_GEOM_METADATA
MDSYS DBA_SDO_INDEX_INFO
MDSYS DBA_SDO_INDEX_METADATA
MDSYS DBA_SDO_LRS_METADATA
MDSYS DBA_SDO_MAPS
MDSYS DBA_SDO_STYLES
MDSYS DBA_SDO_THEMES
MDSYS GEODETIC_SRIDS
MDSYS MD2
MDSYS SDO_CATALOG
MDSYS SDO_GEOM_TRIG_DEL1
MDSYS SDO_GEOM_TRIG_INS1
MDSYS SDO_GEOM_TRIG_UPD1
MDSYS SDO_LRS_TRIG_DEL
MDSYS SDO_LRS_TRIG_INS
MDSYS SDO_LRS_TRIG_UPD
MDSYS SDO_META
MDSYS SDO_MIGRATE
MDSYS SDO_RELATEMASK_TABLE
MDSYS SDO_RELATE_MASK
MDSYS TRANSFORM_MAP
MDSYS USER_GEOMETRY_COLUMNS
MDSYS USER_SDO_GEOM_METADATA
MDSYS USER_SDO_INDEX_INFO
MDSYS USER_SDO_INDEX_METADATA
MDSYS USER_SDO_LRS_METADATA
MDSYS USER_SDO_MAPS
MDSYS USER_SDO_STYLES
MDSYS USER_SDO_THEMES
Can I help you? thanks.
Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production -
Compile all invalid packages together + connect as sysdba only
Hi
I've installed a Ora 10.2, and imported a dump. This dump contained some users, a lot of tables and stored procs.
My first question: There is an imported user with I can connect as sysdba only. I can't connect as normal... it is problem because there is an application upper the db and I can't tell the applicataion that connect as sysdba. (it is only a sandbox for me...) What should I modify on this user to connect as normal user?
The second question: The schema (upper) contains lot of invalid packages. I have only the free Toad and I can't compile all of them only step by step... (I don't want do this step by step because there are about 300 packages...). How could I complile all of them e.g. from Sqlplus? Any other solution?
Thanks in advance!
Alexok, there is a user e.g. "xxxx"
I can connect with this user as sysdba only. "CONNECT xxxx/yyyy@db as sysdba". Without "as sysdba" I got "ORA-01017: invalid username/password; logon denied" So I can connect only as sysdba... but this is a simple user so I don't want to connect as sysdba... -
How to compile all objects.....in Oracle10g
Hi ,
The Oracle Doc about PL/SQL Packages and Types reffering to DBMS_UTILITY and the COMPILE_SCHEMA procedure....points out :
"Compiles all procedures, functions, packages, and triggers in the specified schema"
So how to compile views and possibly other db schema object types ......????
For example issuing the command :
select object_name from user_objects where status='INVALID';
we get all invalid objects, views , packages , e.t.c.
How to compile all types of objects ... except for EM10g env......
Many thanks....
SimYou may want to use Solomon Yakobson's utility available here:
http://apex.oracle.com/pls/otn/f?p=2853:5:4266218307366505 -
R12.1.3 : Adadmin hangs while compiling invalid objects
Dear All ,
Recently we have upgraded 11i to R12.1.3, from the base upgrade we have 2 custom invalid object..(its default).
if the invalid objects increase we use to compile with adadmin to compiling those invalid objects. but while compiling this adadmin window hangs down those objects are compiled.
can anyone tell me what might be the problem., how to resolve this ?
Kindly help me
by putty i ran this adadmin utility
Our OS version is OEL 4.5
Upgraded Ebiz application version is R12.1.3
Regards
HameedDear Hussein,
I didnt found any errors in database log file and in Adadmin utility log file.
No, i dint tried to relink using adrelink.sh..
i am going by your given metalink ID, and let u know in few hours
Regards
Hameed -
Unable to compile invalid objects post R12.1.1to R12.1.3 upgrades
Hi Experts,
Kindly note that post upgrade from R12.1.1 to R12.1.3.
I am unable to compile the below invalid objects.
APPS PACKAGE BODY BIS_TARGET_LEVEL_PVT
APPS PACKAGE BODY MSC_CL_PULL
APPS PACKAGE BODY RLM_MANAGE_DEMAND_SV
APPS PACKAGE BODY RLM_RD_SV
APPS PACKAGE BODY RLM_EXTINTERFACE_SV
APPS PACKAGE BODY CSC_ACTION_ASSEMBLER_PVT_W
APPS PACKAGE BODY ASO_OPP_QTE_PUB
APPS PACKAGE BODY ISC_EDW_BOOK_SUM1_F_C
APPS PACKAGE BODY OPI_EDW_OPMINV_DAILY_STAT_F_C
APPS PACKAGE BODY ASO_SECURITY_INT
APPS PACKAGE BODY ASO_QUOTE_PUB_W
APPS PACKAGE BODY ASO_QUOTE_HEADERS_PVT
Please advise.
Mohammed Abdul MuqeetKindly note that post upgrade from R12.1.1 to R12.1.3.
I am unable to compile the below invalid objects.
APPS PACKAGE BODY BIS_TARGET_LEVEL_PVT
APPS PACKAGE BODY MSC_CL_PULL
APPS PACKAGE BODY RLM_MANAGE_DEMAND_SV
APPS PACKAGE BODY RLM_RD_SV
APPS PACKAGE BODY RLM_EXTINTERFACE_SV
APPS PACKAGE BODY CSC_ACTION_ASSEMBLER_PVT_W
APPS PACKAGE BODY ASO_OPP_QTE_PUB
APPS PACKAGE BODY ISC_EDW_BOOK_SUM1_F_C
APPS PACKAGE BODY OPI_EDW_OPMINV_DAILY_STAT_F_C
APPS PACKAGE BODY ASO_SECURITY_INT
APPS PACKAGE BODY ASO_QUOTE_PUB_W
APPS PACKAGE BODY ASO_QUOTE_HEADERS_PVTWhat is the error you get when you compile those invalid objects manually?
Please see these docs.
ASO Invalid Objects in 12.1.3 [ID 1235496.1]
How To Resolve RLM Invalids [ID 1450159.1]
R12: Contact Center: Package CSC_ACTION_ASSEMBLER_PVT_W Invalid [ID 1126155.1]
BIS_TARGET_LEVEL_PVT is Invalid After Upgrade to EBS 12.1.3 [ID 1364996.1]
Thanks,
Hussein -
How can I compile all functions, procedures and packages with a script?
I need to compile all functions, procedures and packages of 5 schemas (users) with a script.
How can I do it?
Thanks!you can create a script to select all invalid objects in those schemas Since Oracle 8 introduced NDS this approach has struck me as a trifle old fashioned. It's much simpler to loop round the query in PL/SQL and use EXECUTE IMMEDIATE to fire off the DDL statements. No scripts, no muss, no fuss.
Having said that, the problem with this approach and also with using DBMS_UTILITY.COMPILE_SCHEMA is that they do not compile all the invalid objects in dependency order. This may result in programs being invalidated by the subsequent compilation of dependencies. This is due to the introduction of Java into the database.
The UTLRP script is much better, because it (usually) avoids cyclic references. But you still may need to run it more than once.
In general it is better to avoid sledgehammer recompilations (like DBMS_UTILITY.COMPILE_SCHEMA, which starts by invalidating all the objects). If we have twenty invalid objects, nineteen of which are dependencies of the twentieth, we actually only need to recompile the master object, as recompiling it will trigger the recompilation of all the others.
Cheers, APC -
Hi sawwan,
we have one one year old apps environment R12.0.5 and db 10.2.0.2, we are getting daily invalid objects in database,we have not applied any patches and we have not made any changes recently ,
daily we used to compile all invalids at night time, before starting our work hrs in morning we can see some of invalids objects,
normally why we get invalids even we just running some scheduled concurrent requests in database but we have not got before such invalids now we are getting invalids in database.Sawwan,
here are invalid objects , i can see lot of invalid objects are system /public user.
PUBLIC DBA_HIST_FILESTATXS SYNONYM
PUBLIC DBA_HIST_SQLSTAT SYNONYM
PUBLIC DBA_HIST_SQLBIND SYNONYM
PUBLIC DBA_HIST_SYSTEM_EVENT SYNONYM
PUBLIC DBA_HIST_WAITSTAT SYNONYM
PUBLIC DBA_HIST_LATCH SYNONYM
PUBLIC DBA_HIST_LATCH_MISSES_SUMMARY SYNONYM
PUBLIC DBA_HIST_DB_CACHE_ADVICE SYNONYM
PUBLIC DBA_HIST_ROWCACHE_SUMMARY SYNONYM
PUBLIC DBA_HIST_SGASTAT SYNONYM
PUBLIC DBA_HIST_SYSSTAT SYNONYM
PUBLIC DBA_HIST_SYS_TIME_MODEL SYNONYM
PUBLIC DBA_HIST_OSSTAT SYNONYM
PUBLIC DBA_HIST_PARAMETER SYNONYM
PUBLIC DBA_HIST_SEG_STAT SYNONYM
PUBLIC DBA_HIST_ACTIVE_SESS_HISTORY SYNONYM
PUBLIC DBA_HIST_TABLESPACE_STAT SYNONYM
PUBLIC DBA_HIST_SERVICE_STAT SYNONYM
PUBLIC DBA_HIST_SERVICE_WAIT_CLASS SYNONYM
SYSTEM EMP SYNONYM
SYSTEM DEPT SYNONYM
SYSTEM MLOG$_EMP SYNONYM
SYSTEM RUPD$_EMP SYNONYM
SYSTEM EMP_SNAPSHOT SYNONYM
SYSTEM WF_LOCAL_ROLES_STAGE SYNONYM
READONLY EMP SYNONYM
READONLY DEPT SYNONYM
READONLY MLOG$_EMP SYNONYM
READONLY RUPD$_EMP SYNONYM
READONLY EMP_SNAPSHOT SYNONYM
READONLY WF_LOCAL_ROLES_STAGE SYNONYM -
Invalid object after applying fa patch
Dear all,
Just now I had applied patch for FA & Generate message files from Generate Applications Files menu. How do I know that there are any invalid objects for FA after applying patch in order for me to run Compile APPS schema from adadmin to compile the invalid objects. What is the example for the invalid object message? What is the effect if I run Compile APPS schema eventhough there are no invalid object occur? Please advices.HI,
Below is my last message after compiling the APPS Schema
======================================
There are now 1 jobs remaining (current phase=pc_errchk):
0 running, 1 ready to run and 0 waiting.
Assigned: file aderrchk.sql on worker 1 for product ad username APPLSYS.Spawned Process 29807
Completed: file aderrchk.sql on worker 1 for product ad username APPLSYS.
Done compiling APPS schema(s) in parallel.
Telling workers to quit...
All workers have quit.
Dropping FND_INSTALL_PROCESSES table...
FND_INSTALL_PROCESSES table dropped.
Dropping AD_DEFERRED_JOBS table...
AD_DEFERRED_JOBS table dropped.
Please check your log files for errors that may have occurred
while compiling invalid objects.
Be sure to look at the log file(s) for the parallel worker(s) which ran
adpcpcln.pls and aderrchk.sql. These scripts display compilation errors
and list objects which are still invalid.
sqlplus -s APPS/***** @/test/oracle/testappl/ad/11.5.0/admin/sql/adinvrst.pls *****
Spawned Process 29850
Review the messages above, then press [Return] to continue.
===========================================
I had run select owner, object_type, object_name from dba_objects where status = 'INVALID' order by 1,2; once again to look for an INVALID object but the INVALID object still appear.
Please advice. Do I need to run compile APPS Schema once again?
Maybe you are looking for
-
Hard drive wakes up immediately after being put into standby
I have an IDE disk which, till now, I used to keep in standby mode (it makes an audible humming noise when it's working which annoys me a lot :<). Today I noticed that after running `hdparm -y' on it, it would spin down but then it would immediately
-
Triggering a workflow through a dialog program
I tried to trigger a workflow through a dialog program using FM. I also created BOR and workflow(SWDD). The dialog program basically deletes a sales order and then a workflow should trigger. I am not able to see the email. Am I missing anything here
-
How do you do the java Add-In installation either on NW04 or NW04s when the ABAP stack is on the latest support package level when compared to the support package level on the media you use to install the java Add-in.
-
Putting german language on my 9500
Hi there. I have just bought a 9500 phone in the UAE. When I tried to set the language to German, I found that only English, French and Arabic was installed. Where can I download German language to put on my phone. Waiting 4 an answer - cheers - Mike
-
Pricing based on Customer grops
Hi, I want to know how we configure pricing based on customer groups. Regards, Narasimham.