View and change the default transaction isolation level in mysql, oracle, sql server

Uncommitted read (minimum level of isolated transaction, only guaranteed not to read physically corrupt data)

Read Committed (the default level for the database engine)

repeatable read

Serializable (the highest level of isolated transactions, complete isolation between transactions)

 

Serializable is more rigorous and high-level;

MySQL

The default transaction level of mysql is 'REPEATABLE-READ', which is repeatable read

1. View the current session isolation level

select @@tx_isolation;

2. View the current isolation level of the system

select @@global.tx_isolation;

3. Set the current session isolation level

set session transaction isolatin level repeatable read;

4. Set the current isolation level of the system

set global transaction isolation level repeatable read;

Oracle

Oracle Database supports two transaction isolation levels, READ COMMITTED and SERIALIZABLE.

The default system transaction isolation level is READ COMMITTED, that is, read has been committed

1. View the system default transaction isolation level, which is also the current session isolation level

--First create a transaction
declare
     trans_id Varchar2(100);
  begin
     trans_id := dbms_transaction.local_transaction_id( TRUE );
  end; 

--View transaction 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');

SQL Server

默认系统事务隔离级别是read committed,也就是读已提交

1.查看系统当前隔离级别

DBCC USEROPTIONS 

isolation level 这一项的 Value 既是当前的隔离级别设置值

2.设置系统当前隔离级别

SET TRANSACTION ISOLATION LEVEL Read UnCommitted;

其中Read UnCommitted为需要设置的值

 

http://www.cnblogs.com/who-else/p/6659564.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326995883&siteId=291194637