Lesson 15 — Database Storage Overview (ภาษาไทย)
🧠 ภาพจำก่อนอ่าน: 🗄️ Data → ⚙️ Process → 🩺 Health
🎨 Visual Guide ของวิชานี้ — ภาพช่วยจำ ไม่แทนคำสั่งและเนื้อหาจริง
Oracle University 19c Administration Workshop Lesson 15 mapped by source inventory. Original Thai teaching reconstruction; not page-verified against proprietary Student Guide. Static authored; no Oracle live run. 19c foundation with 26ai documentation as current reference.
เป้าหมาย
หัวข้อที่มีชื่อว่า “เป้าหมาย”เข้าใจ Logical vs Physical Storage พร้อมวิเคราะห์ Oracle storage problems อย่างเป็นลำดับ ไม่แก้ด้วยการเพิ่ม datafile หรือเปลี่ยน initialization parameters โดยไม่มีหลักฐาน.
Mental model
หัวข้อที่มีชื่อว่า “Mental model”flowchart TB DB[(Oracle Database)] --> TS[Tablespace: logical storage] TS --> SEG[Segment] SEG --> EXT[Extent] EXT --> BLOCK[Data blocks] TS --> DF[(Datafiles: physical storage)] DF --> OS[Filesystem / ASM Disk Group]
Core concepts
หัวข้อที่มีชื่อว่า “Core concepts”Database → Tablespace → Segment → Extent → Data Block. Datafiles are physical storage for tablespaces. Control files and redo files have separate recovery roles.
Operational distinction: Logical space, allocated bytes, recoverable/reclaimable segment space, autoextend maximum, and free filesystem/ASM capacity are separate measurements. A single percent-used number is insufficient to decide a resize.
| ประเด็น | ต้องตรวจ | ตัดสินใจอย่างไร |
|---|---|---|
| Capacity | bytes, free, maxbytes, autoextend | หา bottleneck จริงก่อนขยาย |
| Container scope | current CDB/PDB, datafile scope | ห้ามเปลี่ยน object ผิด tenant |
| Performance | I/O pressure, segment growth, transactions | วิเคราะห์ช่วงเวลาและ workload |
| Recovery | archive/backup and rollback | ตรวจ restore proof ก่อน DDL |
Read-only SQL
หัวข้อที่มีชื่อว่า “Read-only SQL”ต้องมี approved SELECT privileges. DBA_* views แสดงตาม container/role; output อาจรวม path ที่ sensitive — ห้ามเผยแพร่ path ภายในแบบไม่ redact.
SHOW CON_NAMESELECT tablespace_name,contents,status FROM dba_tablespaces ORDER BY tablespace_name;How to interpret
หัวข้อที่มีชื่อว่า “How to interpret”ตรวจว่าเป็น permanent, temporary, undo หรือ application tablespace; เก็บ timestamp และเทียบย้อนหลัง ถ้าดูแค่ DBA_FREE_SPACE จะพลาด autoextend headroom, temp และ underlying storage capacity. เมื่อ SQL เจอ ORA-00942/ORA-01031 ให้ขอ grant เฉพาะ view แทนการ grant DBA.
Incident & troubleshooting
หัวข้อที่มีชื่อว่า “Incident & troubleshooting”Do not conflate segment free space with filesystem free space; understand CDB/PDB scope and ASM/OMF path semantics.
- เก็บ exact ORA error, time, SQL/workload, affected schema and PDB.
- ตรวจ class of tablespace, file allocations, free extents, maxbytes and actual filesystem/ASM free.
- ตรวจ application growth, long transactions, backup/archiving and alert log.
- แยก emergency mitigation จาก root-cause fix; เขียน impact/rollback แล้วขอ change approval.
- ทำ post-change verification และติดตาม trend ไม่ตัดสินจาก snapshot เดียว.
Practice exercise
หัวข้อที่มีชื่อว่า “Practice exercise”- อธิบายเหตุที่
DBA_DATA_FILES.BYTESไม่เท่ากับ used space ของ table. - อธิบายข้อแตกต่าง free extents vs unused blocks below HWM.
- ทำ capacity worksheet: allocated, max autoextend, storage free, projected growth, escalation threshold.
- ระบุสิ่งที่จะต้อง rollback/restore หากมีการเปลี่ยนแปลง.
Knowledge check
หัวข้อที่มีชื่อว่า “Knowledge check”- ถ้าพื้นที่ database เต็ม แต่ filesystem ยังเหลือ จะตรวจอะไร?
- ถ้า autoextend ON แต่ MAXBYTES เท่าปัจจุบัน มี headroom จริงหรือไม่?
- ถ้า PDB ต้องใช้ quota จะตรวจ owner และสิทธิ์อะไร?
- ทำไม DELETE อาจไม่ทำให้ disk usage ลดทันที?
- ปัญหา space สามารถเกิดร่วมกับ undo/redo/backup ได้อย่างไร?
Sources
หัวข้อที่มีชื่อว่า “Sources”- Oracle University Lesson 15: title-level mapping, full fidelity pending.
- Oracle 19c DBA Guide
- Oracle 26ai DBA Guide
- Oracle 26ai Managing Undo
Source-objective deepening — Default Tablespaces, Blocks and Deferred Segments
หัวข้อที่มีชื่อว่า “Source-objective deepening — Default Tablespaces, Blocks and Deferred Segments”Oracle lesson 15 ต้องอธิบายหน้าที่ของ default tablespaces: SYSTEM เก็บ core dictionary, SYSAUX เก็บ auxiliary components, TEMP ใช้ temporary operations, UNDO รองรับ read consistency และ rollback, USERS เป็น default user-data tablespace ในหลาย DBCA templates (ไม่ใช่การรับรองว่ามีชื่อ USERS ในทุก environment). ต้องรู้ว่า tablespace ≠ datafile และ undo/redo ไม่ใช่สิ่งเดียวกัน.
Oracle Data Block เป็นหน่วยเก็บข้อมูลบน database; block size เลือกตาม database design และข้อจำกัด platform. การอ่าน table เป็น blocks/segment extents กระทบ I/O, row chaining/migration และ buffer cache.
Deferred segment creation: Oracle อาจสร้าง table metadata ก่อน โดยยังไม่ allocate segment/data extent จนมี insert ตาม config และ object type. ดังนั้น table object ที่มีอยู่ใน DBA_TABLES อาจยังไม่ปรากฏใน DBA_SEGMENTS; ไม่ใช่ corruption โดยอัตโนมัติ.
-- Read-only (requires DBA views)SELECT owner,table_name,segment_created FROM dba_tablesWHERE owner='LAB_OWNER' ORDER BY table_name;SELECT owner,segment_name,segment_type,tablespace_nameFROM dba_segments WHERE owner='LAB_OWNER' ORDER BY segment_name;คำถาม: ตารางเปล่าที่ไม่มี segment กับตารางที่เคยมีข้อมูลแล้ว DELETE จนหมด ใช้พื้นที่เหมือนกันหรือไม่? ทำไม?
เมื่ออ่านและฝึกทบทวนจบแล้ว ทำเครื่องหมายเพื่อบันทึกใน Browser นี้