Harvard University Oracle Database Administration Session 6 Object Storage.

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

Data Definition Language (DDL)
The Architecture of Oracle
Oracle Architecture. Instances and Databases (1/2)
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
Introduction to Structured Query Language (SQL)
IS 4420 Database Fundamentals Chapter 6: Physical Database Design and Performance Leon Chen.
1 - Oracle Server Architecture Overview
METU Department of Computer Eng Ceng 302 Introduction to DBMS Disk Storage, Basic File Structures, and Hashing by Pinar Senkul resources: mostly froom.
Harvard University Oracle Database Administration Session 2 System Level.
Harvard University Oracle Database Administration Session 5 Data Storage.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 13 Disk Storage, Basic File Structures, and Hashing.
Introduction to SQL  SQL or sequel  It is a standardised language with thousands of pages in the standard  It can be in database system through GUI,
Oracle Database Administration Database files Logical database structures.
CHAPTER 11 Large Objects. Need for Large Objects Data type to store objects that contain large amount of text, log, image, video, or audio data. Most.
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.
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
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 17 Disk Storage, Basic File Structures, and Hashing.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
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.
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
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.
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.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
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.
File Structures. 2 Chapter - Objectives Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and.
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 
Database Storage Structures
Locally Managed Tablespaces in Oracle8i Raghav Vinjamuri
1/14/2005Yan Huang - CSCI5330 Database Implementation – Storage and File Structure Storage and File Structure II Some of the slides are from slides of.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Managing Tablespaces and Data Files
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.
Unit 6 Seminar. Indexed Organized Tables Definition: Index Organized Tables are tables that, unlike heap tables, are organized like B*Tree indexes.
Chapter 5 Record Storage and Primary File Organizations
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.
Select Operation Strategies And Indexing (Chapter 8)
8 Copyright © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
Introduction To Oracle
Module 11: File Structure
TABLES AND INDEXES Ashima Wadhwa.
Database structure and space Management
Physical Database Design and Performance
Database Management Systems (CS 564)
Database Tuning - User and Rollback Data Spaces, Recovery, Backup
Storage Structure and Relationships
Oracle 10g Database Administrator: Implementation and Administration
Lecture 10: Buffer Manager and File Organization
DATABASE MANAGEMENT SYSTEM
Database structure and space Management
Physical Database Structure .
Introduction To Oracle 10g
Storage Structure and Relationships
Managing Tables.
Presentation transcript:

Harvard University Oracle Database Administration Session 6 Object Storage

Harvard University Note  The mid-term will be held week 8, March 18 st, just before spring break  It will be open book. An understanding of the concepts is most important.

Harvard University Note  On-line TA session run by Joel  Thursday Nights 7:30PM - 9:30PM  Using Elluminate  Hands-on TA session run by Rohit  After class Wednesday night, RM 102, 53 Church St

Harvard University Data Storage  The units for data storage allocation are extents  A table is a segment  An index is a segment  Segments are sets of extents  An extent is a specific number of contiguous data blocks

Harvard University Data Storage  The data for a table is stored in a data segment  The data for an index is stored in an index segment

Harvard University Data Storage  The extents of a segment may or may not be contiguous on the disk  A segment and all of its extents are stored in one tablespace

Harvard University Blocks  The data block is broken into the following sections – Header contains the block address and type of segment – Table Directory contains information about the table – Row Directory contains the address for each row or row piece – Free space is used to insert new rows or update existing rows – Row Data is the area that currently has data

Harvard University Blocks

Harvard University PCTFREE  PCTFREE – States that a percentage of each data block in a table’s data segment, will be kept free for possible updates, of existing rows, in the future

Harvard University PCTUSED  PCTUSED – The parameter that sets the minimum percentage of a block, that can be used for row data plus overhead before new rows will be added to the block.  After a data block is filled to the limit determined by PCTFREE, Oracle considers the block unavailable for the insertion of new rows until it falls below PCTUSED block falls below the parameter PCTUSED.

Harvard University The Table  A regular table is the method used to store user data  We have very little control in how data is stored in a regular table  Rows may be stored in any order, depending on the activity on the table

Harvard University Ordinary Tables  Ordinary (heap-organized) table  General purpose table  The data is stored as an unordered collection (heap)

Harvard University The Row  Row data is stored in database blocks as variable length records  The Columns of a row are stored in the order in which they are defined  Each row in a table can have a different number of columns

Harvard University The Row  Each row has a row header  It contains the number of columns in the row, the chaining information and the row lock status  Each row has row data  For each column, Oracle stores the column length and then the value

Harvard University The Row  Each row in a table having less than 256 columns are stored as one or more row pieces  If there are more than 255 columns then the row uses intra-block chaining

Harvard University The Row  One byte is needed to store the column length if the length cannot exceed 250 bytes  Three bytes are needed if the the length is longer  The column value is stored immediately after the column length bytes

Harvard University The Row  Adjacent rows do not need any space between them  Each row in the block has a slot in the row directory  The directory slot points to the beginning of the row

Harvard University Data Types  There are a number of scalar data types – Character data – Numeric data – Date data type  Character data can be stored in either fixed- length or variable length strings  Fixed length such as CHAR is stored with padded blanks

Harvard University Data Types  Variable-length use only the number of bytes needed to store the actual column value  These can vary in size up to 4,000 bytes  VARCHAR2 is an example of variable length

Harvard University Data Types  Numbers are always stored as variable length data  It can store up to 38 significant digits

Harvard University Data Types  Numeric data needs – One byte for the exponent -- Exponents are a shorthand way to show how many times a number, called the base, is multiplied times itself. A number with an exponent is said to be "raised to the power" of that exponent. – One byte for every two significant digits in the mantissa – after the decimal point – One byte for negative numbers if the number of significant digits is less than 38 bytes

Harvard University Data Types  Dates are stored in fixed-length fields of seven bytes  An Oracle DATE always includes time  The Raw data type enables the storage of small binary data  The number of bytes needed to store the column is variable, up to 2,000 bytes

Harvard University Null Values  A null is the absence of a value in a column of a row. Nulls indicate missing, unknown, or inapplicable data.  A null should not be used to imply any other value, such as zero.  A column allows nulls unless a NOT NULL, in which case no row can be inserted without a value for that column.  Nulls are stored in the database if they fall between columns with data values. In these cases they require 1 byte to store the length of the column (zero).

Harvard University Null Values  In tables with many columns, the columns more likely to contain nulls should be defined last to conserve disk space.  Comparisons between nulls and other values are by definition neither true nor false, but unknown.

Harvard University ROWID  The ROWID is a pseudo-column that can be queried along with other columns in a table  It has the following characteristics – It is unique identifier for each row in the database – It is not stored as a column value – It does not give the actual physical address of the row, but can be used to locate the row

Harvard University ROWID – It is the fastest means of accessing a row in a table – ROWID needs 10 bytes of storage and is displayed using 18 characters

Harvard University ROWID  The ROWID are made up of the following components – The data object number is assigned to each data object, such as a table or index, when it is created. It is unique within the database – The relative file number is unique to each file within a tablespace – The block number represents the position of the block containing the row within the file – The row number identifies the position of the row directory slot in the block header

Harvard University ROWID  ROWID is displayed using a base-64 encoding scheme – Data object number 6 positions – Relative file number 3 positions – Block number 6 positions – Row number 3 positions

Harvard University ROWID  Select ROWID from  Example – AAADC4AACAAAAMAAAA – AAADC4 is the data object number – AAC is the relative file number – AAAAMA is the block number – AAA is the row number

Harvard University The Storage Clause Storage (initial bytes, next bytes, minextents integer, maxextents integer, pctincrease integer)

Harvard University Create Table Create table [schema.] table (column datatype [, column datatype] …) [TABLESPACE tablespace] [pctfree integer] [pctused integer] [initrans integer] [maxtrans integer] [Segment storage clause] [logging | nologging] [cache | nocache]

Harvard University Create Table create table [schema].table_name (first_name varchar2(15), characters middle_initial char(2), ---2 characters last_name varchar2(20)), characters

Harvard University Create Table  Schema is the table owner  Table_name is the name of the table  Column is the name of the column  Datatype is the data type of the column  Tablespace is the tablespace where the table will be created

Harvard University Create Table  Logging specifies that the creation of the table will be logged in the redo log file  Nologging specifies that the creation of the table and certain types of data loads will not be logged in the redo log file

Harvard University Create Table  Cache specifies that the blocks retrieved for this table are in the most recently used end of the LRU list, in the buffer cache  Nocache specifies that the blocks retrieved for this table are in the least recently used end of the LRU list, in the buffer cache

Harvard University Create Table  Create tables in a separate tablespace, one that does not have indexes, rollback segments or temporary segments  Use a few standard extent sizes that are multiples of 5 * db_block_size, to minimize fragmentation example 5 * 8k = 40k * 100 = 4M 5 * 16k = 80k * 100 = 8M

Harvard University Create Table  It is easier to use the autoallocate clause, when creating the locally managed tablespace  Use the cache clause for small reference tables that are accessed frequently

Harvard University Alter Table  To change an existing table we use the ALTER TABLE command Alter table [schema.] table {[storage-clause] [pctfree integer] [Pctused integer] [Initrans integer] [maxtrans integer]

Harvard University Alter Table  The changes in the storage take effect on any new extents that are allocated  The value of INITIAL extent cannot be modified  The value of the NEXT extent is rounded to a multiple of the block size greater to or equal to the value specified

Harvard University Alter Table  Changes to the block parameters PCTFREE and INITRANS will effect only new blocks  Changes to PCTUSED and MAXTRANS will effect all blocks  Block Parameters are changed to improve space utilization and reduce migration

Harvard University Row Chaining  Row chaining occurs when a row is too large to fit into a single block  The row is too large to fit into one data block upon first insertion it is first inserted  It is then divided into row pieces  Each row piece is stored in different blocks  The necessary pointers to retrieve the whole row are provided

Harvard University Migration  When a row that originally fit into one data block, is updated, so that the overall row length increases, and the block’s free space is already completely filled.  Oracle migrates the data for the entire row to a new data block, assuming the entire row can fit in a new block.  The rowid of a migrated row does not change.

Harvard University Migration  When a row is chained or migrated, I/O performance associated with this row decreases  Oracle now must scan more than one data block to retrieve the information for the row.  Row Chaining can be minimized by choosing a larger block size or splitting the table into multiple tables, with fewer columns

Harvard University Views  A view is not allocated any storage space  A view does not contain data  A view is defined by a query that extracts or derives data from the tables that the view references.  These tables are called base tables.

Harvard University Materialized Views  Materialized views are schema objects that can be used to summarize, compute, replicate, and distribute data.  Data is stored as if they were tables

Harvard University Locally Managed Tablespaces  The CREATE TABLESPACE command has an "extent_management_clause", that specifies how the extents of the tablespace will be managed. This clause uses one of the following parameters:  - DICTIONARY: Specifies that the tablespace is managed using dictionary tables. This is the default for 8i.  - LOCAL: Specifies that the tablespace is locally managed. Locally managed tablespaces have some part of the tablespace set aside for a bitmap.

Harvard University Locally Managed Tablespaces  The storage parameters NEXT, PCTINCREASE, MINEXTENTS, MAXEXTENTS, and DEFAULT STORAGE are not valid for extents that are managed locally.

Harvard University Automatic Segment Space Management (ASSM)  CREATE TABLESPACE USERS DATAFILE '/u04/app/oracle/product/9.0.1/oradata/ /t est.dbf' SIZE 1M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K SEGMENT SPACE MANAGEMENT AUTO;

Harvard University Automatic Segment Space Management (ASSM  The tablespace must be permanent and locally managed.  If used, the segment ignores PCTUSED and FREELIST

Harvard University Reading  Oracle11g Concepts Guide – Part 2 Oracle Database Architecture  Chap 2 and 3  Chap 5 thru 8  Chap 12

Harvard University Reading  Oracle11 Administration Guide – Part 1 Basic Database Administration  Chap 1 thru 6 – Part 2 Oracle Database Structure and Storage  Chap 9 thru 14