ORA-14450: attempt to access a transactional temp table already in use
在ORACLE数据中修改会话级临时表时,有可能会遇到ORA-14550错误,那么为什么会话级全局临时表会报ORA-14450错误呢,如下所示,我们先从一个小小案例入手:
案例1:
SQL> CREATE GLOBAL TEMPORARY TABLE TEMP_TEST
2 (
3 NAME VARCHAR2(12)
4 ) ON COMMIT PRESERVE ROWS;
Table created.
SQL> INSERT INTO TEMP_TEST VALUES('kerry');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> ALTER TABLE TEMP_TEST ADD SEX NUMBER(1) ;
ALTER TABLE TEMP_TEST ADD SEX NUMBER(1)
*
ERROR at line 1:
ORA-14450: attempt to access a transactional temp table already in use
如上所示,修改会话级临时表时遇到了ORA-14450错误,那么有哪些解决方法呢? 这时需要断开会话或执行TRUNCATE语句:
SQL> TRUNCATE TABLE TEMP_TEST;
Table truncated.
SQL> ALTER TABLE TEMP_TEST ADD SEX NUMBER(1) ;
Table altered.
SQL>
如下所示,我们模拟一个会话在操作临时表TEMP_TEST, 另外一个会话准备修改它,如下所示(实际场景可能更复杂,可能涉及多个会话而不是仅仅两个会话)
会话1:
SQL> SET SQLPROMPT "SQLSESSION 1 >"
SQLSESSION 1 >CREATE GLOBAL TEMPORARY TABLE TEMP_TEST
2 (
3 NAME VARCHAR2(12)
4 ) ON COMMIT PRESERVE ROWS;
Table created.
SQLSESSION 1 >INSERT INTO TEMP_TEST VALUES('kerry');
1 row created.
SQLSESSION 1 >COMMIT;
Commit complete.
SQLSESSION 1 >
会话2::
SQL> SET SQLPROMPT "SESSION 2 >"
SESSION 2 >ALTER TABLE TEMP_TEST ADD SEX NUMBER(1) ;
ALTER TABLE TEMP_TEST ADD SEX NUMBER(1)
*
ERROR at line 1:
ORA-14450: attempt to access a transactional temp table already in use
SESSION 2 >
那么此时,会话1是其它用户登录的。比如应用程序等,你不可能要求所有会话都去执行TRUNCATE操作,这个时候该怎么处理呢?
此时你可以使用下面步骤解决这个问题。
Step 1、以sys或system登录数据库,先从DBA_OBJECTS中查询到该表的OBJECT_ID:
SELECT OWNER, OBJECT_ID,OBJECT_TYPE
FROM DBA_OBJECTS
WHERE OBJECT_NAME=&OBJECT_NAME AND OBJECT_TYPE ='TABLE';
Step 2、根据查到的OBJECT_ID知道使用该表的SESSION:
SELECT ADDR, KADDR, SID,LMODE FROM V$LOCK WHERE ID1=&OBJECT_ID;
Step 3、通过下面SQL找到对应的会话并生成KILL SESSION的执行语句
SET COL kill_session FOR A80;
select a.sid, a.serial#,a.status,
a.paddr, 'alter system kill session '''
|| a.sid || ',' || a.serial#
|| ''' immediate;' AS kill_session
FROM v$session a
WHERE a.sid in (select sid from v$enqueue_lock t where t.type='TO')
and a.sid=&sid;
Step 4、查看会话状态,并执行ALTER SYSTEM KILL SESSION语句杀掉这些进程:
具体操作步骤,如下截图所示:
原因: 查看ORA-14450的错误,你可以看到如下信息:
[oracle@oracle-server ~]$ oerr ora 14450
14450, 00000, "attempt to access a transactional temp table already in use"
// *Cause: An attempt was made to access a transactional temporary table that
// has been already populated by a concurrent transaction of the same
// session.
// *Action: do not attempt to access the temporary table until the
// concurrent transaction has committed or aborted.
ORA-14450: attempt to access a transactional temp table already in use的更多相关文章
- cannot access the system temp folder
cannot access the system temp folder. please, make sure your application have full control rights on ...
- Access to the temp directory is denied. Identity 'NT AUTHORITY\NETWORK SERVICE' under which XmlSerializer is running does not have sufficient permiss
造成错误的原因是用bat代码清理系统垃圾时造成的权限丢失而引起的 错误描述 1.An error occurred creating the configuration section handler ...
- Oracle temp table
Tow kinds of temp table data keep method. One is delete when commit Anothe one is preseve when commi ...
- temp table
在Oracle8i或以上版本中,可以创建以下两种临时表: 1.会话特有的临时表 CREATE GLOBAL TEMPORARY <TABLE_NAME> ( <column spec ...
- [ DB ] [ SQL ] [ SQL Server ] MS SQL 建立暫存表格 temp table - 轉載
範例 SQL: IF OBJECT_ID(N'tempdb.dbo.#tmp_checkStatusCount', N'U') IS NOT NULL DROP TABLE #tmp_checkSta ...
- Deploying Customizations in Oracle E-Business Suite Release 12.2
DeployingCustomizations in Oracle E-Business Suite Release 12.2 This documentdescribes how to deploy ...
- ORACLE 博客文章目录(2015-05-27更新)
从接触ORACLE到深入学习,已有好几年了,虽然写的博客不多,质量也参差不齐,但是,它却是成长的历程的点点滴滴的一个见证,见证了我在这条路上的寻寻觅觅,朝圣的心路历程,现在将ORACLE方面的博客整理 ...
- Oracle 临时事务表 全局临时表_global temporary table
所有的操作都在一个事务里,事务提交后,此表清空,特别适合做插入删除频率特别高的临时表操作,比如插入完数据就开始查询,查询完就删掉等,用完就扔! 临时表分事务级临时表和会话级临时表. 事务级临时表只对当 ...
- ORA-14450
ORA-14450 attempt to access a transactional temp table already in use Cause: An attempt was made to ...
随机推荐
- es6分享——变量的解构赋值
变量的解构赋值:ES6 允许按照一定模式,从数组和对象中提取值,对变量进行赋值,这被称为解构(Destructuring). 以前的写法: var a = 1; var b = 2; es6允许的写法 ...
- 从底层开发谈WebGIS中实现地理长度固定的可视窗口的思路和方法
文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/. 1.具体问题 在公司某边界城市的项目中,对方提出因为自己的地图安全度要 ...
- Android从网络某个地址下载文件、写入SD卡
首先创建一个HttpDownloader类,获取下载文件的网络地址,将文件下载下来以String流的方式返回: public String download(String urlStr){ //url ...
- Scala 中下划线的用途
转载自:https://my.oschina.net/leejun2005/blog/405305 Scala 作为一门函数式编程语言,对习惯了指令式编程语言的同学来说,会不大习惯,这里除了思维方式之 ...
- Net设计模式实例之单例模式( Singleton Pattern)
一.单例模式简介(Brief Introduction) 单例模式(Singleton Pattern),保证一个类只有一个实例,并提供一个访问它的全局访问点.单例模式因为Singleton封装它的唯 ...
- 【原创】Java和C#下String类型中的==和equals的原理与区别
一.Java下 1.几个例子 public static void main(String[] arge) { String str1 = new String("1234"); ...
- jQuery手机菜单
效果展示 http://hovertree.com/texiao/nav/4/ 手机扫描二维码查看效果: 源码下载 http://hovertree.com/h/bjaf/kroft6c7.htm ...
- Entity Framework
Entity Framework 待整理.. 参考链接:http://www.cnblogs.com/lsxqw2004/archive/2015/08/07/4701979.html http:// ...
- Oracle11g 配置 ST_GEOMETRY
安装环境:ArcGIS Desktop10.2.1 .ArcSDE10.2.134940. Oracle11.2.0.1 操作系统:Windows Server 2012R2 DataCenter 安 ...
- Sublime Text使用配置介绍
这篇文章很多内容都是来源自网络,发布这里当作自己留个底,以后不用到处去找 对于文本编辑器,我用过notepad2.notepad++.Editplus.UltraEdit.Vim.TextPad,都没 ...