Monthly Archives: November 2009

Notes on ‘Expert Oracle’ — No.8: Transaction

1. Transaction: … 2. Transaction in Loop    We prefer "Transaction after Loop" to "Transaction in Loop".     a. "Transaction in Loop" => Too many seperated transactions => Not Atomic     b. "Transaction in Loop" commits frequently => Undo Log more easily erased, since transaction already commited => When "restart" happens, you may see "Snap […]

Notes on ‘Expert Oracle’ — No.7.2: Concurrency–Write Consistency

1. You have already known about "Read Consistency" — 如果数据在语句/事务开始时没变化,就返回这行数据;否则,从回滚段里读它的Snapshot. 这叫做"Consistent Read" 2. 与之相对的是 “Current Read” — 不去读回滚段,而是从当前数据文件里去读。    a. When does it happen? 在准备修改数据时进行Current Read    b. 举例说明,        Update t set y = 1 where x = 5           i.首先会执行 "select .. from t where x = 5",这个过程使用的是"Consistent Read",即找到回滚段里满足 x = 5的记录            […]

Notes on ‘Expert Oracle’ — No.7.1: Concurrency–Concurrency with Multi-version

1. Oracle除了用锁实现并发控制,还利用了“多版本机制”— 一条数据除了会记在表文件里,还会记在“回滚段”里。 2. 具体的并发控制策略    a.ANSI标准定义的并发控制级别(从低到高)       i. Read Uncommited (可以读到脏数据)      ii. Read Commited   (不能读到脏数据)      iii. Repeatable Read (在同一个事务里两次读某条数据,读到的值一定是一样的。一个典型的反面例子是“丢失更新”)      iv. Serializable (不但可以重复读,而且还可以保证没有 幻读)         b.Oracle支持哪些级别?       i.Read Uncommited — 在Oracle中想脏读都读不到!      ii. Read Commited  — 支持,是Oracle的默认级别。Oralce不仅支持这个级别, 而且还有所增强:可以保证 “读一致性”(见下文)      iii. Repeatable Read — 不直接支持。需自己编程实现。      iv. Serializable — 支持。但是由于未使用锁机制,因此 不能真正地实现“串行” […]

Notes on ‘Expert Oracle’ — No.5.1: Oracle Processes — Server Processes

1. Server Process   a.Dedicated Server: one TCP/IP connection, one server process   b.Shared Server: Serveral tcp/ip connections => one dispatcher => A pool of processes 2.Connection V.S. Session   In terms of Domain Logic, the two are not ‘associated’ with each other, they only ‘depend’ each other.    a. A connection is physical network […]