Database creation Using a script: Connect internal as sysdba; create database NAME….; Using the OEM GUI –Parameters stored in a small DB –Access to other.

Slides:



Advertisements
Similar presentations
Rollback Segments Nilendu Misra (MAR99)
Advertisements

The Architecture of Oracle
5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
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.
Data hierarchy in Oracle Data hierarchy in Oracle is specific (and demented!) – see figure 3.1 Normally, unit of storage is file… –Managed by OS –Can grow.
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
Chapter 11: File System Implementation
File System Implementation
1 - Oracle Server Architecture Overview
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Harvard University Oracle Database Administration Session 2 System Level.
Harvard University Oracle Database Administration Session 5 Data Storage.
1.1 CAS CS 460/660 Introduction to Database Systems File Organization Slides from UC Berkeley.
Advanced Databases Basic Database Administration Guide to Oracle 10g 1.
CS 333 Introduction to Operating Systems Class 19 - File System Performance Jonathan Walpole Computer Science Portland State University.
Backup and Recovery Part 1.
Oracle Architecture Client Computer Application Server Oracle Database Lan Or Internet Lan Or Internet Client Server Environment Application By Java or.Net.
Oracle Database Administration
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.
IT The Relational DBMS Section 06. Relational Database Theory Physical Database Design.
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.
Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
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.
Architecture Rajesh. Components of Database Engine.
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
7202ICT – Database Administration
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
9 Storage Structure and Relationships. 9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
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.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
Week 3 Lecture 2 Basic Storage Concepts and Settings.
IT Database Administration Section 09. Backup and Recovery Backup: The available options Full Consistent (cold) Backup Database shutdown, all files.
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
Harvard University Oracle Database Administration Session 6 Object Storage.
IT Database Administration SECTION 02. CREATING DATABASES Creating a Database: Overview 1. Plan the physical design and storage structures 2. Back.
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
CS333 Intro to Operating Systems Jonathan Walpole.
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
10 Managing Rollback Segments Objectives Planning the number and size of rollback segments Creating rollback segments using appropriate storage.
Chapter 5 Index and Clustering
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
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)
Oracle Database Architectural Components
Jonathan Walpole Computer Science Portland State University
Module 11: File Structure
Initialization Parameters
Database structure and space Management
Physical Database Design and Performance
Storage Structure and Relationships
Oracle 10g Database Administrator: Implementation and Administration
CHAPTER 5: PHYSICAL DATABASE DESIGN AND PERFORMANCE
Database structure and space Management
Introduction To Oracle 10g
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 creation Using a script: Connect internal as sysdba; create database NAME….; Using the OEM GUI –Parameters stored in a small DB –Access to other utility pgms – eg: RMAN –Can accommodate several DBAs Key decisions on sizing –Eg: assign a block size – once and for all

Block size Smallest unit of storage in oracle DB Critical perf. Factor as inefficient space use leads to increase I/O activity Block overhead –Integrity section (90 bytes) –Runtime overhead (136 bytes) –Transactional header (24 bytes and growing) –Directory section (Pointers…) –And then………..data Big is beautiful? Percentage of overhead decreases when block size increases, but no right answer here } Approx. 256 b

2 K, 4K, 8K or 16K? OLTP prefer smaller – small granularity increase likelihood that data is in buffer (indexed access) DW or DSS prefer larger – physically close data used together + less movement In practice constraint on memory will also dictate Buffer size + now split in 3 areas: –KEEP pool –RECYCLE pool –DEFAULT pool

Block size and row size Table with average row length = 2236 b (10m records) Block size 4k = 4006 b => one row per block 8 k => 3 rows per block

Opening and closing the DB Startup open NAME; Or Startup mount NAME; Alter database open; Shutdown; Else – use OEM menus

When DB is started 1.System Global Area (SGA) created: a)Data block buffer cache created Size is key for performance of DB fraction of whole DB DB_BLOCK_BUFFERS / DB_BLOCK_SIZE Least Recently Used (LRU) method Too small means fight for space between objects => increase in misses => increase in I/O Too big = crippling for other operations page846

When DB created (2) b)Shared SQL Pool created: Stores DD cache: info about data structure Stores library cache: info about SQL statements run LRU algorithm Too small => no re-use and low performance SHARED_POOL_SIZE in init.ora

Parameter files: INIT.ORA Initialisation file for each DB MYDB = > initmydb.ora Contains sizing of SGA and number of parameters, DB name and block size Read at startup means changes only implemented at next startup

The control file Each DB also has a control file Contains Dbname, name and location of files and redo logs, timestamp of DB creation Can be mirrored for added security Identifies all files that must be opened when Db is loaded Also used in DB recovery

Data hierarchy in Oracle Data hierarchy in Oracle is specific (and demented!) Normally, unit of storage is file… –Managed by OS –Can grow / shrink –Physical sections logically connected by OS In Oracle a DB = one or more tablespaces –One or more objects, indexes, clusters… –Fixed size – gets full –Extended by DBA only –One file can support only ONE tablespace See figure 3.1

About tablespaces Kind of partitioning –Except fixed size Extended by dba –Oracle very strong at TS level Optimal seems to be around 2GB Strategy = isolate aged data into one tablespace => can be made read-only Should store similar objects together

Reasoning behind TS creation Business relevance Size of objects Type of activity Volume of activity Backup Transportability Time-based changes in activity

Reasoning behind TS creation Business relevance Size of objects Type of activity Volume of activity Backup Transportability Time-based changes in activity e.g. modular design / keep data togegther Object of similar sizes – reuse of space e.g. index VS table / full scan VS rowID Low I/O VS high I/O objects TS is smallest unit for Bcup and restore Cloning copy is done by TS as well DW env. Aged archived system better – access time related Bias towards more rather than less = > compromise Also perf reading P 148

Create a tablespace Create tablespace FREDDY datafile ‘path\freddy.dbf’ size 1000K Default storage (initial 10K next 10K Minextent 1 maxextents 100 Pctincrease 0) Permanent;

Tables = one physical space on disk [segment] – same for any object Each segment = space set out in tablespace [initial extent] When table grows allocate next extent – set of adjacent blocks Until tablespace is full see figure 20.3 Object creation

What a segment looks like Each segment contains a header block Space directory for other blocks Properly sized tables = few extents (low fragmentation) Additional extents are never lost until drop or delete commands are used Can also adjust pctfree value (to fill a Null value column)

Sizing extents Try to match the max capacity of your storage device to limit I/O operations For single objects, It is beneficial to keep extents of same size (deletion) Try to limit the number of extents below 50 (measure of the growth of the object) If too many, rebuild object with larger size extents

Oracle “space allocation” DBA allocates space for table after 2 days of hard thinking Oracle ignores it blatantly as follows: Table nameinitial sizenext extentoracle sizingnext extent Smalltab7K7K20K20K Mediumtab103K103K120K120K Total size after growth smalltab = 40K instead of 14K mediumtab = 206K instead of 240K

Creating and using tables Table creation with CREATE TABLE statement Syntax: Create table NAME ( field1datatypespecial constraint field2datatype etc… ); Special constraint: e.g. NOT NULL or PRIMARY KEY or CHECK

Constraints Candidate key: Create table fred ( namevarchar2(10) NOT NULL firstnamevarchar2(10) NOT NULL agenumber Constraint FRED_UQ unique (name, firstname) );

Primary Key Create table fred ( namevarchar2(10) firstnamevarchar2(10) agenumber Constraint FRED_PK Primary Key (name, firstname) ); Same apart: always NOT NULL + can only have one of them in a table If only one field just list primary key as special constraint

Foreign key – aka referential integrity constraint Create table fred ( IDnumber NOT NULL namevarchar2(10) firstnamevarchar2(10) agenumber Constraint FRED_PK Primary Key (ID), foreign key (age) references OTHERTAB(age) ); Use ON DELETE CASCADE to maintain constraint

Check constraint Create table fred ( IDnumber NOT NULL namevarchar2(10) firstnamevarchar2(10) agenumber CHECK (age between 18 and 65) );

Deleting data Drop table statement – remove table Or truncate table statement – empty it Warning: neither can be rolled back Otherwise: Alter table NAME Add (…) Alter table NAME modify (…) drop column fieldname See rules on handout

Now what? Clusters To store different tables in physically close areas on disk Create a cluster to store both objects Cluster key is any useful field that links the tables Can keep name of field or pick new one –e.g. Create cluster fred (name datatype) –then assign tables: create table…cluster fred (name)

What this cluster looks like 12 Cork fred adam French 13MidletonBobFitzIrish 14Bally…BrianO’reillyEnglish Cluster Key Table 1 Table 2

Finally… Users can have different logical views on a database These views are called…..? They allow for a re-organisation of physical DB objects for each users Each ? can contain elements from different tablespaces Has limited size allocated to each user

Summary: storage in Oracle Keywords: tablespace / datafiles / database objects / segments / extents When you create an object: –Specify size / tablespace info = storage clause –Otherwise: default values Pctincrease should be used with care (affects re- usability of reclaimed space – i.e. extents) Wise use of tablespace eases admin (like partitioning) –sizing follows sizing of device – e.g. 2GB –Many utilities to work with tablespaces –Isolate processes – e.g. a report running inside a TS –Also for archiving

Performance issues Extent sizing a key Oracle has 2 ways to read data: –By rowID – typically thru an index –Full table scan In second case, oracle reads several blocks at a time –Set with DB_FILE_MULTIBLOCK_READ_COUNT –Limited only by I/O device buffer capacity –E.g. block = 4K, I/O buffer = 64K => ????? –Extent size should be multiple of 64K

example Table with 10 extents 64 K each I/O device buffer = 64K => 10 reads If extent = 640K => ???? Reads If 8 extents 80K each => ??? Reads –Reads cannot span extents => 16 reads or an increase of 60% in I/O operations Cl: either use extents much larger than buffer or use multiple of buffer size

And for roll back segments Should be kept small enough Current wisdom is to ensure TS for rollback is normally 50% free Not always possible to use only one RB size –For different types of processes – e.g. TPS –Use two different TB to isolate activites –Easier trouble shooting Discarded rollback segments go into the log file