檢視oracle資料庫session事務設定的是哪個隔離級別

ilsyx發表於2022-04-14

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部落格 ” ,連結:http://blog.itpub.net/11780477/viewspace-2887054/,如需轉載,請註明出處,否則將追究法律責任。

相關文章