Thursday, March 22, 2012

Drop duplicate objects in SYS and SYSTEM schema before upgrading to Oracle 11gR2

When doing checking before manually upgrading a database from 10.2.0.3 to 11.2.0.1 (Oracle Note: Complete Checklist for Manual Upgrades to 11gR2 [ID 837570.1]), the following SQL script returns one duplicate objects in SYS and SYSTEM schema:


column object_name format a30

select object_name, object_type
from dba_objects
where object_name||object_type in
   (select object_name||object_type 
    from dba_objects
    where owner = 'SYS')
and owner = 'SYSTEM';
       
OBJECT_NAME                    OBJECT_TYPE
------------------------------ --------------------
AQ$_SCHEDULES                  TABLE  --- ok
AQ$_SCHEDULES_PRIMARY          INDEX --- ok

DBMS_REPCAT_AUTH               PACKAGE --- ok

DBMS_REPCAT_AUTH               PACKAGE BODY   --- ok

DBMS_SHARED_POOL               PACKAGE --- not ok!

According to  Oracle Note 1030426.6 (HOW TO CLEAN UP DUPLICATE OBJECTS OWNED BY SYS AND SYSTEM ):
  • Generate script to drop the unwanted object

select 'DROP ' || object_type || ' SYSTEM.' || object_name || ';' 
from dba_objects 
where object_name||object_type in 
   (select object_name||object_type  
    from dba_objects 
    where owner = 'SYS') 
and owner = 'SYSTEM'; 

DROP PACKAGE SYSTEM.DBMS_SHARED_POOL;

  • Drop it:
SQL> show user
USER is "SYS"
SQL> DROP PACKAGE SYSTEM.DBMS_SHARED_POOL;

Package dropped.


More Oracle DBA tips, please visit Oracle DBA Tips

No comments:

Post a Comment