DB2使用claim & drain来控制SQL与utility对数据库对象的访问。
claim说明有对象正在访问或是将要访问该对象,而drain则是在对象上面加一个drain lock,等所有的claimers执行完成以后,对该对象进行特定的处理操作。drain lock的目的是防止多个process同时drain一个对象,从而出现drain deadlock。
二者都是对象级别的,它独立于事务锁而存在。
需要注意的drain是action,即它也是一个claim,它发出drain的指令,拿到drain lock,然后就等待其他的claimers执行完成,然后执行自己的drained claim。?
 
Claims and drains for concurrency control
Claims and drains are taken at the object level only and not at the page or row level. DB2 utilities, commands, and some ALTER, CREATE, and DROP statements can take over
access to some DB2 objects independent of any transaction locks that are held on the object.
Claims and drains on an index unlike transaction locks, the claims and drains can be taken on indexes also. DB2 utilities, commands, and some ALTER, CREATE, and DROP statements can take over access to certain objects.
index上允许有drain和claim。
The following objects are subject to takeover by those operations:
  • Simple and segmented table spaces
  • Partitions of table spaces
  • LOB table spaces
  • XML table spaces
  • Non-partitioned index spaces
  • Partitions of index spaces
  • Logical partitions of non-partitioned indexes
 
A claim is a notification to DB2 that an object is being accessed. When an application first accesses an object, within a unit of work, it makes a claim on the
object. It releases the claim at the next commit point. Unlike a transaction lock, a claim normally does not persist past the commit point. To access the object in the next unit of work,
the application must make a new claim.(claim的生命周期在一个unit work)
However, an exception exists: If a cursor defined with the WITH HOLD clause is positioned on the claimed object, the claim is not released at a commit point.
A claim indicates activity on or interest in a particular page set or partition to DB2. Claims prevent drains from occurring until the claim is released.
Three classes of claims
Table 6-1 shows the three classes of claims and the actions that they allow.
Table 6-1 Claim classes and how DB2 uses them
Claim class Notification to DB2 that the following action is being performed on the object involved
Write Reading, updating, inserting, and deleting
Repeatable read Reading only, with repeatable read (RR) isolation
Cursor stability read Reading only, with read stability (RS), cursor stability (CS), or uncommitted read (UR) isolation
A drain is the action of taking over access to an object by preventing new claims and waiting for existing claims to be released.
A utility can drain a partition when applications are accessing it. The drain quiesces the applications by allowing each one to reach a commit point, but preventing any of them, or any
other applications, from making a new claim. drain允许原有claim一直活到commit point,但不允许新的claim。When no more claims exist, the process that drains (the drainer) controls access to the drained object. The applications that were drained can still hold transaction locks on the drained object, but they cannot make new claims until the drainer has finished.
Drained claim classes
A drainer does not always need complete control. It could drain the following combinations of
claim classes:
Only the write claim class
Only the repeatable read claim class
All claim classes
For example, the CHECK INDEX utility needs to drain only writers from an index space and its associated table space. The RECOVER TABLESPACE utility, however, must drain all claim
classes from its table space. The REORG utility can drain either writers (with DRAIN WRITERS) or all claim classes (with DRAIN ALL).
How DB2 uses drain locks
A drain lock prevents conflicting processes from trying to drain the same object at the same time.
Processes that drain only writers can run concurrently, but a process that drains all claim classes cannot drain an object concurrently with any other process. To drain an object, a
drainer first acquires one or more drain locks on the object, one for each claim class that it needs to drain.(一个claim分配一个drain lock)
When the locks are in place, the drainer can begin after all processes with claims on the object have released their claims. A drain lock also prevents new claimers from accessing an object while a drainer has control of it.
Types of drain locks
Three types of drain locks on an object correspond to the three claim classes:
  • Write
  • Repeatable read
  • Cursor stability read
In general, after an initial claim has been made on an object by a user, no other user in the system needs a drain lock. When the drain lock is granted, no drains on the object are in
process for the claim class needed, and the claimer can proceed.
The claimer of an object requests a drain lock in the following exceptional case: The claim is the first claim on an object before its data set has been physically opened. Here, acquiring the
drain lock ensures that no exception states prohibit allocating the data set.
For data sharing, when the claimer gets the drain lock, it makes its claim and releases the lock before beginning its processing.

DB2 claim与drain的更多相关文章

  1. DB2重启数据库实例

    DB2重启数据库实例时,有时停止实例会失败,此时需要先确认没有应用链接数据库,然后再关闭数据库实例,并重新启动. 1.查看是否有活动的链接 命令:db2 list applications for d ...

  2. 你搞懂 ORACLE、 SQLSERVER、MYSQL与DB2的区别了吗

    ORACLE. SQLSERVER.MYSQL与DB2的区别--平台性:    Oracle.MYSQL与DB2可在所有主流平台上运行:    SQL Server只能在Windows下运行: --安 ...

  3. SharePoint Claim base authentication EnsureUser 不带claim(i:0#.w|)user Failed

    环境信息: 带有Form base authentication(FBA).Active Directory Federation Services(ADFS).以及windows Authentic ...

  4. C# 连接DB2字符串 Oracle免安装客户端连接字符串

    以下是DB2连接数据库 1)使用IBM.Data.DB2链接DB2数据库 2)必须安装DB2客户端,IBM.Data.DB2在安装的BIN里可以找到 3)注意一下DB2客户端版本问题,我的就是WIN7 ...

  5. DB2错误码信息

    00 完全成功完成 表 3  01 警告 表 4  02 无数据 表 5  07 动态 SQL 错误 表 6  08 连接异常 表 7  09 触发操作异常 表 8  0A 功能部件不受支持 表 9  ...

  6. DB2数据库参数建议(AIX)

    修改用户最大进程数: chdev -l sys0 -a maxuproc=' 用户资源配置:对实例用户,fence用户,应用用户添加如下限制: db2inst1 : fsize=- fsize_har ...

  7. db2定界符

    在DB2数据库中,在导出DEL文件时,默认的字符分隔符是".字段分隔符是, (逗号).有一个需求是要为Oracle数据库提供数据,因此就想使用"|"作为数据的字段分隔符. ...

  8. db2基础

    DB2知识文档 一.db2 基础 基本语法 注释:"--"(两个减号) 字符串连接:"||" 如set msg='aaaa'||'bbbb',则msg为'aaa ...

  9. db2 日期时间格式

    db2日期和时间常用汇总 1.db2可以通过SYSIBM.SYSDUMMY1.SYSIBM.DUAL获取寄存器中的值,也可以通过VALUES关键字获取寄存器中的值. SELECT 'HELLO DB2 ...

随机推荐

  1. php 实现冒泡算法排序、快速排序、选择排序,插入排序

    许多人都说 算法是程序的核心,一个程序的好于差,关键是这个程序算法的优劣.作为一个初级phper,虽然很少接触到算法方面的东西 .但是对于冒泡排序,插入排序,选择排序,快速排序四种基本算法,我想还是要 ...

  2. Number of 1 Bits(Difficulty: Easy)

    题目: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also ...

  3. Meta http-equiv属性与HTTP头的Expires中(Cache-control)详解

    一.概述 A.http-equiv顾名思义,相当于http的文件头作用,它可以向浏览器传回一些有用的信息,以帮助正确和精确地显示网页内容,与之对应的属性值为content,content中的内容其实就 ...

  4. valueForKeyPath常用用法

    valueForKeyPath和valueForKey有一些类似,但也有一些不同的地方.这里就简单说一下valueForKeyPath一些不同的地方. 举例来说: 1.valueForKeyPath可 ...

  5. 一个Ubuntu源更新错误及解决办法

    InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?) 尝试进 ...

  6. Guid和Sequence做主键的比较

    记得A项目组是一个物流管理系统,后台采用了Oracle数据库.在系统中的核心表托运单表中,关于主键采用何种数据类型,是 sequence 还是用GUID , 大家起了争论. 从网络搜索得到的结论看,一 ...

  7. job console部署

    1. iis配置 1.1 应用程序池配置成经典模式 1.2 增加mini类型.svc,application/octet-stream 1.3 增加脚本映射,*.svc,%windir%\Micros ...

  8. 用jQuery做一个三级菜单,鼠标移动到二级菜单的选项上,然后再迅速离开后,当鼠标再移动到该一级菜单或其他二级菜单选项,三级菜单也会显示。

    用jQuery做一个三级菜单,鼠标移动到二级菜单的选项上,然后再迅速离开后,当鼠标再移动到该一级菜单或其他二级菜单选项,三级菜单也会显示. 原因:在为一个元素绑定hover事件之后,用户把光标移入元素 ...

  9. 我的第一个HTML的程序

    <html> <head><title>title为显示标签页的内容</title></head> <body> <h1& ...

  10. C语言复杂声明-void (*signal(int sig, void (*handler)(int)))(int);

    问题提出 请分析此声明:void (*signal(int sig, void (*handler)(int)))(int); 求解过程 在对上面的例子作分析之前,我们需要了解C语言的声明优先级,&l ...