Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you see what transaction isolation level an arbitrary oracle session is using

I am trying to find out what isolation level a particular session (not my own) has on an oracle server. Is there a v$.. view to get this?

like image 770
kon5ad Avatar asked Sep 07 '10 22:09

kon5ad


People also ask

How do you determine transaction isolation level?

To check the isolation level(s) present in the statement, the simplest way is to look at the T-SQL itself and see if any hints are present. If not, it is operating at the isolation level of the connection.

How can you check the global and session transaction isolation levels at runtime?

To determine the global and session transaction isolation levels at runtime, check the value of the tx_isolation system variable: SELECT @@GLOBAL. tx_isolation, @@tx_isolation; InnoDB supports each of the translation isolation levels described here using different locking strategies.

What levels of transaction isolation are available in an Oracle database?

Oracle Database provides the transaction isolation levels: Read Committed Isolation Level. Serializable Isolation Level. Read-Only Isolation Level.

What is the default transaction isolation level in Oracle?

The default isolation level for Oracle is read committed. This degree of isolation is appropriate for environments where few transactions are likely to conflict.


1 Answers

You can test bit 28 in the flag column in v$transaction[1].

SELECT s.sid, s.serial#,
  CASE BITAND(t.flag, POWER(2, 28))
    WHEN 0 THEN 'READ COMMITTED'
    ELSE 'SERIALIZABLE'
  END AS isolation_level
FROM v$transaction t, v$session s
WHERE t.addr = s.taddr
  AND s.sid = :sid
  AND s.serial# = :serial;

Just remember that v$transaction only lists active transactions[2]; for example, you need to issue an insert/update/delete/merge, or use "for update"[3].

like image 58
Danilo Piazzalunga Avatar answered Oct 21 '22 03:10

Danilo Piazzalunga