Professional Documents
Culture Documents
Overview
Schema and Data Structure (Objects) Storage Architecture Data Blocks, Extents, and Segments
Storage Allocation
Managing Extents and Pages Tablespaces and Datafiles SQL Server Data Files Mapping of Tablespaces and Filegroups
Logging Model
Data Dictionary
SQL Server
XML DB
Storage Architecture
Database storage architecture includes physical and logical structures Physical structures are data files, log files, and operating system blocks Logical structures are subdivisions of data files used to manage storage space
Data File Data File Data File Data File Data File Data File
Extent
Blocks
Extent
Blocks
Extent
Pages
Structure Smallest unit of logical storage Block size Storage allocation Extent size
Oracle Block Variable Performed in multiple blocks; are extents Variable Any logical structure that is allocated storage
SQL Server 2012 Page 8 KB fixed Performed in multiple pages; are extents 64 KB fixed
Segment
Allocation unit
Storage Allocation
2K 2K block 6 x 2K block = 12K 2K block 2K block 2K block 2K block EXTENT 2K block 2K block 2K block 2K block 12K + 16K = 28K SEGMENT (Table/Index)
8K block
2K block
8K 8 x 8K 2K = 64K block EXTENT block 8K block 8K block 8K block 2K block 2K block 2K block 64K + 64K = 128K HEAP/INDEX
2K 8 x 2K 2K = 16K 2K block EXTENT block block 2K block 2K block 2K block 2K block 2K block 2K block
Oracle
SQL Server
Similar to the Oracle bitmap functionality used to manage free space and extent allocation, SQL Server uses the Global Allocation Map (GAM) and Shared Global Allocation Map (SGAM)
Oracle keeps track of extents using extent allocation maps
Free, not being used Uniform extent, or full mixed extent Mixed extent with free pages
Demonstration:
Working with Filegroups and Data Structures
Data file
Data file
Data file
Log file
Tablespace Group
Data file Data file
Data file
Log file
Data file Data file Data file Data file Data file
Log file
BigFile Tablespace User Data Tablespace User Index Tablespace Undo Tablespace Redo Log Files
Log file
Data file
Data file
User Database
Data file Data file Data file Data file
Data file
Data file
Data file
Data file
Log file
Demonstration:
Viewing an Instances System Databases
Logging Model
Oracle uses online redo logs to record changes made to the database by transactions and undo segments to capture the before image of data SQL Server implements both of these functions using transaction logs. Each transaction record contains the undo and redo image of the transaction.
Data Dictionary
In Oracle the data dictionary is stored under the SYS schema in the SYSTEM tablespace In SQL Server the data dictionary consists of: Catalog Viewthe best way to access system metadata Backward Compatibility ViewsAll system tables from previous releases are provided as backward compatibility views Dynamic Management Viewsto view the current state of the SQL Server system. Provide real-time snapshots of internal memory structures indicating the server state. INFORMATION_SCHEMA viewsSQL-99 method to view system metadata
SQL Servers Resource database contains the metadata for system stored procedures
Review
Defined schema and identified core schema objects Examined the storage architecture and its physical (datafiles, logfiles, and so on) and logical structures (blocks, extents, segments, and tablespaces) Defined the hierarchy in the logical structures Compared Oracle and SQL Server in terms of schema vs. databases, and tablespaces vs. filegroups Examined the structures used in the implementation of the logging model (redo logs and rollback segments in Oracle vs. transaction logs in SQL Server) Brief look at the location and composition of the data dictionary/system catalog