【问题标题】:Not able to drop GTT in Oracle 12c无法在 Oracle 12c 中删除 GTT
【发布时间】:2021-04-06 11:40:26
【问题描述】:

我不会在 Oracle 12c 中删除 gtt。我不知道哪个session 正在保留待处理的交易。它是on commit preserve rows 表。

drop  TABLE pjm.pjm_ecc_gtt1
Error report -
ORA-14452: attempt to create, alter or drop an index on temporary table already in use
14452. 00000 -  "attempt to create, alter or drop an index on temporary table already in use"
*Cause:    An attempt was made to create, alter or drop an index on temporary
           table which is already in use.
*Action:   All the sessions using the session-specific temporary table have
           to truncate table and all the transactions using transaction
           specific temporary table have to end their transactions.

如何强制中止会话并将其删除。我知道v$session,但我怎么知道哪个会话使用我的表。

我被截断了,但仍然无法删除。

【问题讨论】:

  • 谢谢。没有锁。
  • @Mahima 我们遇到过这样的问题,但它一直挂在truncate 声明上。原因是孤立的进程,它在操作系统级别,但不在会话中。我们的 DBA 已经设法解决了这个问题,但我不知道他们是如何识别的。
  • 您在哪个版本或 Oracle 中,知道为什么要删除全局临时表,因为全局,与其他数据库产品(如 MySQL 和 SQL Server)的临时表不同,Oracle 中的全局临时表是永久数据库对象,将数据存储在磁盘上并对所有会话可见。但是,存储在全局临时表中的数据是会话私有的。也就是说,每个会话只能访问自己在全局临时表中的数据。
  • @hkandpal 我们实际上必须更改表格。我们需要更多的专栏。所以我们将删除并重新创建。它的新项目,问题仅在开发环境中。

标签: sql database oracle plsql oracle12c


【解决方案1】:

使用以下查询获取阻止它的会话。

SELECT 'USER: '||s.username||' SID: '||s.sid||' SERIAL #: '||S.SERIAL# "USER HOLDING LOCK"
FROM v$lock l
,dba_objects o
,v$session s
WHERE l.id1 = o.object_id
AND s.sid = l.sid
AND o.owner = 'SSI' --user name
AND o.object_name = 'ABC_ECC_GTT1'; --table name

然后运行

alter system kill session 'sid, serial#';

在终止会话之前,请询问正在持有的用户,礼貌地关闭会话。杀死会话应该是最后一个选项。

【讨论】:

    猜你喜欢
    • 2018-09-18
    • 1970-01-01
    • 1970-01-01
    • 2021-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 2019-06-18
    相关资源
    最近更新 更多