DB(Database)/MSSQL

SQL Server Architecture

ํƒฑ์ ค 2022. 6. 13. 16:26

DBMS ์•„ํ‚คํ…์ฒ˜

- DBMS๋Š” ์ ์–ด๋„ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค์™€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ํฌํ•จ

- ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” ์œ ์ €(์‘์šฉ)๋ฐ์ดํ„ฐ์™€ ์‹œ์Šคํ…œ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฌผ๋ฆฌ ํŒŒ์ผ๋“ค๋กœ ๊ตฌ์„ฑ

- ์ธ์Šคํ„ด์Šค๋Š” DBMS ์‚ฌ์šฉ์ž๊ฐ€ ๋ฐ์ดํ„ฐ์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š” ์‹œ์Šคํ…œ ๋ฆฌ์†Œ์Šค(memory, process)๋กœ ๊ตฌ์„ฑ

** process: ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์˜ ์‹คํ–‰ ๋‹จ์œ„, process ๋‚ด์— ์—ฌ๋Ÿฌ ์ž‘์—…์„ ๋™์‹œ์— ์ˆ˜ํ–‰ํ•  ๋•Œ ์ž‘์—…์˜ ๋‹จ์œ„ ๋˜๋Š” ๊ฐœ์ฒด thread


์˜ค๋ผํด ์•„ํ‚คํ…์ฒ˜

์˜ค๋ผํด ์„œ๋ฒ„ = Instance(๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ + background ํ”„๋กœ์„ธ์Šค ์˜์—ญ) + Database(์ €์žฅ ํŒŒ์ผ ์˜์—ญ)

ํด๋ผ์ด์–ธํŠธ ํ”„๋กœ์„ธ์Šค -> ์„œ๋ฒ„ ํ”„๋กœ์„ธ์Šค: client๊ฐ€ ์š”์ฒญํ•œ SQL ์ฟผ๋ฆฌ๋ฅผ server process๊ฐ€ ์‹คํ–‰ ๊ฒฐ๊ณผ ์ „๋‹ฌ, application์„ ํ†ตํ•ด ์š”์ฒญ๋œ SQL์„ parse-execute-fetch๋ฅผ ํ†ตํ•ด ์‹คํ–‰

pmon - process ๋ ˆ๋ฒจ์˜ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ resource cleanup ์ˆ˜ํ–‰

smon - system ๋ ˆ๋ฒจ์˜ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ cleanup ์ˆ˜ํ–‰, instance ์‹œ์ž‘ ์‹œ recovery ์ˆ˜ํ–‰


์˜ค๋ผํด ๋ฉ”๋ชจ๋ฆฌ ์•„ํ‚คํ…์ฒ˜

 

SGA

- ์˜ค๋ผํด ์„œ๋ฒ„์˜ ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ

- Instance์˜ ๋ฐ์ดํ„ฐ ๋ฐ ์ œ์–ด์ •๋ณด๋ฅผ ํฌํ•จํ•˜๋Š” ๊ณต์œ  ๋ฉ”๋ชจ๋ฆฌ ๊ทธ๋ฃน

- ๋ชจ๋“  ์„œ๋ฒ„ ๋ฐ Background ํ”„๋กœ์„ธ์Šค์— ์˜ํ•ด ๊ณต์œ 

- ๊ด€๋ จ parameter: sga_max_size, sga_target

Shared Pool

- DB์—์„œ ๋ฐœ์ƒํ•˜๋Š” ๋Œ€๋ถ€๋ถ„์˜ ์—ฐ์‚ฐ์— ๊ด€๊ณ„๋œ ํ”„๋กœ๊ทธ๋žจ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๋Š” ์˜์—ญ

- Shared Pool = Library Cache + Data Dictionary Cache + ๊ธฐํƒ€
- Library Cache: ์‹ซํ–‰๋œ SQL, PLSQL๋ฌธ(SQL๋ฌธ์˜ ํ™•์žฅ๋œ ๊ฐœ๋…)์˜ ๊ตฌ๋ฌธ๋ถ„์„๋œ ์ฝ”๋“œ์™€ ์‹คํ–‰์— ํ•„์š”ํ•œ ์‹คํ–‰๊ณ„ํš์„ ์ €์žฅ

- Data Dictionary Cache: ์ตœ๊ทผ์— ์‚ฌ์šฉ๋œ ๋ฉ”ํƒ€์ •๋ณด๋ฅผ row ๋‹จ์œ„๋กœ ์ €์žฅ

- ๊ด€๋ จ parameter: shared_pool_size

 

Database Buffer Cache

- Datafile์—์„œ ์ฝ์€ Data Block์˜ ๋ณต์‚ฌ๋ณธ์„ ์ €์žฅํ•˜๋Š” ์˜์—ญ

- Database Buffer Cache = Default Buffer Pool + nk Buffer Pool + ๊ธฐํƒ€(Keep, Recycle)

- Buffer state: Unused/Free, Clean, Pinned, Dirty buffer

- LRU List์™€ ์ ‘๊ทผํšŸ์ˆ˜ ์กฐํ•ฉ์˜ ๋ณตํ•ฉ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ์šด์˜

- ๊ด€๋ จ parameter: db_chche_size, db_nk_cache_size

 

Redo Log Buffer

- Database์— ๋Œ€ํ•œ ๋ชจ๋“  ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ๊ธฐ๋กํ•˜๋Š” ์ˆœํ™˜ ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ

- DML ๋˜๋Š” DDL์ด ์ˆ˜ํ–‰ํ•œ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ๋ฆฌ๋‘(์žฌ์ƒ์„ฑ)ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ํ•ญ๋ชฉ์„ ๊ธฐ๋ก

- Database์˜ Recovery๋ฅผ ์œ„ํ•œ ์˜์—ญ

- LGWR ํ”„๋กœ์„ธ์Šค์— ์˜ํ•ด Online Redo Log File์— ์ €์žฅ

- ๊ด€๋ จ parameter: log_buffer

 

Large Pool

- ๋ฐฑ์—… ๋ฐ ๋ณต๊ตฌ, ๋ณ‘๋ ฌ์ฟผ๋ฆฌ ์ž‘์—…์— ๋Œ€ํ•œ ๋Œ€์šฉ๋Ÿ‰ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น ์‹œ ์‚ฌ์šฉ

- ์„ ํƒ์  ์˜์—ญ์œผ๋กœ ์ตœ์†Œ๋กœ ํ• ๋‹น

- ๊ด€๋ จ parameter: large_pool_size

 

Java Pool/Streams Pool

- Java Pool: Oracle JVM์˜ ๋ชจ๋“  ์„ธ์…˜๋ณ„ Java ์ฝ”๋“œ ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅ

- Streams Pool: Oracle Stream ํ”„๋กœ์„ธ์Šค์šฉ ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ

- ๊ด€๋ จ parameter: java_pool_size, streams_pool_size

 

PGA

- ์„œ๋ฒ„ ํ”„๋กœ์„ธ์Šค์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ ๋ฐ ์ œ์–ด์ •๋ณด๋ฅผ ํฌํ•จํ•˜๋Š” private ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ

- PGA = SQL Work Area + Private SQL Area + Session Area

- SQL Work Area: ๋ฐ์ดํ„ฐ ์ •๋ ฌ, ํ•ด์‹œ ์กฐ์ธ, ๋น„ํŠธ๋งต ์ธ๋ฑ์Šค ์ƒ์„ฑ ์˜์—ญ์ด ํฌํ•จ

- Private SQL Area: ์‹คํ–‰๋˜๋Š” SQL ๋ฐ PLSQL์˜ ์ƒํƒœ, bind ๋ณ€์ˆ˜, ์ปค์„œ์˜ runtime ์ •๋ณด ๋“ฑ์„ ํฌํ•จ

- Session Area: ์œ ์ € ์„ธ์…˜์— ๋Œ€ํ•œ ์ œ์–ด ์ •๋ณด๋ฅผ ํฌํ•จ

- ๊ด€๋ จ parameter: pga_aggregate_target


์˜ค๋ผํด Process Architecture

 

- User Process : ์‘์šฉํ”„๋กœ๊ทธ๋žจ ๋˜๋Š” ์˜ค๋ผํด ๋„๊ตฌ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ํ”„๋กœ์„ธ์Šค

$ ์‚ฌ์šฉ์ž๊ฐ€ ์˜ค๋ผํด application์„ ์‹คํ–‰ํ–ˆ์„ ๋•Œ OS๊ฐ€ ์ƒ์„ฑํ•˜๋Š” client process (SQL*PLUS, PRO*C, Toad ๋“ฑ)

$ Client Application์€ ์˜ค๋ผํด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋‚˜ API ๋“ฑ์„ ํ†ตํ•ด DB์™€ ํ†ต์‹ 
$ ์‚ฌ์šฉ์ž๊ฐ€ ์‹คํ–‰์‹œํ‚จ SQL์„ ์„œ๋ฒ„ ํ”„๋กœ์„ธ์Šค์— ์ „๋‹ฌํ•˜๊ณ , ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ์„œ๋ฒ„ ํ”„๋กœ์„ธ์Šค๋กœ ๋ถ€ํ„ฐ ๋ฐ›๋Š” ์—ญํ•  ์ˆ˜ํ–‰
- Server Process : ์œ ์ € ํ”„๋กœ์„ธ์Šค์˜ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ํ”„๋กœ์„ธ์Šค
§ Instance์— ์ ‘์†ํ•œ User Process์˜ ์š”์ฒญ์„ ์ฒ˜๋ฆฌ
§Application์„ ํ†ตํ•ด ์š”์ฒญ๋œ SQL์„ Parse – Execute – Fetch ๋ฅผ ํ†ตํ•ด ์‹คํ–‰์‹œํ‚ค๋Š” ์—ญํ• ์„ ์ˆ˜ํ–‰

  - Parse : SQL๋ฌธ ๋ฌธ๋ฒ•, ์‚ฌ์šฉ์ž ๊ถŒํ•œ, ๊ฐ์ฒด์˜ ์‚ฌ์šฉ์—ฌ๋ถ€ ๊ฒ€์‚ฌ, ์‹คํ–‰๊ณ„ํš ์ƒ์„ฑ

  - Execute : Parse ๋‹จ๊ณ„์˜ ์‹คํ–‰๊ณ„ํš์— ๋”ฐ๋ผ ๋ฐ์ดํ„ฐ block์„ readํ•˜๊ณ  ๋ณ€๊ฒฝ

  - Fetch : ๊ฒฐ๊ณผ ๋ฐ์ดํ„ฐ๋ฅผ User Process์— ์ „๋‹ฌ

- Background Process : Multi ์œ ์ €์— ๋Œ€ํ•œ ์„ฑ๋Šฅ์„ ์ตœ๋Œ€ํ™” ํ•˜๊ธฐ ์œ„ํ•œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ํ”„๋กœ์„ธ์Šค

DBWn (Database Writer Process)

§Database buffer cache์˜ ๋ณ€๊ฒฝ๋œ block์„ Datafile์— ๊ธฐ๋ก
§DBWn ๊ตฌ๋™ ์‹œ๊ธฐ

  - Checkpoint๊ฐ€ ๋ฐœ์ƒํ• ๋•Œ

  - Dirty buffer ๊ฐ€ ์ž„๊ณ„์น˜์— ๋‹ฌํ•˜๊ฑฐ๋‚˜ Free buffer๊ฐ€ ์—†์„๋•Œ

  - Tablespace offline ๋˜๋Š” Read Only๋กœ ๋ณ€๊ฒฝ์‹œ

  - Table Drop ๋˜๋Š” Truncate ์‹œ

  - Tablespace begin Backup ์‹œ

§๊ด€๋ จ parameter : db_writer_proceses

 

LGWR (Log Writer Process)

§Redo Log buffer๋ฅผ Online Redo Log file์— ๊ธฐ๋ก
§LGWR ๊ตฌ๋™ ์‹œ๊ธฐ

  - Commit ์ˆ˜ํ–‰์‹œ

  - Redo log buffer๊ฐ€ 1/3์ด์ƒ ์ฐจ๊ฑฐ๋‚˜ 1MB ์ด์ƒ์˜ buffer๊ฐ€ ํฌํ•จ๋  ๋•Œ

  - Checkpoint์— ์˜ํ•œ DBWn ํ”„๋กœ์„ธ์Šค์˜ ์ž‘์—…์ด ์š”๊ตฌ๋  ๋•Œ

  - 3์ดˆ๋งˆ๋‹ค ๋˜๋Š” ์„ค์ •๋œ Timeout ์‹œ๊ฐ„์— ์˜ํ•ด

  - Log Switch ๋ฐœ์ƒ์‹œ

CKPT (Checkpoint Process)

§SCN(System Cange Number) ๋ฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ƒํƒœ๋ฅผ Control file๊ณผ Data File Header ์— ๊ธฐ๋ก
§๋ฉ”๋ชจ๋ฆฌ ๋‚ด์˜ ๋ฐ์ดํ„ฐ์™€ ๋ฐ์ดํ„ฐ ํŒŒ์ผ์— ์ €์žฅ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ผ์น˜์‹œํ‚ค๋Š” ์ผ
§CKPT ๊ตฌ๋™ ์‹œ๊ธฐ

  - ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๊ฐ€ ์ •์ƒ ์ข…๋ฃŒ๋  ๋•Œ

  - Alter system checkpoint; ๋ช…๋ น์–ด๋กœ ๊ฐ•์ œ ๋ฐœ์ƒ

  - Log Switch ๋ฐœ์ƒ์‹œ

  - Tablespace ๋ณ€๊ฒฝ ๋˜๋Š” Begin Backup์‹œ

§๊ด€๋ จ parameter : fast_start_mttr_target

PMON (Process Monitor Process)

§Process-Level์˜ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ Cleanup ์ˆ˜ํ–‰

  - Server Process์˜ ๋น„์ •์ƒ ์ข…๋ฃŒ์‹œ Recovery๋ฅผ ์ˆ˜ํ–‰(Transaction Rollback)

  - User Process๊ฐ€ ์‚ฌ์šฉํ–ˆ๋˜ Database buffer cache ์ •๋ฆฌ ๋ฐ Resource ํ•ด์ œ

  - Instance์™€ Server Process์˜ ์ •๋ณด๋ฅผ Listener์— ๋™์ ์œผ๋กœ ๋“ฑ๋ก

 

SMON (Sytem Monitor Process)

§Sytem-level์˜ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ Cleanup ์ˆ˜ํ–‰

  - Instance ์‹œ์ž‘์‹œ Recovery ์ˆ˜ํ–‰

  - ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” Temporary Segment ์ •๋ฆฌ


Storage Architecture

 

RDBMS๋Š” Datafile๊ณผ ๊ฐ™์€ ๋ฌผ๋ฆฌ์  ๊ตฌ์กฐ์™€ table, index์™€ ๊ฐ™์€ ๋…ผ๋ฆฌ์  ๊ตฌ์กฐ๊ฐ€ ๋ถ„๋ฆฌ๋˜์–ด ์žˆ์–ด ๋…๋ฆฝ์ ์œผ๋กœ ๊ด€๋ฆฌ ๊ฐ€๋Šฅํ•จ

 

Data Files

§๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ User Data ๋ฐ Sytem Data๋ฅผ ์ €์žฅํ•˜๋Š” ํŒŒ์ผ
§๋…ผ๋ฆฌ ๊ตฌ์กฐ์ธ Tablespace Data๋ฅผ ๋ฌผ๋ฆฌ์ ์œผ๋กœ ์ €์žฅ

  - Tablespace๋Š” 1๊ฐœ ์ด์ƒ์˜ Data File๋กœ ๊ตฌ์„ฑ

 

Control Files

§๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ํ˜„์žฌ ์ƒํƒœ์™€ ๋ฌผ๋ฆฌ์  ๊ตฌ์„ฑ ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๋Š” binary ํŒŒ์ผ
§๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์‹œ์ž‘๊ณผ ํŠธ๋žœ์žญ์…˜ ์ข…๋ฃŒ์‹œ ๋ชจ๋“  ํ˜„์žฌ ์ƒํƒœ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๊ณ  ๊ฒ€์ฆ
§ํฌํ•จ ์ •๋ณด

  - Database๋ช…๊ณผ ID, Database ์ƒ์„ฑ ์‹œ๊ฐ„

  - Datafile, Online Redo log file, Archived Redo log file ์ •๋ณด

  - Tablespace ์ •๋ณด

  - Checkpoint ๋ฐ Backup ์ •๋ณด

§์ฃผ์š” ํŒŒ์ผ๋กœ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ƒ์„ฑ์‹œ 3๊ฐœ์˜ File๋กœ ๋ฏธ๋Ÿฌ๋ง ๊ตฌ์„ฑ
§๊ด€๋ จ parameter : control_files
§์ •๋ณด์กฐํšŒ : v$controlfile_record_section

Online Redo Log Files

§๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ๋ชจ๋“  Transaction์ด ์ €์žฅ๋˜๋Š” ํŒŒ์ผ
§๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค Recovery์— ์‚ฌ์šฉ
§ํฌํ•จ ์ •๋ณด

  - Commit๋˜์ง€ ์•Š์€ Transaction์ •๋ณด, Undo ๋ฐ์ดํ„ฐ

  - Schema์™€ Ojbect ๊ด€๋ฆฌ ๊ตฌ๋ฌธ

§Online Redo Log Group / Member

  - ์ตœ์†Œ 2๊ฐœ ์ด์ƒ์˜ Group์ด ํ•„์š”

  - ๊ฐ Group์€ 1๊ฐœ ์ด์ƒ์˜ Member๋กœ ๊ตฌ์„ฑ

  - LGWR์€ Group๋‚ด ๋ชจ๋“  Member์— ๋™์ผํ•œ ์ •๋ณด ๊ธฐ๋ก

  - ๊ฐ Member๋Š” ๋™์ผํ•œ Log Sequence์™€ ํฌ๊ธฐ๋ฅผ ๊ฐ€์ง

§Log Switch

  - Redo Log Group๊ฐ„์˜ ์ด๋™

  - ํ˜„์žฌ Log file์ด full์ผ๋•Œ ๋ฐœ์ƒ

§์ •๋ณด์กฐํšŒ : v$log, v$logfile
 

Database์˜ ๋ชจ๋“  Data๋Š” ๋…ผ๋ฆฌ์  ๊ณต๊ฐ„์— ํ• ๋‹น

๋…ผ๋ฆฌ์  ๋‹จ์œ„: Data block, Extent, Segment, Tablespace

Data Block

§์˜ค๋ผํด์˜ ๊ฐ€์žฅ ์ž‘์€ ๋…ผ๋ฆฌ์ ์ธ Database ํ• ๋‹น ๋‹จ์œ„
§์˜ค๋ผํด์˜ ์ตœ์†Œ I/O ๋‹จ์œ„
§Data Block์— Data(row)๊ฐ€ ์ €์žฅ
§ํ‘œ์ค€ Data Block Size

  - DB ์ƒ์„ฑ์‹œ db_block_size ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์„ค์ •

  - ์ผ๋ฐ˜์ ์œผ๋กœ 4KB ๋˜๋Š” 8KB๋กœ ์„ค์ •

§๋น„ํ‘œ์ค€ Data Block Size

  - Tablespace ์ƒ์„ฑ ์‹œ BLOCKSIZE ๊ตฌ๋ฌธ์œผ๋กœ

    default block size์™ธ์— ์ง€์ •๊ฐ€๋Šฅ

  - 2K, 4K, 8K, 16K, 32K ๋‹จ์œ„๋กœ ์ƒ์„ฑ

  - ํ•ด๋‹น blocksize์˜ subcache ์˜์—ญ์ด

    (db_nk_cache_size) ์„ค์ •๋˜์–ด์•ผ ํ•จ

Extents

§ํ•˜๋‚˜ ์ด์ƒ์˜ ์—ฐ์†๋œ Data Block์œผ๋กœ ๊ตฌ์„ฑ
§Segment์— ์ €์žฅ ์˜์—ญ์„ ํ• ๋‹นํ•˜๋Š” ๋‹จ์œ„
 

Segment

§ํ•˜๋‚˜ ์ด์ƒ์˜ Extent๋กœ ๊ตฌ์„ฑ
§ํ•˜๋‚˜์˜ Segment๋Š” ํ•˜๋‚˜์˜ User Object ์—๋งŒ ํ• ๋‹น
§Segment ์ข…๋ฅ˜

  - Table / Index / LOB Segment

  - Temporary Segments

  - Undo Segments

 

Tablespace

§Segment๋ฅผ ํฌํ•จํ•˜๋Š” ๋…ผ๋ฆฌ์  ์ €์žฅ ์˜์—ญ
§๋ฌผ๋ฆฌ์  level์˜ ํ•˜๋‚˜ ์ด์ƒ์˜ Data file ๋˜๋Š” Temp file๋กœ ๊ตฌ์„ฑ
§Tablespace ์ข…๋ฅ˜

  - SYSTEM Tablespace : Data Dictionary ๋“ฑ DB๊ด€๋ฆฌ์šฉ ๋ฉ”ํƒ€์ •๋ณด object ์ €์žฅ

  - SYSAUX Tablespace : Enterprise Manager ๋“ฑ ์ถ”๊ฐ€์ ์ธ DB ๊ตฌ์„ฑ์‹œ ์‚ฌ์šฉ

  - UNDO Tablespace : Data ๋ณ€๊ฒฝ์‹œ commit์ „๊นŒ์ง€ ๋ณ€๊ฒฝ์ „ data ์ €์žฅ๊ด€๋ฆฌ

  - TEMP Tablespace : Session์ด ์œ ์ง€๋˜๋Š” ๋™์•ˆ ์‚ฌ์šฉํ•˜๋Š” ์ž„์‹œ ๋ฐ์ดํ„ฐ ์ €์žฅ

  - USER Tablespace : ์‚ฌ์šฉ์ž ์ƒ์„ฑ object ์ €์žฅ


SQL Server ์•„ํ‚คํ…์ฒ˜

Instance(๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ + relational/storage engine + ํ”„๋กœ์„ธ์Šค ์˜์—ญ) + Database(ํŒŒ์ผ ์˜์—ญ)


SQL Server Engine ๊ตฌ์„ฑ์š”์†Œ


Instance์™€ Database

์˜ค๋ผํด - ํ•˜๋‚˜์˜ ์ธ์Šคํ„ด์Šค๊ฐ€ ํ•˜๋‚˜์˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ ‘๊ทผ

SQL server - ํ•˜๋‚˜์˜ ์ธ์Šคํ„ด์Šค์— ์ตœ๋Œ€ 32,767๊ฐœ์˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์‚ฌ์šฉ


Memory

SQL Server๋Š” thread ๊ธฐ๋ฐ˜์œผ๋กœ ํ”„๋กœ์„ธ์„œ ์ „์šฉ ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ(PGA)๊ฐ€ ์—†์Œ

Oracle SQL Server ์„ค๋ช…
SGA Shared pool Memory
Pool
Procedure/Plan Cache
•SQL, Procedure ์ฝ”๋“œ์™€ ์‹คํ–‰๊ณ„ํš์„ ์ €์žฅ
Data Buffer cache Data buffer cache
•Data file์˜ Data block/page๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ
Redo Log buffer Log cache
•Data ๋ณ€๊ฒฝ๋‚ด์—ญ์„ ์ €์žฅํ•˜๋Š” ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ
PGA Connection Context
•์‚ฌ์šฉ์ž ์„ธ์…˜์ •๋ณด, ์ปค์„œ์˜ ์œ„์น˜์ •๋ณด,  SP์˜ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์ €์žฅ
•PGA ๋‚ด์— Sort ๋“ฑ์„ ์ˆ˜ํ–‰ํ•˜๋Š” SQL ์ž‘์—… ์˜์—ญ์€ SQL Server์˜ ๊ฒฝ์šฐ Data buffer์—์„œ ์ˆ˜ํ–‰

Process

SQL Server๋Š” ์œˆ๋„์šฐ ๊ธฐ๋ฐ˜์œผ๋กœ thread๊ฐ€ oracle์˜ process ์—ญํ• ์„ ์ˆ˜ํ–‰

Oracle SQL Server ์„ค๋ช…
Server Process Worker Thread Client ์š”์ฒญ์„ ์‹คํ–‰ํ•˜๊ณ  ๊ฒฐ๊ณผ๋ฅผ ์ „๋‹ฌ
Process Monitor(PMON) Open Data Services(ODS) ํ”„๋กœ์„ธ์Šค ๋ ˆ๋ฒจ์˜ ๋ชจ๋‹ˆํ„ฐ๋ง ๋ฐ ๋ฆฌ์†Œ์Šค ๋ณต๊ตฌ ์ˆ˜ํ–‰
System Monitor(SMON) Database Cleanup/Shrinking ์‹œ์Šคํ…œ ๋ ˆ๋ฒจ์˜ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ ์ธ์Šคํ„ด์Šค ๋ณต๊ตฌ
Database Writers(DBWn) Lazy Writer ๋ฒ„ํผ ์บ์‹œ์˜ Dirty ๋ฒ„ํผ๋ฅผ ๋ฐ์ดํ„ฐ ํŒŒ์ผ์— ๊ธฐ๋ก
Log Writer(LGWR) Log Writer ๋กœ๊ทธ ๋ฒ„ํผ ์—”ํŠธ๋ฆฌ๋ฅผ ๋กœ๊ทธ ํŒŒ์ผ์— ๊ธฐ๋ก
Checkpoint Processes(CKPT) Database Checkpoint ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์ปจํŠธ๋กค ํŒŒ์ผ๊ณผ ๋ฐ์ดํ„ฐํŒŒ์ผ์— ๊ธฐ๋ก
Archive Processes(ARCn) N/A SQL Server๋Š” Transaction LogํŒŒ์ผ์— ๊ณ„์†ํ•ด์„œ ๊ธฐ๋ก
Recoverer(RECO) Distributed Transaction Coordinateor(DTC) ๋ถ„์‚ฐ ํŠธ๋žœ์žญ์…˜ ๊ณผ์ •์— ๋ฐœ์ƒํ•œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐ
Job Queue(CJQ0, Jnnn) SQL Agent ์Šค์ผ€์ค„๋ง ์ž‘์—…์„ ์ˆ˜ํ–‰

Oracle

- pmon: process-level์˜ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ resource cleanup ์ˆ˜ํ–‰

- smon: system-level์˜ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ cleanup ์ˆ˜ํ–‰, instance ์‹œ์ž‘ ์‹œ recovery ์ˆ˜ํ–‰

SQL Server

- SQLOS(SQL server Operating Service): SQL ์—”์ง„์—์„œ memory, IO, ์Šค์ผ€์ค„๋ง ๊ด€๋ฆฌ ๋“ฑ ์ˆ˜ํ–‰


Storage Architecture

Oracle๊ณผ SQL Server ๋ชจ๋‘ ๋ฌผ๋ฆฌ์ ์œผ๋กœ๋Š” ํŒŒ์ผ์— ๋ฐ์ดํ„ฐ ์ €์žฅ, ๋…ผ๋ฆฌ์  ๊ตฌ์กฐ์— ์•ฝ๊ฐ„์˜ ์ฐจ์ด ์žˆ์Œ

Oracle - ASM์„ ํ†ตํ•œ Raw device๋„ ์‚ฌ์šฉ (ASM: ์ž๋™ ์Šคํ† ๋ฆฌ์ง€ ๊ด€๋ฆฌ)

SQL Server

- ๋ณด์•ˆ ๋ฐ ๊ฐ€์šฉ์„ฑ ์ธก๋ฉด์—์„œ NTFS ๊ถŒ์žฅ

- raw device limitation) 1๊ฐœ ํŒŒํ‹ฐ์…˜์— 1๊ฐœ์˜ ๋ฐ์ดํ„ฐํŒŒ์ผ๋งŒ ์ƒ์„ฑ๊ฐ€๋Šฅ / ํŒŒ์ผ copy, move, delete ๋ถˆ๊ฐ€ / Windows NT Backup utility ์‚ฌ์šฉ ๋ถˆ๊ฐ€ / Datafile ์ž๋™ํ™•์žฅ ๋ถˆ๊ฐ€ ๋“ฑ๋“ฑ


Data blocks, extents, segments

๊ตฌ๋ถ„ Oracle SQL Server
์ตœ์†Œ ํ• ๋‹น ๋‹จ์œ„ Block Page
Block/Page size 2K, 4K, 8K, 16K, 32K, 64K 8K ๊ณ ์ •
Storage ํ• ๋‹น ๋‹จ์œ„ Extents
(multiple block)
Extents
(multiple page)
Extent size Variable 64K ๊ณ ์ •
Extent ์‚ฌ์šฉ Uniform
(๋‹จ์ผ object๊ฐ€ ์‚ฌ์šฉ)
Uniform, Mixed
(ํ˜ผํ•ฉ์œผ๋กœ ์‚ฌ์šฉํ•˜๋‹ค object ํฌ๊ธฐ๊ฐ€ 64K๋ณด๋‹ค ์ปค์ง€๋ฉด ๋‹จ์ผ ํ• ๋‹น)
์˜ค๋ธŒ์ ํŠธ ์ €์žฅ ๋‹จ์œ„ Segment Heap/Index
Segment ์ข…๋ฅ˜ Table, Index, Lob, Temp, Undo Table, Index

temp, undo, log ์˜์—ญ

๊ตฌ๋ถ„ Oracle SQL Server ๋น„๊ณ 
TEMP ์˜์—ญ Temporary
tablespace
Tempdb
•Oracle์˜ ๊ฒฝ์šฐ ์—ฌ๋Ÿฌ ๊ฐœ์˜ Temporary tablespace ์ƒ์„ฑํ•˜์—ฌ ์‚ฌ์šฉ์ž๋ณ„๋กœ ์ง€์ • ๊ฐ€๋Šฅํ•˜๋‚˜
•SQL Server๋Š” Tempdb๊ฐ€ ์ „์—ญ ๋ฆฌ์†Œ์Šค๋กœ ๋ชจ๋“  ์‚ฌ์šฉ์ž์˜ ์ž„์‹œ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅ
UNDO ์˜์—ญ Undo
tablespace
Transaction log file
•Oracle์˜ ๊ฒฝ์šฐ Undo์™€ Redo ์ •๋ณด๋ฅผ ๋ณ„๋„์˜ ํŒŒ์ผ์— ๊ธฐ๋ก ๊ด€๋ฆฌํ•˜๋‚˜
•SQL Server๋Š” DB๋ณ„๋กœ Transaction log file์— ๋ชจ๋‘ ๊ธฐ๋กํ•˜๋ฏ€๋กœ ๊ทธ์— ๋”ฐ๋ฅธ ์šด์˜๊ด€๋ฆฌ๊ฐ€ ์ค‘์š”
Log ์˜์—ญ Redo log file
Archive log file N/A
•SQL Server๋Š” ๋ณ„๋„์˜ Archive ํŒŒ์ผ์ด ์—†์œผ๋ฉฐ, ๋กœ๊ทธ ๋ฐฑ์—… ์ „๊นŒ์ง€ Transaction log file์— ๊ณ„์†ํ•ด์„œ ๊ธฐ๋ก
•Database ๋ณต๊ตฌ๋ชจ๋“œ ์„ค์ •๊ณผ ๋ฐฑ์—… ์Šค์ผ€์ค„๋ง์ด ์ค‘์š”

SQL Server๋Š” transaction log file์— ๋ณ€๊ฒฝ ์ •๋ณด ๋ชจ๋‘ ๊ธฐ๋กํ•˜๋ฏ€๋กœ ๋กœ๊ทธ ์˜์—ญ์˜ ์šด์˜ ๊ด€๋ฆฌ๊ฐ€ ์ค‘์š”


 

728x90