We help IT Professionals succeed at work.

ORA-02449 error

sam2929
sam2929 asked
on
521 Views
Last Modified: 2014-05-08
Trying to drop a table

drop table test

getting
ORA-02449 error

unique/primary keys in table refrenced by foreign keys

How can i fund all the refrences for test1 and then want to disable them.
Comment
Watch Question

johnsoneSenior Oracle DBA
CERTIFIED EXPERT

Commented:
You cannot disable them, you have to drop them.

This query should get you the names of the constraints that are referencing the primary key.

SELECT constraint_owner, 
       constraint_name, 
       table_name 
FROM   dba_constraints 
WHERE  ( r_constraint_owner, r_constraint_name ) IN (SELECT constraint_name, 
                                                            constraint_owner 
                                                     FROM   dba_constraints 
                                                     WHERE 
              constraint_type IN ( 'P', 'U' ) 
              AND table_name = 'TEST'); 

Open in new window

CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
I would just generate the DDL and look at the constraints:
select dbms_metadata.get_ddl('TABLE','TEST') from dual;

Author

Commented:
select dbms_metadata.get_ddl('TABLE','Currency_Type_Dim') from dual;

i am getting ORA-31603 and ora-06512 error and yes table do exist there
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
Objects in Oracle are converted to UPPER case:
select dbms_metadata.get_ddl('TABLE','CURRENCY_TYPE_DIM') from dual;
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
If this isn't a 'test' table, are you sure you want to drop it if there are constraints on it?

If you recreate it, you will need to rebuild all the constraints to make sure everything is back to the way it was.

Author

Commented:
i don't want to drop any constraint all i want is to see all constraints related to that table in other tables
Gerwin JansenTopic Advisor
CERTIFIED EXPERT
Most Valuable Expert 2016

Commented:
If this is just a test system you may consider dropping the constraints as well:

drop table test cascade constraints;

(be careful)

<edit>

Never mind, did not see your last post as I posted this one.
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
Then use the SQL posted by johnsone.  I didn't run it but it looks good to me.

Author

Commented:
select dbms_metadata.get_ddl('TABLE','CURRENCY_TYPE_DIM') from dual;

i get no result but i know this table have constraints to fact tables

Author

Commented:
SELECT constraint_name
                                                          --constraint_owner
                                                     FROM   dba_constraints
                                                     WHERE
              constraint_type IN ( 'P', 'U' )
              AND table_name = 'Currency_Type_Dim'

no result it dn't like   --constraint_owner
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
>>i get no result but i know this table have constraints to fact tables

That just generates the DDL for the TABLE.  It would have constraints to other tables not what constraints on other tables have to it.

I guess I missed the actual question here.

Use johnsone's SQL.
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
>>AND table_name = 'Currency_Type_Dim'

Again:  OBJECT_NAMES in UPPER case.
Senior Oracle DBA
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.