Chapter 4 Physical Database Layouts Database Processing Chapter 4
Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Main Points Database File Layout Verification of I/O Weighting Estimates File Location Database Space Usage Overview
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Database File Layouts Establish clear goals of the file distribution design Understand the nature of the database –Transaction-oriented vs Read-Intensive
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Database File Layout (6 steps) 1.Identify I/O contention among datafiles –Use statistics from analogous database if available –Assign I/O weights based on estimates relative to most active tablespace –See Table 4-1 for datafiles in optimal database –See Table 4-2 for estimated I/O weights for sample tablespaces
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Table 4-1
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Table 4-2
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Database File Layout 2.Identify I/O bottlenecks among all database files –Location of datafiles relative to each other –Online redo log files should not be stored on same disk as any other active datafile –Control file requires little I/O –LGWR-ARCH contention-don’t store Archive redo log files on same disk as redo log files –Oracle software—no statistics kept on I/O
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Background Processes 3.Types –Concurrent I/O—multiple accesses performed against same device at same instant –Interference—writes to a sequentially written file are interrupted by reads or writes to other files on the same disk DBWR—reads and writes in random manner –Can be in contention with itself –ORACLE supports multiple DBWR processes for each instance LGWR—writes sequentially to one file at a time ARCH—reads and writes sequentially to one file at a time
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Security and Performance Goals 4.Recoverability—takes into account all processes that impact disk –Must mirror online redo log files (OS or redo log groups) –Prevails over performance tuning Performance tuning goals—take into account the projected database file I/O distribution and the relative access speeds of the disk
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts System Hardware and Mirroring Architecture 5.Number of disks required Determined byDatabase size and database I/O weights –Models of disks required –Appropriate mirroring strategy
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Dedicated Database Disks 6.Identify Disks that can be dedicated to the database To avoid concurrent I/O and interference with Non-ORACLE files
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Verifying I/O Weighting Estimates Statistics table –Found in data dictionary –Compare to initial estimates and adjust –See page 100 for sample use of the view V$FILESTAT
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Summary: Basis for disk layout Recovery Mirroring of online redo log files Database file I/O weight estimation Contention among background processes Contention between disks for DBWR Defined performance goals Known disk hardware options Known disk mirroring architecture Dedicated database disks
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Decisions The author provides guidance physical disk layout decisions –“Dream” physical disk layout is best case scenario –Each successive iteration suggests the best compromise at that point –Similar to guidance for “Denormalizing” a database that has been fully normalized. –Will illustrate one iteration…see author for iterations 2-6!
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Disk Contents 1Oracle Software 2System Tablespace 3RBS Tablespace 4DATA Tablespace 5INDEXES Tablespace 6TEMP Tablespace 7TOOLS Tablespace 8Online Redo log 1 9Online Redo log 2 10Online Redo log 3 11Control File 1 Dream Physical Layout—22 Disks Disk Contents 12Control File 2 13Control File 3 14Application Software 15RBS_2 16DATA_2 17INDEXES_2 18TEMP_USER 19TOOL_I 20USERS 21Archived redo log disk 22Export dump file disk
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Disk Contents 1Oracle Software 2System Tablespace 3RBS Tablespace 4DATA Tablespace 5INDEXES Tablespace 6TEMP Tablespace 7TOOLS Tablespace 8Online Redo log 1 Control File 1 9Online Redo log 2 Control File 2 First Iteration—17 Disks Disk Contents 10Online Redo log 3 Control File 3 11 Application Software 12RBS_2 13DATA_2 14INDEXES_2 15TEMP_USER 16Archived redo log disk 17Export dump file disk TOOL_I and USERS are omitted 1.Control Files have least interference with Online Redo log files 2.See author notes for rationale re TOOL_I and USER omission
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts File Location Database files –Separated from other software –Stored in directories created specifically for that database –Of different database should not be stored together
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Database Space Usage Overview Storage Clause—default parameters –Initial extent size –Next extent size –Pct increase (careful use and monitoring) –Max extents –Min extents –Pct Free clause
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Sizing Pertains to –Table segments –Index segments –Rollback segments –Temporary segments –Free space
Chapter 4 Copyright © 2001 Harold Pardue, University of South AlabamaChapter 4 - Physical Database Layouts Scenarios Remainder of Chapter 4 is how-to-do to achieve specific goals –Resizing Datafiles (7.2 and higher) –Automating Datafile Extensions –Moving Database Files –Moving Online Redo Log Files –Moving Control Files –Deallocating Space in 7.2 and 7.3 Shrinking Datafiles Shrinking Tables, Clusters and Indexes Rebuilding Indexes