Thursday, January 2, 2014

ORA-14452: attempt to create, alter or drop an index on temporary table already in use

Cause: Tried to drop a GTT Global temporary table but I got an error 'ORA-14452: attempt to create, alter or drop an index on temporary table already in use'.

Here problem with not completed the transaction in any session and tried to drop the table then we will get this error. For session specifict GTT, one created with ON COMMIT PRESERVE ROWS, the session needs to truncate the GTT.

Action: Followed below steps to DROP GTT
1) Tried to drop a GTT

SQL> drop table REGISTR.ENT_GTT;
drop table REGISTR.ENT_GTT
ORA-14452: attempt to create, alter or drop an index on temporary table already in use
SQL>

2) First we need to verify If any active session is locking this object, If yes, then we can find the SID of that locked object.

SQL> select  *   from  v$lock   where id1 = (select  object_id from  dba_objects where owner = 'REGISTR' and object_name = 'ENT_GTT');

SID is 447.

3) Kill the session using the SID

SQL> select inst_id,'alter system kill session ''' || SID || ',' || SERIAL# || ''' IMMEDIATE;' from gv$session gg where gg.SID =447;

SQL> alter system kill session '447,4045' IMMEDIATE;

System altered

4) Now I dropped the GTT with out any issues

SQL> drop table REGISTR.ENT_GTT;

Table dropped

SQL> 
That's it..Hope this will help you...:)

Best Regards,
Chowdari

22 comments:

  1. Thank you so much for this! I was beginning to think that all Oracle programmers were total jerks because all they want to do is tell me that I'm stupid because I want to delete a GTT. Perhaps they should consider the possibility that I might need to change it because it is still in development and testing. Again, thank you!!

    ReplyDelete
    Replies
    1. Exactly, had the same feeling, have same comment!

      Delete
  2. Hi Dude,

    Thanks for the post.It's very useful for me to troubleshoot the GTT issue.

    - Saravanan R

    ReplyDelete
  3. Thanks dear

    You can bounce db and drop any object easily

    Kamran

    ReplyDelete
  4. Thank You...!! I tried everything but it didnot work. Atlast you blog helped me :) :)

    ReplyDelete
  5. This helped me, too. thanks so much!

    ReplyDelete
  6. @ #kamran Umer, local environments lets say development or Testing etc.., frequently we got ora-14452 errors,,for every time we cant bounce the database right.

    ReplyDelete
  7. @Ryan Atwood,, Thanks for your comment,, and I am very happy this article has helped you :)

    ReplyDelete
  8. Please truncate the table then drop it.

    ReplyDelete
  9. truncate, then drop +1

    ReplyDelete
  10. thanks , thats works fine

    ReplyDelete
  11. Thanks for this! Very helpful!

    Dan

    ReplyDelete
  12. Thank you, this was helpful :)

    ReplyDelete
  13. Useful one, thank you.

    Regards,
    Ram

    ReplyDelete

Some Most Popular Articles