9 Storage Structure and Relationships. 9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating.

Slides:



Advertisements
Similar presentations
CHAPTER 4 Tablespaces and Datafiles. Introduction After installing the binaries, creating a database, and configuring your environment, the next logical.
Advertisements

Rollback Segments Nilendu Misra (MAR99)
11 Copyright © Oracle Corporation, All rights reserved. Managing Tables.
The Architecture of Oracle
1/43 Tanel PoderEoug User2User day Freelists vs ASSM in Oracle9i Tanel Poder independent technology consultant 20-Oct-03 OracleWorld.
5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
School of Computing and Management Sciences © Sheffield Hallam University The slowest task in any record retrieval is reading from disk (It can be 500.
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
Primer on Structure& Storage Analysis Primer on Structure & Storage Analysis This presentation is supposed to give a simple and brief overview for storage.
Basic Storage Concepts and Settings
12 Copyright © Oracle Corporation, All rights reserved. Managing Indexes.
Data archival using Partitioning and Partition Maintenance O/o the A.G.(A&E)-II NagpurMaharashtra.
Harvard University Oracle Database Administration Session 2 System Level.
Oracle Architectural Components
Harvard University Oracle Database Administration Session 5 Data Storage.
Oracle Database Administration Database files Logical database structures.
IT Database Administration Section 03. Tablespaces and the DBA  Important for DBAs – logical units of database storage Made up of physical operating-system.
9/11/2015ISYS366 - Week051 ISYS366 – Week 5-6 Database Tuning - User and Rollback Data Spaces, Recovery, Backup.
Database Administration TableSpace & Data File Management
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 9 Index Management.
7202ICT Database Administration Lecture 7 Managing Database Storage Part 2 Orale Concept Manuel Chapter 3 & 4.
Extents, segments and blocks in detail. Database structure Database Table spaces Segment Extent Oracle block O/S block Data file logical physical.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 7 Basic Table Management.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
Oracle 10g Database Administrator: Implementation and Administration Chapter 7 Basic Table Management.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
Week 3 Lecture 2 Basic Storage Concepts and Settings.
14 Copyright © 2006, Oracle. All rights reserved. Tuning Block Space Usage.
5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
Database Storage Structures
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
Locally Managed Tablespaces in Oracle8i Raghav Vinjamuri
#.6 Sampling Kyle Hailey
Harvard University Oracle Database Administration Session 6 Object Storage.
6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
Managing Tablespaces and Data Files
10 Managing Rollback Segments Objectives Planning the number and size of rollback segments Creating rollback segments using appropriate storage.
IT Database Administration Section 07. Space Management Managing Space: An Introduction  Organizing database storage is a major responsibility.
Chapter 5 Index and Clustering
Data Warehousing Seminar Chapter 13 Indexing the Warehouse
Chap 5. Disk IO Distribution Chap 6. Index Architecture Written by Yong-soon Kwon Summerized By Sungchan IDS Lab
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Physical Database Structure .
IT Database Administration Section 05. Rollback Segments: An Introduction  What are they?  Space within a database used to store “before” images.
What is Oracle ? Oracle is a relational database management system. It is a management system which uses the relational data model. In the relational data.
Select Operation Strategies And Indexing (Chapter 8)
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
8 Copyright © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
Oracle Database Architectural Components
1 Chapters 19 and 20  Ch. 19: By What Authority? Users Roles Grant and revoke Synonyms  Ch. 20: Changing the Oracle Surroundings Indexes Clusters Sequences.
Database structure and space Management
Database Tuning - User and Rollback Data Spaces, Recovery, Backup
Storage Structure and Relationships
Oracle 10g Database Administrator: Implementation and Administration
Database structure and space Management
Physical Database Structure .
Introduction To Oracle 10g
Managing Indexes.
Storage Structure and Relationships
Managing Tables.
Managing Tablespaces and Data Files
ISYS366, Oracle Disk Internals
Database administration
Presentation transcript:

9 Storage Structure and Relationships

9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating the use of block space utilization parameters by objects Obtaining information about storage structures from the data dictionary Locating the segments by considering fragmentation and life-spans Listing the different segment types and their uses Controlling the use of extents by segments Stating the use of block space utilization parameters by objects Obtaining information about storage structures from the data dictionary Locating the segments by considering fragmentation and life-spans

9-3 Database LogicalPhysical Tablespace Data file O/S block Oracle block Segment Extent Database Storage Hierarchy

9-4 Types of Segments Table Cluster Table partition Index

9-5 Types of Segments Segments occupy space TableTable Table PartitionTable Partition table with high concurrent usage need partitioning option ClusterCluster based on key col values one or more tables in a cluster IndexIndex

9-6 Types of Segments Index-organized table Index partition Rollback segment Temporary segment

9-7 Types of Segments Index-organized tableIndex-organized table index+data stored together Index PartitionIndex Partition index can be partitioned Rollback segmentRollback segment before image of a data value Temporary segmentTemporary segment when sorts need more space

9-8 Types of Segments LOB index LOB segment Bootstrap segment Nested table

9-9 Storage Clause Precedence Oracle default (5 blocks) Tablespace Segment Controls how extents are allocated to segments Storage parameter at segment level overrides the one at TS level, etc.

9-10 Extent Allocation and Deallocation Allocated when the segment is + Created + Extended + Altered Deallocated when the segment is – Dropped – Altered – Truncated – Automatically resized (rollback segments only) Allocated when the segment is + Created + Extended + Altered Deallocated when the segment is – Dropped – Altered – Truncated – Automatically resized (rollback segments only)

9-11 Used and Free Extents *When tablespace is created, the data files contain the following elements: -A header block: the first block -One free extent consisting of the remaining part of the file *As segments are created, or extended, they are allocated space from the pool of free extents; as segments are released, truncated, released extents are added to the pool *Frequent allocation/deallocation leads to fragmentation

9-12 Used and Free Extents Data file Free extent Used extent File header SMON compacts free space; this is called coalescing

9-13 Coalescing Free Space Free extent Used extent File header Before ALTER TABLESPACE data01 COALESCE; After

9-14 Database Block: Review Minimum unit of I/O Consists of one or more O/S blocks Set by DB_BLOCK_SIZE Set at database creation and cannot be altered Minimum unit of I/O Consists of one or more O/S blocks Set by DB_BLOCK_SIZE Set at database creation and cannot be altered

9-15 Database Block Contents Header (contains row ptrs, trans info, Can grow as more rows are added) Free space (can get fragmented as Rows are inserted and Deleted; needs coalescing) Data

9-16 Table Row Contents Row header (locked or not, deleted or not, trans., etc.) Col 1 size, col1 data Col k size (null) Col l size (null) Define cols that can take null values last

9-17 Block Space Utilization Parameters (managing free space to account for updates to rows) INITRANS MAXTRANS (initial and max num of transactions that can concurrently make changes to the block at a point in time) PCTFREE (can insert rows until free space falls below this; default is 10) PCTUSED ( if free space falls below this, block goes on free List; default is 40) Blocks are on “free” list

9-18 Block Space Usage Inserts Inserts Inserts Inserts PCTFREE=20PCTUSED=40 80% 80% 40%

9-19 Example Create table Employee (EID number not null, ENAME varchar2(50) Using INDEX Tablespace INDX Pctfree 10 Pctused 40 INITRANS 5 STORAGE (INITIAL … PCTINCREASE) ) PCTFREE 10 PCTUSED 60 INITRANS 5 STORAGE (INITIAL….) TABLESPACE DATA01; -- COLUMN placement can also be specified Create table Employee (EID number not null, ENAME varchar2(50) Using INDEX Tablespace INDX Pctfree 10 Pctused 40 INITRANS 5 STORAGE (INITIAL … PCTINCREASE) ) PCTFREE 10 PCTUSED 60 INITRANS 5 STORAGE (INITIAL….) TABLESPACE DATA01; -- COLUMN placement can also be specified

9-20 Segment Space Management in LMT From Oracle 9i, one can not only have bitmap managed tablespaces, but also bitmap managed segments when setting Segment Space Management to AUTO for a tablespace. Look at this example: SQL> CREATE TABLESPACE ts4 DATAFILE '/oradata/ts4_01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; From Oracle 9i, one can not only have bitmap managed tablespaces, but also bitmap managed segments when setting Segment Space Management to AUTO for a tablespace. Look at this example: SQL> CREATE TABLESPACE ts4 DATAFILE '/oradata/ts4_01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

9-21 Segment Space Management in LMT Segment Space Management eliminates the need to specify and tune the PCTUSED, FREELISTS, and FREELISTS GROUPS storage parameters for schema objects. The Automatic Segment Space Management feature improves the performance of concurrent DML operations significantly since different parts of the bitmap can be used simultaneously eliminating serialization for free space lookups against the FREELSITS. This is of particular importance when using RAC.

9-22 Data Dictionary Views Tablespaces DBA_TABLESPACES Segments DBA_SEGMENTS Data files DBA_DATA_FILES Free extents DBA_FREE_SPACE Used extents DBA_EXTENTS

9-23 Querying Segment Information DBA_SEGMENTS – – General information – –OWNER SEGMENT_NAME – –SEGMENT_TYPE – –TABLESPACE_NAME DBA_SEGMENTS – – General information – –OWNER SEGMENT_NAME – –SEGMENT_TYPE – –TABLESPACE_NAME – – Size – – EXTENTS – – BLOCKS – – Storage settings – – INITIAL_EXTENT – – NEXT_EXTENT – – MIN_EXTENTS – – MAX_EXTENTS – – PCT_INCREASE

9-24 Example Select segment_name, tablespace_name, extents, blocks From dba_segments Where owner = ‘SCOTT’; Select segment_name, tablespace_name, extents, blocks From dba_segments Where owner = ‘SCOTT’;

9-25 Getting Used Extent Information DBA_EXTENTS – – Identification – –OWNER – –SEGMENT_NAME – –EXTENT_ID – – Location and size – –TABLESPACE_NAME – –RELATIVE_FNO – –FILE_ID – –BLOCK_ID – –BLOCKS DBA_EXTENTS – – Identification – –OWNER – –SEGMENT_NAME – –EXTENT_ID – – Location and size – –TABLESPACE_NAME – –RELATIVE_FNO – –FILE_ID – –BLOCK_ID – –BLOCKS

9-26 Example Select extent_id, file_id, block_id, blocks From dba_extents Where owner = ‘SCOTT’ AND segment_name = ‘EMP’; Select extent_id, file_id, block_id, blocks From dba_extents Where owner = ‘SCOTT’ AND segment_name = ‘EMP’;

9-27 Checking Free Extent Information DBA_FREE_SPACE – – Location and size – –TABLESPACE_NAME – –RELATIVE_FNO – –FILE_ID – –BLOCK_ID – –BLOCKS DBA_FREE_SPACE – – Location and size – –TABLESPACE_NAME – –RELATIVE_FNO – –FILE_ID – –BLOCK_ID – –BLOCKS

9-28 Example Select tablespace_name, count(*), max(blocks), sum(blocks) From dba_free_space Group by tablespace_name; Select tablespace_name, count(*), max(blocks), sum(blocks) From dba_free_space Group by tablespace_name;

9-29 Organizing Tablespaces Based on Fragmentation Propensity Tablespace SYSTEM TOOLS DATA n INDEX n RBS n TEMP n Fragmentation Zero Very low Low High Very high* Usage Data dictionary Applications Data segments Index segments Rollback segments Temporary segments * Relevant only if tablespace PERMANENT

9-30 Summary Allocation and deallocation of extents for different types of segments Block space utilization parameters Allocation and deallocation of extents for different types of segments Block space utilization parameters