ITPub博客

首页 > 数据库 > Oracle > 查看oracle数据库session事务设置的是哪个隔离级别

查看oracle数据库session事务设置的是哪个隔离级别

翻译 Oracle 作者:ilsyx 时间:2022-04-14 11:21:39 0 删除 编辑

Oracle JDBC Driver支持的事务隔离级别设置

For transactions, the Oracle server supports only the TRANSACTION_READ_COMMITTED
and TRANSACTION_SERIALIZABLE transaction isolation levels.

The default is TRANSACTION_READ_COMMITTED.

Use the following methods of the oracle.jdbc.OracleConnection interface to get and set the level:

  • getTransactionIsolation(): Gets this connection's current transaction isolation level.
  • setTransactionIsolation(): Changes the transaction isolation level,

So with Oracle JDBC driver the possible transaction isolation levels are
TRANSACTION_READ_COMMITED and the TRANSACTION_SERIALIZABLE.

Trying to set any other transaction isolation level will cast the following exception:

"EXCEPTIONS : Code 17030 SQL State null Message READ_COMMITTED and
SERIALIZABLE are the only valid transaction levels".


查看oracle数据库session事务设置的是哪个隔离级别

connect system/manager

SQL> update scott.emp set empno=7369 where empno=7369;

1 row updated.

SQL> select
decode(bitand(flag,268435456),268435456,'serializable','non-serializable')
from v$transaction,v$session
where taddr=addr and sid=(select sid from v$mystat where rownum <2);

DECODE(BITAND(FL
----------------
non-serializable

SQL> rollback;

Rollback complete.

SQL> set transaction isolation level serializable;

Transaction set.

SQL> update scott.emp set empno=7369 where empno=7369;

1 row updated.

SQL> select
decode(bitand(flag,268435456),268435456,'serializable','non-serializable')

from v$transaction,v$session
where taddr=addr and sid=(select sid from v$mystat where rownum <2);

DECODE(BITAND(FL
----------------
serializable 




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11780477/viewspace-2887054/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-06-12

  • 博文量
    203
  • 访问量
    662397