什么时候会删除Oracle会话临时表中的数据? [英] When will data in Oracle session temporary table get deleted?

查看:587
本文介绍了什么时候会删除Oracle会话临时表中的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读到会话表中的数据在提交过程中仍然有效.用问汤姆.

I have read that in session tables the data survives the commit process. In words of Ask Tom.

ON COMMIT PRESERVE ROWS使其成为基于会话的临时 桌子.行将保留在该表中,直到注销.只有我看得到 但是,即使在我之后,也没有其他会话会看到我的"行 提交

the ON COMMIT PRESERVE ROWS makes this a session based temporary table. rows will stay in this table until a logoff. Only I can see them though, no other session will ever see 'my' rows even after I commit

我这里的问题短语是直到注销".以维护与DB的单个连接的Web应用程序为例.因此,这意味着所有登录到Web应用程序的用户都将共享同一数据库会话.那么,这是否意味着所有用户都将在该临时表中看到相同的内容?

The problem phrase for me here is "until a logoff". Take the case of a web application which maintains a single connection to DB. So this means that all users logged into the web application are going to share the same DB session. So, does this mean that all users are going to see the same content in that temporary table?

在实际的Web应用程序中,通常我们维护多个数据库连接.这些连接被保存在一个池"中,并被许多用户重用.在这种情况下,行为可能会很不稳定,并且用户可能会查看最后一个用户填充的数据.

In a practical web application typically we maintain multiple DB connections. These connections are maintained in a "pool" and they are reused for many users. In this scenario then the behavior could be quite erratic and the user may view data populated by last user.

推荐答案

Oracle为何也提供"ON COMMIT DELETE ROWS"选项.

Which is why Oracle provides an 'ON COMMIT DELETE ROWS' option as well.

全局临时表中的数据可以具有会话范围(即ON COMMIT PRESERVE ROWS)或事务范围(ON COMMIT DELETE ROWS).

Data in global temporary tables can have session scope (i.e. ON COMMIT PRESERVE ROWS) or transaction scope (ON COMMIT DELETE ROWS).

很明显,在连接池和共享服务器/共享会话的情况下,您需要事务作用域("ON COMMIT DELETE ROWS").

Clearly, in the case of connection pooling and shared servers/shared sessions, you'll want transaction scope (ON COMMIT DELETE ROWS).

希望有帮助.

这篇关于什么时候会删除Oracle会话临时表中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆