Home >Database >Oracle >How to query oracle isolation level

How to query oracle isolation level

WBOY
WBOYOriginal
2022-06-13 10:58:337406browse

How to query the isolation level in oracle: 1. Use the "declare trans_id... begin trans_id :=...;end;" statement to put the current session in a transaction; 2. Use "SELECT s. sid, s.serial#,CASE...WHEN 0 THEN '....'ELSE '...' END AS..." statement to query the isolation level.

How to query oracle isolation level

The operating environment of this tutorial: Windows 10 system, Oracle version 12c, Dell G3 computer.

How to query the Oracle isolation level

How to view the Oracle transaction isolation level

Oracle is more troublesome, execute the following statement

1): Let The current session is in a transaction

declare
trans_id Varchar2(100);
begin
trans_id := dbms_transaction.local_transaction_id( TRUE );
end;

2): Query the isolation level

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
JOIN v$session s ON t.addr = s.taddr AND s.sid = sys_context('USERENV', 'SID');

How to query oracle isolation level

Notes:

1): If v$transaction does not exist, first consider whether the user permissions are sufficient;

2): If an empty error is reported when executing the second sentence, it is because the transaction has not been created yet (so execute the second sentence first) One sentence is executing the second sentence);

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to query oracle isolation level. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn