Database Tuning - User and Rollback Data Spaces, Recovery, Backup

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)
SQL/PL SQL Oracle By Rana Umer. Performance Tuning Indexes ROWID View Sequences Oracle By Rana Umer.
11 Copyright © Oracle Corporation, All rights reserved. Managing Tables.
The Architecture of Oracle
5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Performance And Tuning – Lecture 7 Copyright System Managers LLC 2007 all rights reserved.
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.
Introduction to Structured Query Language (SQL)
Harvard University Oracle Database Administration Session 2 System Level.
Harvard University Oracle Database Administration Session 5 Data Storage.
Oracle Database Architecture An Oracle server: –Is a database management system that provides an open, comprehensive, integrated approach to information.
Introduction to Structured Query Language (SQL)
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.
IT The Relational DBMS Section 06. Relational Database Theory Physical Database Design.
Oracle Database Architecture An Oracle server: –Is a database management system that provides an open, comprehensive, integrated approach to information.
Database Administration TableSpace & Data File Management
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 9 Index Management.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
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.
9 Storage Structure and Relationships. 9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 7 Basic Table Management.
Sizing Basics  Why Size?  When to size  Sizing issues:  Bits and Bytes  Blocks (aka pages) of Data  Different Data types  Row Size  Table Sizing.
15 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Summary.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
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.
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
Harvard University Oracle Database Administration Session 6 Object Storage.
6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.
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.
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.
8 Copyright © 2005, Oracle. All rights reserved. Gathering Statistics.
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 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.
Data, Space and Transaction Processing
Index An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each value that appears in the indexed.
Database structure and space Management
Chapter 11: File System Implementation
Database structure and space Management
Physical Database Structure .
Introduction To Oracle 10g
Oracle Memory Internals
Managing Indexes.
Storage Structure and Relationships
Managing Tables.
Managing Tablespaces and Data Files
ISYS366, Oracle Disk Internals
Database administration
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Presentation transcript:

Database Tuning - User and Rollback Data Spaces, Recovery, Backup ISYS366 – Week 5-6 Database Tuning - User and Rollback Data Spaces, Recovery, Backup 9/12/2018 ISYS366 - Week05

Database Deliverables of a System Development Process ERD Relational model Disk space requirements Tuning goals – response time, etc. Security requirements Data requirements Data entry and retrieval Backup and recovery Execution plans – EXPLAIN PLAN Acceptance testing 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables CREATE TABLE employee (…) TABLESPACE user_work PCTFREE 20 PCTUSED 60 STORAGE(INITIAL 10M NEXT 5K PCTINCREASE 0); 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables Blocks Block header = 90 bytes 2K block size: 2048-90 = 1958 bytes 4K block size: 4096-90 = 4006 bytes 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables Blocks Block header = 90 bytes 2K block size: 2048-90 = 1958 bytes 4K block size: 4096-90 = 4006 bytes pctfree the amount of space reserved in the block for updates that will expand the row the purpose is to minimize disk I/O by reducing row chaining and row migration row chaining occurs when you have to go to another block to get the rest of the row row migration occurs when you have to write a row to another data block (can be cause by too low pctfree) 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables pctfree used for both tables and indexes Default is 10% The more volatile you data, the higher pctfree For DW and OLAP, pctfree can be 0 1958*(10/100) = 196 bytes (round up) 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables pctused Determine when used blocks can be readded to the list of blocks into which rows can be added Default is 40, which is too low for frequent deletes For frequent deletes, try: 95 - pctfree 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables Free list space Each table has associated with it lists of data blocks that have been allocated for that table These lists contain free spaces for inserting rows called "free lists“ Blocks in the free list is less than PCTUSED full 2048 – 90 – 196 = 1762 bytes for data 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables Space used per row Bytes per row When data is available Average bytes per row SELECT AVG(NVL(VSIZE(col1),0)) + AVG(NVL(VSIZE(col2),0)) + AVG(NVL(VSIZE(col3),0)) + AVG(NVL(VSIZE(col4),0)) FROM table; 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables Space used per row When data is available Maximum bytes per row SELECT column_name, data_type, data_length FROM table WHERE table_name = 'table_name'; 3 bytes for row header 1 byte for each column 1 byte for each long column 10 bytes for each ROWID (Oracle 8) Rows per block Free space/bytes per row 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing tables Determining if pctfree is correct ANALYZE TABLE table COMPUTE STATISTICS; RETRIEVE DATA SELECT Num_rows, Blocks, Num_rows/Blocks FROM User_Tables WHERE Table_name = 'TABLE_NAME'; Perform an update Run ANALYZE again If the number of rows is fewer, then that means they have been moved to a new data block. Thus, the pctfree is NOT high enough. If, however, the Avg_space (also generated by ANALYZE) is large, then the pctfree is TOO high 9/12/2018 ISYS366 - Week05

Determining actual storage SELECT COUNT(*) FROM mytable; SELECT COUNT (DISTINCT (SUBSTR (ROWID, 1, 8)) || (SUBSTR (ROWID, 15,4))) FROM mytable; #rows per block = #rows/#blocks OR ANALYZE TABLE table COMPUTE STATISTICS; RETRIEVE DATA SELECT Num_rows, Blocks, Num_rows/Blocks FROM User_Tables WHERE Table_name = 'TABLE_NAME'; 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing indexes Blocks Block header = 161 bytes 2K block size: 2048-161 = 1887 bytes 4K block size: 4096-161 = 3935 bytes pctfree Same as for tables 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing indexes Space used per index row Average bytes per indexed column 8 bytes for index row header 1 byte for each column 1 byte for each long column 1 byte if index is UNIQUE 6-10 bytes for each ROWID (Oracle 8) Blocking Factor (rows per block) Free space/bytes per row 9/12/2018 ISYS366 - Week05

Disk Space Requirements – Sizing indexes N.B. deleted index space is rarely reused, so indexes may grow even if tables don't! 9/12/2018 ISYS366 - Week05

Sizing Tablespaces 9/12/2018 ISYS366 - Week05 SQL> select * From user_tablespaces; TABLESPACE_NAME INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE --------------- -------------- ----------- ----------- ----------- ------------ MIN_EXTLEN STATUS CONTENTS LOGGING EXTENT_MAN ALLOCATIO ---------- --------- --------- --------- ---------- --------- SYSTEM 106496 106496 1 300 1 0 ONLINE PERMANENT LOGGING DICTIONARY USER RBS 1048576 1048576 2 121 0 USERS 57344 57344 1 121 1 TEMP 106496 106496 1 121 0 0 ONLINE TEMPORARY LOGGING DICTIONARY USER INDX 57344 57344 1 121 1 OEM_REPOSITORY 131072 131072 1 2.147E+09 0 131072 ONLINE PERMANENT LOGGING DICTIONARY USER DRSYS 40960 40960 1 505 50 WEBBOARD 40960 40960 1 505 50 8 rows selected. 9/12/2018 ISYS366 - Week05