ORA-02303: cannot drop or replace a type with type or table dependents

I got ” ORA-02303: cannot drop or replace a type with type or table dependents ”  error in Oracle database.

 

ORA-02303: cannot drop or replace a type with type or table dependents

 

Details of error are as follows.

ORA-02303: cannot drop or replace a type with type or table dependents.

Cause: An attempt was made to drop or replace a type that has type or table dependents.

Action: For DROP TYPE, drop all type(s) and table(s) depending on the type and then retry 
the operation, or use the FORCE option. For CREATE TYPE, drop all type(s) and table(s) 
depending on the type and then retry the operation, or drop all table(s) depending on the 
type and retry with the FORCE option.


Upgrading the database from 12.2.0.1 to 18c .Following error is encountered-

SQL> -- contains dbms_output (odci procedures dependent on this)
SQL> @@dbmsotpt
SQL> rem
SQL> rem $Header: rdbms/admin/dbmsotpt.sql /main/29 2014/02/20 12:45:51 surman Exp $
SQL> rem
SQL> Rem Copyright (c) 1991, 2013, Oracle and/or its affiliates.
SQL> Rem All rights reserved.
SQL> Rem NAME
SQL> Rem dbmsotpt.sql - used by sql*dba 'set serveroutput on' cmd
SQL> Rem DESCRIPTION
SQL> Rem NOTES
SQL> Rem SQL*DBA and SQL*PLUS depend on this package.
SQL> Rem RETURNS


SQL>
SQL> Rem This script must be run as user SYS.
SQL>
SQL> -- create varray type of varchar2(32767)
SQL> CREATE OR REPLACE TYPE dbmsoutput_linesarray IS
2 VARRAY(2147483647) OF VARCHAR2(32767);
3 /
CREATE OR REPLACE TYPE dbmsoutput_linesarray IS
*
ERROR at line 1:
ORA-02303: cannot drop or replace a type with type or table dependents

 

 

 

 

cannot drop or replace a type with type or table dependents

This ORA-02303 error is related with the attempt was made to drop or replace a type that has type or table dependents.

For DROP TYPE, drop all type(s) and table(s) depending on the type and then retry the operation, or use the FORCE option. For CREATE TYPE, drop all type(s) and table(s) depending on the type and then retry the operation, or drop all table(s) depending on the type and retry with the FORCE option.

 

Object type not created due to object dependencies.This could also cause Oracle Server Component to become INVALID.

 

Oracle Database Release 18 Post-Upgrade Status Tool    04-23-2019 11:55:5

Component                               Current         Full     Elapsed Time
Name                                    Status          Version  HH:MM:SS

Oracle Server
   ORA-02303: cannot drop or replace a type with type or table dependents
Oracle Server                           INVALID      18.3.0.0.0  00:15:17
JServer JAVA Virtual Machine              VALID      18.3.0.0.0  00:00:00
Oracle XDK                             UPGRADED      18.3.0.0.0  00:00:00
Oracle Database Java Packages          UPGRADED      18.3.0.0.0  00:00:00
Oracle Text                            UPGRADED      18.3.0.0.0  00:00:00
Oracle Real Application Clusters     OPTION OFF      18.3.0.0.0  00:00:00
Oracle XML Database                    UPGRADED      18.3.0.0.0  00:00:00
Upgrade Datapatch                                                00:00:21
Final Actions                                                    00:00:28
Post Upgrade                                                     00:00:11
Post Upgrade Datapatch                                           00:00:14

Total Upgrade Time: 00:16:37

Execute the below command in Upgrade Mode from 18c Home

SQL> CREATE OR REPLACE TYPE dbmsoutput_linesarray FORCE IS VARRAY(2147483647) OF VARCHAR2(32767);

If this was the only error,then run utlrp 4-5 times & check for the status of the “Oracle Server” Component.
Below SQLs also need to be executed,if they had failed previously.

 

SQL> create or replace public synonym dbmsoutput_linesarray for dbmsoutput_linesarray;
SQL> grant execute on dbmsoutput_linesarray to public;

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

 

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Leave a Reply

Your email address will not be published. Required fields are marked *