SlideShare a Scribd company logo
1 of 14
Download to read offline
WareValley
http://www.WareValley.com
Database Audit and Protection [ DB 접근통제 ]
Database Encryption [ DB 암호화 ]
Database Vulnerability Assessment [ DB 취약점 분석 ]
Database SQL Query Approval [ DB 작업결재 ]
Database Performance Monitoring and Management [ DB 성능관리 및 개발 ]
WareValley
Oracle Transaction
Concurrency Control & Read Consistency
오렌지팀 윤석준 선임연구원
Database security and management, WareValley.
http://www.WareValley.com
Oracle Transaction
Concurrency Control
동시에 수행되는 Transaction 수를 최대화 하면서,
INSERT, UPDATE, DELETE, SELECT 시
Data의 무결성을 유지하도록 노력하는 것
Database security and management, WareValley.
http://www.WareValley.com
Concurrency
Concurrency Parallelism
 하나 뿐인 바나나를 3명이서 먹기위해 경쟁
(한정된 자원을 공유하기 위한 매커니즘)
e.g. Database transaction, Lock
C++ thread, async, task
 각자 다른 자원을 사용해서 동시에 수행
(Concurrency는 동시에 수행 될 수도 있는 거지만,
Parallel은 정말 동시에 수행됨을 보장)
Database security and management, WareValley.
http://www.WareValley.com
Concurrency vs Consistency
• Concurrency
다중 사용자가 같은 Data를 동시에 Access
• Consistency
특정 시점 (또는 Transaction)에서
일관성 있게 Data를 제공
Concurrency 와 Consistency는
Trade-off 관계
Database security and management, WareValley.
http://www.WareValley.com
Transaction의 특징 (ACID)
• Atomicity (원자성) : 더 이상 분해되면 안되는 업무의 최소 단위
• Consistency (일관성) : 실행 성공 후 Database 상태 일관성 유지
• Isolation (격리성) : 실행 중 중간 결과는 다른 트랜잭션에서 접근이 불가능
• Durability (영속성) : 실행 결과는 Database에 영구적으로 저장
Database security and management, WareValley.
http://www.WareValley.com
Transaction-Level
Read Consistency
Database security and management, WareValley.
http://www.WareValley.com
Read Consistency
• State-Level Read Consistency
- Query가 시작된 시점 ( SCN ) 기준으로 Data를 일관성 있게 읽는 것
• Transaction-Level Read Consistency
- Transaction이 시작된 시점 기준으로 Data를 일관성 있게 읽는 것
- 대부분의 DBMS가 기본적으로 보장하지 않음
- Transaction Isolation Level을 높여서 보장 받는 방법을 제공
Database security and management, WareValley.
http://www.WareValley.com
Transaction Isolation Level
Dirty Read / Non-Repeatable Read / Phantom Read
Level 0 : Read Uncommited
 대부분 DBMS (Oracle 포함) 에서 지원하지 않음
 Commit 된 Data만 읽음 ( Dirty Read 방지 )
 대부분 DBMS (Oracle 포함) 가 기본 설정으로 채택
 DB2, MS-SQL, Sybase : Shared-Lock으로 구현. 읽을 때 Lock 설정, 다 읽은 뒤 해제
 Oracle : Undo Segment를 이용하여 제공
Dirty Read / Non-Repeatable Read / Phantom Read
Level 1 : Read Commited
Database security and management, WareValley.
http://www.WareValley.com
Transaction Isolation Level
Dirty Read / Non-Repeatable Read / Phantom Read
Level 2 : Repeatable Read
 Level 2 + 새로운 Record 삽입도 금지
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
Dirty Read / Non-Repeatable Read / Phantom Read
Level 3 : Serializable
 Transaction에서 읽은 Data는 종료시까지 다른 Transaction에서 갱신, 삭제 불가
-> 같은 Data를 여러 번 읽어도 Transaction 내에서는 일관성 유지
 DB2, MS-SQL, Sybase : Shared-Lock을 Transaction 종료까지 유지
 Oracle : 명시적으로 지원하지 않지만, FOR UPDATE 절을 이용하여 구현 가능
Database security and management, WareValley.
http://www.WareValley.com
Dirty Read ( = Uncommitted Dependency )
• 아직 Commit 되지 Data를 다른 Transaction에서 읽을 수 있도록 허용
• 대부분의 DBMS가 Level 1을 기본설정으로 하여 발생하지 않음
• MS-SQL은 기능 제공
- SELECT 문의 FROM 절의 Table 명 뒤에 WITH (NOLOCK) 을 붙이면,
UPDATE, DELETE 수행 중인 Data를 읽을 수 있음
- Stored Procedure의 경우에는 시작 부분에
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITED; 삽입하면 됨
Database security and management, WareValley.
http://www.WareValley.com
Non-Repeatable Read ( = Inconsistant Analysis )
Transaction 내에서 값을 2번 읽었는데 값이 다르게 나타는 비일관성
( 다른 Transaction에서 값을 수정한 경우 )
< Tx 1 > < Tx 2 >
IF :amt >= 50000 THEN
UPDATE cust SET grade = 'A'
WHERE id = 123;
ELSE
UPDATE cust SET grade = 'B'
WHERE id = 123;
END IF;
SELECT amount INTO :amt FROM cust
WHERE id = 123;
t1
UPDATE cust
SET amount = 60000, grade = 'A'
WHERE id = 123;
COMMIT;
t2
t3
Database security and management, WareValley.
http://www.WareValley.com
Phantom Read
Transaction 내의 일정 범위의 Record들을 2번 읽었는데, 첨엔 없었던 유령 Record가 두번째에 나타나는 현상
( 다른 Transaction에서 새로운 Record를 삽입한 경우 )
< Tx 1 > < Tx 2 >
INSERT INTO custPerAge
SELECT age, COUNT(*) FROM cust GROUP BY age;
COMMIT;
INSERT INTO custPerArea
SELECT area, COUNT(*) FROM cust GROUP BY area;
t1
INSERT INTO cust VALUES (:a, :b, :c, :d, ...);
COMMIT;
t2
t3
 MS-SQL : Lock을 이용하여 t2의 실행을 Block
 Oracle : t1 시점에 존재했던 Data만을 대상으로 t3 실행
( DELETE ALL 도 동일한 범위만 실행)
Database security and management, WareValley.
http://www.WareValley.com
Isolation Level vs Consistency, Concurrency
 Transaction Isolation Level을 높이면
Consistency는 향상되지만,
Concurrency는 저하된다.
(왜 ? Lock을 사용하니깐 !)
 Oracle은 Lock을 사용하지 않는다.
고로 Oracle은 Concurrency 저하가 없다.
Database security and management, WareValley.
http://www.WareValley.com
ORA-08177 ( SERIALIZABLE_ABORTS )
Oracle의 Lock을 사용하지 않는 특성 때문에,
Transaction-Level Read Consistency를 지원 못해줄 때 발생
< Tx 1 > < Tx 2 >
can’t serialize access for this transaction

More Related Content

Viewers also liked

[2015-05-22] Oracle Ways of Concurrency Control
[2015-05-22] Oracle Ways of Concurrency Control[2015-05-22] Oracle Ways of Concurrency Control
[2015-05-22] Oracle Ways of Concurrency ControlSeok-joon Yun
 
MariaDB Other Features
MariaDB Other FeaturesMariaDB Other Features
MariaDB Other FeaturesJongJin Lee
 
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstatSeok-joon Yun
 
MariaDB
MariaDBMariaDB
MariaDBymtech
 
MariaDB Optimization
MariaDB OptimizationMariaDB Optimization
MariaDB OptimizationJongJin Lee
 
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 미리보기
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 미리보기『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 미리보기
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 미리보기복연 이
 
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀EXEM
 
7급 공무원도 쉽게 따라하는 쉘 스크립트
7급 공무원도 쉽게 따라하는 쉘 스크립트7급 공무원도 쉽게 따라하는 쉘 스크립트
7급 공무원도 쉽게 따라하는 쉘 스크립트Young-Ho Cha
 
간단한 쉘 스크립트 작성하기
간단한 쉘 스크립트 작성하기간단한 쉘 스크립트 작성하기
간단한 쉘 스크립트 작성하기licubeclub
 
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 구성 지도
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 구성 지도『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 구성 지도
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 구성 지도복연 이
 
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략KTH
 
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1Seok-joon Yun
 
개발자도 알아야 하는 DBMS튜닝
개발자도 알아야 하는 DBMS튜닝개발자도 알아야 하는 DBMS튜닝
개발자도 알아야 하는 DBMS튜닝정해 이
 
조대협의 서버 사이드 - 대용량 아키텍처와 성능튜닝
조대협의 서버 사이드 - 대용량 아키텍처와 성능튜닝조대협의 서버 사이드 - 대용량 아키텍처와 성능튜닝
조대협의 서버 사이드 - 대용량 아키텍처와 성능튜닝Mungyu Choi
 

Viewers also liked (16)

[2015-05-22] Oracle Ways of Concurrency Control
[2015-05-22] Oracle Ways of Concurrency Control[2015-05-22] Oracle Ways of Concurrency Control
[2015-05-22] Oracle Ways of Concurrency Control
 
Oracle History #9
Oracle History #9Oracle History #9
Oracle History #9
 
MariaDB Other Features
MariaDB Other FeaturesMariaDB Other Features
MariaDB Other Features
 
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
[2015-07-10-윤석준] Oracle 성능 관리 & v$sysstat
 
MariaDB
MariaDBMariaDB
MariaDB
 
MariaDB Optimization
MariaDB OptimizationMariaDB Optimization
MariaDB Optimization
 
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 미리보기
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 미리보기『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 미리보기
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 미리보기
 
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
 
7급 공무원도 쉽게 따라하는 쉘 스크립트
7급 공무원도 쉽게 따라하는 쉘 스크립트7급 공무원도 쉽게 따라하는 쉘 스크립트
7급 공무원도 쉽게 따라하는 쉘 스크립트
 
간단한 쉘 스크립트 작성하기
간단한 쉘 스크립트 작성하기간단한 쉘 스크립트 작성하기
간단한 쉘 스크립트 작성하기
 
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 구성 지도
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 구성 지도『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 구성 지도
『프로젝트 성패를 결정짓는 데이터 모델링 이야기』 - 구성 지도
 
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
 
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
 
개발자도 알아야 하는 DBMS튜닝
개발자도 알아야 하는 DBMS튜닝개발자도 알아야 하는 DBMS튜닝
개발자도 알아야 하는 DBMS튜닝
 
조대협의 서버 사이드 - 대용량 아키텍처와 성능튜닝
조대협의 서버 사이드 - 대용량 아키텍처와 성능튜닝조대협의 서버 사이드 - 대용량 아키텍처와 성능튜닝
조대협의 서버 사이드 - 대용량 아키텍처와 성능튜닝
 
MySQL 기초
MySQL 기초MySQL 기초
MySQL 기초
 

More from Seok-joon Yun

Retrospective.2020 03
Retrospective.2020 03Retrospective.2020 03
Retrospective.2020 03Seok-joon Yun
 
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image ConverterAWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image ConverterSeok-joon Yun
 
아파트 시세,어쩌다 머신러닝까지
아파트 시세,어쩌다 머신러닝까지아파트 시세,어쩌다 머신러닝까지
아파트 시세,어쩌다 머신러닝까지Seok-joon Yun
 
Pro typescript.ch07.Exception, Memory, Performance
Pro typescript.ch07.Exception, Memory, PerformancePro typescript.ch07.Exception, Memory, Performance
Pro typescript.ch07.Exception, Memory, PerformanceSeok-joon Yun
 
Doing math with python.ch07
Doing math with python.ch07Doing math with python.ch07
Doing math with python.ch07Seok-joon Yun
 
Doing math with python.ch06
Doing math with python.ch06Doing math with python.ch06
Doing math with python.ch06Seok-joon Yun
 
Doing math with python.ch05
Doing math with python.ch05Doing math with python.ch05
Doing math with python.ch05Seok-joon Yun
 
Doing math with python.ch04
Doing math with python.ch04Doing math with python.ch04
Doing math with python.ch04Seok-joon Yun
 
Doing math with python.ch03
Doing math with python.ch03Doing math with python.ch03
Doing math with python.ch03Seok-joon Yun
 
Doing mathwithpython.ch02
Doing mathwithpython.ch02Doing mathwithpython.ch02
Doing mathwithpython.ch02Seok-joon Yun
 
Doing math with python.ch01
Doing math with python.ch01Doing math with python.ch01
Doing math with python.ch01Seok-joon Yun
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
 
C++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threadsC++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threadsSeok-joon Yun
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++Seok-joon Yun
 
[2015-07-20-윤석준] Oracle 성능 관리 2
[2015-07-20-윤석준] Oracle 성능 관리 2[2015-07-20-윤석준] Oracle 성능 관리 2
[2015-07-20-윤석준] Oracle 성능 관리 2Seok-joon Yun
 
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4Seok-joon Yun
 
오렌지6.0 교육자료
오렌지6.0 교육자료오렌지6.0 교육자료
오렌지6.0 교육자료Seok-joon Yun
 

More from Seok-joon Yun (20)

Retrospective.2020 03
Retrospective.2020 03Retrospective.2020 03
Retrospective.2020 03
 
Sprint & Jira
Sprint & JiraSprint & Jira
Sprint & Jira
 
Eks.introduce.v2
Eks.introduce.v2Eks.introduce.v2
Eks.introduce.v2
 
Eks.introduce
Eks.introduceEks.introduce
Eks.introduce
 
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image ConverterAWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
AWS DEV DAY SEOUL 2017 Buliding Serverless Web App - 직방 Image Converter
 
아파트 시세,어쩌다 머신러닝까지
아파트 시세,어쩌다 머신러닝까지아파트 시세,어쩌다 머신러닝까지
아파트 시세,어쩌다 머신러닝까지
 
Pro typescript.ch07.Exception, Memory, Performance
Pro typescript.ch07.Exception, Memory, PerformancePro typescript.ch07.Exception, Memory, Performance
Pro typescript.ch07.Exception, Memory, Performance
 
Doing math with python.ch07
Doing math with python.ch07Doing math with python.ch07
Doing math with python.ch07
 
Doing math with python.ch06
Doing math with python.ch06Doing math with python.ch06
Doing math with python.ch06
 
Doing math with python.ch05
Doing math with python.ch05Doing math with python.ch05
Doing math with python.ch05
 
Doing math with python.ch04
Doing math with python.ch04Doing math with python.ch04
Doing math with python.ch04
 
Doing math with python.ch03
Doing math with python.ch03Doing math with python.ch03
Doing math with python.ch03
 
Doing mathwithpython.ch02
Doing mathwithpython.ch02Doing mathwithpython.ch02
Doing mathwithpython.ch02
 
Doing math with python.ch01
Doing math with python.ch01Doing math with python.ch01
Doing math with python.ch01
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScript
 
C++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threadsC++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threads
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++
 
[2015-07-20-윤석준] Oracle 성능 관리 2
[2015-07-20-윤석준] Oracle 성능 관리 2[2015-07-20-윤석준] Oracle 성능 관리 2
[2015-07-20-윤석준] Oracle 성능 관리 2
 
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
 
오렌지6.0 교육자료
오렌지6.0 교육자료오렌지6.0 교육자료
오렌지6.0 교육자료
 

[2015 05-15] Oracle Transaction Concurrency Control & Read Consistency

  • 1. WareValley http://www.WareValley.com Database Audit and Protection [ DB 접근통제 ] Database Encryption [ DB 암호화 ] Database Vulnerability Assessment [ DB 취약점 분석 ] Database SQL Query Approval [ DB 작업결재 ] Database Performance Monitoring and Management [ DB 성능관리 및 개발 ] WareValley Oracle Transaction Concurrency Control & Read Consistency 오렌지팀 윤석준 선임연구원
  • 2. Database security and management, WareValley. http://www.WareValley.com Oracle Transaction Concurrency Control 동시에 수행되는 Transaction 수를 최대화 하면서, INSERT, UPDATE, DELETE, SELECT 시 Data의 무결성을 유지하도록 노력하는 것
  • 3. Database security and management, WareValley. http://www.WareValley.com Concurrency Concurrency Parallelism  하나 뿐인 바나나를 3명이서 먹기위해 경쟁 (한정된 자원을 공유하기 위한 매커니즘) e.g. Database transaction, Lock C++ thread, async, task  각자 다른 자원을 사용해서 동시에 수행 (Concurrency는 동시에 수행 될 수도 있는 거지만, Parallel은 정말 동시에 수행됨을 보장)
  • 4. Database security and management, WareValley. http://www.WareValley.com Concurrency vs Consistency • Concurrency 다중 사용자가 같은 Data를 동시에 Access • Consistency 특정 시점 (또는 Transaction)에서 일관성 있게 Data를 제공 Concurrency 와 Consistency는 Trade-off 관계
  • 5. Database security and management, WareValley. http://www.WareValley.com Transaction의 특징 (ACID) • Atomicity (원자성) : 더 이상 분해되면 안되는 업무의 최소 단위 • Consistency (일관성) : 실행 성공 후 Database 상태 일관성 유지 • Isolation (격리성) : 실행 중 중간 결과는 다른 트랜잭션에서 접근이 불가능 • Durability (영속성) : 실행 결과는 Database에 영구적으로 저장
  • 6. Database security and management, WareValley. http://www.WareValley.com Transaction-Level Read Consistency
  • 7. Database security and management, WareValley. http://www.WareValley.com Read Consistency • State-Level Read Consistency - Query가 시작된 시점 ( SCN ) 기준으로 Data를 일관성 있게 읽는 것 • Transaction-Level Read Consistency - Transaction이 시작된 시점 기준으로 Data를 일관성 있게 읽는 것 - 대부분의 DBMS가 기본적으로 보장하지 않음 - Transaction Isolation Level을 높여서 보장 받는 방법을 제공
  • 8. Database security and management, WareValley. http://www.WareValley.com Transaction Isolation Level Dirty Read / Non-Repeatable Read / Phantom Read Level 0 : Read Uncommited  대부분 DBMS (Oracle 포함) 에서 지원하지 않음  Commit 된 Data만 읽음 ( Dirty Read 방지 )  대부분 DBMS (Oracle 포함) 가 기본 설정으로 채택  DB2, MS-SQL, Sybase : Shared-Lock으로 구현. 읽을 때 Lock 설정, 다 읽은 뒤 해제  Oracle : Undo Segment를 이용하여 제공 Dirty Read / Non-Repeatable Read / Phantom Read Level 1 : Read Commited
  • 9. Database security and management, WareValley. http://www.WareValley.com Transaction Isolation Level Dirty Read / Non-Repeatable Read / Phantom Read Level 2 : Repeatable Read  Level 2 + 새로운 Record 삽입도 금지 SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; Dirty Read / Non-Repeatable Read / Phantom Read Level 3 : Serializable  Transaction에서 읽은 Data는 종료시까지 다른 Transaction에서 갱신, 삭제 불가 -> 같은 Data를 여러 번 읽어도 Transaction 내에서는 일관성 유지  DB2, MS-SQL, Sybase : Shared-Lock을 Transaction 종료까지 유지  Oracle : 명시적으로 지원하지 않지만, FOR UPDATE 절을 이용하여 구현 가능
  • 10. Database security and management, WareValley. http://www.WareValley.com Dirty Read ( = Uncommitted Dependency ) • 아직 Commit 되지 Data를 다른 Transaction에서 읽을 수 있도록 허용 • 대부분의 DBMS가 Level 1을 기본설정으로 하여 발생하지 않음 • MS-SQL은 기능 제공 - SELECT 문의 FROM 절의 Table 명 뒤에 WITH (NOLOCK) 을 붙이면, UPDATE, DELETE 수행 중인 Data를 읽을 수 있음 - Stored Procedure의 경우에는 시작 부분에 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITED; 삽입하면 됨
  • 11. Database security and management, WareValley. http://www.WareValley.com Non-Repeatable Read ( = Inconsistant Analysis ) Transaction 내에서 값을 2번 읽었는데 값이 다르게 나타는 비일관성 ( 다른 Transaction에서 값을 수정한 경우 ) < Tx 1 > < Tx 2 > IF :amt >= 50000 THEN UPDATE cust SET grade = 'A' WHERE id = 123; ELSE UPDATE cust SET grade = 'B' WHERE id = 123; END IF; SELECT amount INTO :amt FROM cust WHERE id = 123; t1 UPDATE cust SET amount = 60000, grade = 'A' WHERE id = 123; COMMIT; t2 t3
  • 12. Database security and management, WareValley. http://www.WareValley.com Phantom Read Transaction 내의 일정 범위의 Record들을 2번 읽었는데, 첨엔 없었던 유령 Record가 두번째에 나타나는 현상 ( 다른 Transaction에서 새로운 Record를 삽입한 경우 ) < Tx 1 > < Tx 2 > INSERT INTO custPerAge SELECT age, COUNT(*) FROM cust GROUP BY age; COMMIT; INSERT INTO custPerArea SELECT area, COUNT(*) FROM cust GROUP BY area; t1 INSERT INTO cust VALUES (:a, :b, :c, :d, ...); COMMIT; t2 t3  MS-SQL : Lock을 이용하여 t2의 실행을 Block  Oracle : t1 시점에 존재했던 Data만을 대상으로 t3 실행 ( DELETE ALL 도 동일한 범위만 실행)
  • 13. Database security and management, WareValley. http://www.WareValley.com Isolation Level vs Consistency, Concurrency  Transaction Isolation Level을 높이면 Consistency는 향상되지만, Concurrency는 저하된다. (왜 ? Lock을 사용하니깐 !)  Oracle은 Lock을 사용하지 않는다. 고로 Oracle은 Concurrency 저하가 없다.
  • 14. Database security and management, WareValley. http://www.WareValley.com ORA-08177 ( SERIALIZABLE_ABORTS ) Oracle의 Lock을 사용하지 않는 특성 때문에, Transaction-Level Read Consistency를 지원 못해줄 때 발생 < Tx 1 > < Tx 2 > can’t serialize access for this transaction