isolation_level

本文介绍如何在Oracle数据库中设置和查询事务隔离级别,包括READ COMMITTED和SERIALIZABLE两种模式,并通过实例演示了如何使用特定的SQL语句来查看当前会话的隔离级别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天在一qq群里学到查isolation_level状态的语句

Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 
Connected as test@192.168.1.118:1521/orcl

SQL> 
SQL> alter session set isolation_level=read committed;
Session altered
SQL> update dept set  loc='SHANGHAI' where deptno=30;
1 row updated
SQL> select sid,
  2         serial#,
  3         flag,
  4         CASE
  5           WHEN BITAND(t.flag, POWER(2, 28)) = 0 THEN
  6            'READ COMMITTED'
  7           ELSE
  8            'SERIALIZABLE'
  9         END AS ISOLATIONLEVEL
 10    from V$transaction t, v$session s
 11   where t.addr = s.taddr
 12     AND audsid = USERENV('SESSIONID');
       SID    SERIAL#       FLAG ISOLATIONLEVEL
---------- ---------- ---------- --------------
       149         50       7683 READ COMMITTED
SQL> alter session set isolation_level=serializable;
Session altered
SQL> update dept set loc='CHENGDU' where deptno=30;
1 row updated
SQL> select sid,
  2         serial#,
  3         flag,
  4         CASE
  5           WHEN BITAND(t.flag, POWER(2, 28)) = 0 THEN
  6            'READ COMMITTED'
  7           ELSE
  8            'SERIALIZABLE'
  9         END AS ISOLATIONLEVEL
 10    from V$transaction t, v$session s
 11   where t.addr = s.taddr
 12     AND audsid = USERENV('SESSIONID');
       SID    SERIAL#       FLAG ISOLATIONLEVEL
---------- ---------- ---------- --------------
        20         66  268443139 SERIALIZABLE



set_level_shifter strategy_name -domain domain_name [-elements port_pin_list] [-exclude_elements exclude_list] [-applies_to inputs | outputs | both] [-applies_to_boundary upper | lower | both] [-threshold float] [-rule low_to_high | high_to_low | both] [-location self | parent | fanout | automatic] [-no_shift] [-force_shift] [-name_prefix prefix_string] [-name_suffix suffix_string] [-update] set_level_shifter –domain domain_name –elements ... [–applies_to ...] set_level_shifter –domain domain_name –applies_to [inputs | outputs] set_level_shifter –domain domain_name map_level_shifter_cell strategy_name -domain power_domain_name -lib_cells list use_interface_cell interface_implementation_name -domain domain_name -lib_cells lib_cell_list -strategy list_of_one_level_shifter_and_or_one_isolation set_isolation isolation_strategy_name -domain power_domain [-elements objects] [-exclude_elements exclude_list] [-applies_to inputs | outputs | both] [-applies_to_boundary upper | lower | both] [-clamp_value 0 | 1 | latch] [-isolation_power_net isolation_power_net] [-isolation_ground_net isolation_ground_net] [-isolation_supply isolation_supply_set] [-source source_supply_set_name] [-sink sink_supply_set_name] [-diff_supply_only true | false] [-no_isolation] [-force_isolation] [-name_prefix prefix_string] set_isolation_control isolation_strategy_name -domain power_domain -isolation_signal isolation_signal load_upf upf_file_name [-supplemental supf_file_name] [-scope string] [-noecho] save_upf upf_file_name [-supplemental supf_file_name] [-include_supply_exceptions] [-full_upf] 解释每一句命令什么意思
07-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值