Week 3 Lecture 2 Basic Storage Concepts and Settings.

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

Module 2: Database Architecture
5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
Oracle Architecture. Instances and Databases (1/2)
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2007 all rights.
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
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Oracle Architectural Components
Harvard University Oracle Database Administration Session 5 Data Storage.
10 Copyright © 2009, Oracle. All rights reserved. Managing Undo Data.
Advanced Databases Basic Database Administration Guide to Oracle 10g 1.
A Guide to Oracle9i1 Introduction to Oracle9i Database Administration Chapter 11.
INTRODUCTION TO ORACLE
Backup and Recovery Part 1.
Chapter 5 Configuring the RMAN Environment. Objectives Show command to see existing settings Configure command to change settings Backing up the controlfile.
Oracle9i Database Administrator: Implementation and 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.
9/11/2015ISYS366 - Week051 ISYS366 – Week 5-6 Database Tuning - User and Rollback Data Spaces, Recovery, Backup.
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.
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.
9 Storage Structure and Relationships. 9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating.
16 Copyright © 2004, Oracle. All rights reserved. Undo Management.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
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.
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
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.
Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives  Learn the steps for creating a database  Understand the prerequisites for creating.
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 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
G Copyright © 2006, Oracle. All rights reserved. Miscellaneous Topics.
© 2006 Northgate Information Solutions plc and its associated companies. All rights reserved. Slide 1.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Week 2 Lecture 2 Data Dictionary Views and Control Files.
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 © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
9 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
Table spaces.
Database structure and space Management
Storage Structure and Relationships
Oracle 10g Database Administrator: Implementation and Administration
Database structure and space Management
Managing Database Storage Structures
Oracle9i Database Administrator: Implementation and Administration
Physical Database Structure .
Introduction To Oracle 10g
Managing Tablespaces and Data Files
ISYS366, Oracle Disk Internals
Chapter 5 The Redo Log Files.
Database administration
Presentation transcript:

Week 3 Lecture 2 Basic Storage Concepts and Settings

Learning Objectives  Differentiate between logical and physical structures  Create many types of tablespaces  Configure and view storage for tablespaces and datafiles  Use undo data

Introduction to Storage Structures Internal structures store:  The structure of every table, view, and other objects you create  The data you load into your tables and other objects  Information about the structure of tables, views, etc. (metadata)

Introduction to Storage Structures Physical structures: Datafiles Operating system blocks Redo log files Control files

Introduction to Storage Structures Logical Structures: Data block Extent Segment Schema object Tablespace

Introduction to Storage Structures Logical data blocks map directly to contiguous operating system blocks in datafiles

Tablespaces and Datafiles CREATE TABLESPACE DATAFILE SIZE AUTOEXTEND ON|OFF TEMPORARY|PERMANENT EXTENT MANAGEMENT LOCAL|DICTIONARY LOGGING|NOLOGGING ONLINE|OFFLINE SEGMENT SPACE MANAGEMENT MANUAL|AUTO  Add multiple files, separated by commas if needed  Clause is required for user managed files  Clause is optional when using OMF  Can be used to specify SIZE of OMF file Note: additional sub-clauses shown later

Tablespaces and Datafiles CREATE TABLESPACE DATAFILE SIZE AUTOEXTEND ON|OFF TEMPORARY|PERMANENT EXTENT MANAGEMENT LOCAL|DICTIONARY LOGGING|NOLOGGING ONLINE|OFFLINE SEGMENT SPACE MANAGEMENT MANUAL|AUTO  TEMPORARY: This option used only when creating temporary tablespaces that are dictionary-managed.  PERMANENT: Default option; stores permanent objects such as tables and indexes

Tablespaces and Datafiles CREATE TABLESPACE DATAFILE SIZE AUTOEXTEND ON|OFF TEMPORARY|PERMANENT EXTENT MANAGEMENT LOCAL|DICTIONARY LOGGING|NOLOGGING ONLINE|OFFLINE SEGMENT SPACE MANAGEMENT MANUAL|AUTO  LOCAL: Default; tablespace manages extent free space in a bitmap inside the tablespace  DICTIONARY: tablespace manages extent free space in the data dictionary Note: additional sub-clauses shown later

Tablespaces and Datafiles CREATE TABLESPACE DATAFILE SIZE AUTOEXTEND ON|OFF TEMPORARY|PERMANENT EXTENT MANAGEMENT LOCAL|DICTIONARY LOGGING|NOLOGGING ONLINE|OFFLINE SEGMENT SPACE MANAGEMENT MANUAL|AUTO  LOGGING: Default; all DML, DDL, and mass INSERT commands recorded in redo log  NOLOGGING: only DML commands recorded in redo log

Tablespaces and Datafiles CREATE TABLESPACE DATAFILE SIZE AUTOEXTEND ON|OFF TEMPORARY|PERMANENT EXTENT MANAGEMENT LOCAL|DICTIONARY LOGGING|NOLOGGING ONLINE|OFFLINE SEGMENT SPACE MANAGEMENT MANUAL|AUTO  ONLINE: Default; available for use  OFFLINE: not available for use

Tablespaces and Datafiles CREATE TABLESPACE DATAFILE SIZE AUTOEXTEND ON|OFF TEMPORARY|PERMANENT EXTENT MANAGEMENT LOCAL|DICTIONARY LOGGING|NOLOGGING ONLINE|OFFLINE SEGMENT SPACE MANAGEMENT MANUAL|AUTO AUTO: Manages segment free space in a bitmap in the tablespace MANUAL: Manages segment free space in the data dictionary

Implementing OMF With Tablespaces DB_CREATE_FILE_DEST must be set: In init.ora Or, during session CREATE TABLESPACE command: Omit DATAFILE clause in Or, include DATAFILE clause but only include SIZE clause (omit file name)

The DATAFILE Clause DATAFILE ' ' SIZE |REUSE AUTOEXTEND ON|OFF MAXSIZE |UNLIMITED  SIZE : Specify size in bytes, kilobytes, or megabytes  REUSE: File already exists  AUTOEXTEND ON: Allow file to expand when Oracle determines more space is needed  AUTOEXTEND OFF: Do not expand file

The DATAFILE Clause DATAFILE ' ' SIZE |REUSE AUTOEXTEND ON|OFF MAXSIZE |UNLIMITED Used with AUTOEXTEND ON:  MAXSIZE : Specify maximum file size in bytes, kilobytes, or megabytes  UNLIMITED: File can grow to limits of operating system

The EXTENT MANAGEMENT and SEGMENT SPACE MANAGEMENT Clauses Syntax for: EXTENT MANAGEMENT LOCAL: EXTENT MANAGEMENT LOCAL|DICTIONARY AUTOALLOCATE|UNIFORM SIZE SEGMENT SPACE MANAGEMENT MANUAL|AUTO MINIMUM EXTENT DEFAULT STORAGE (INITIAL NEXT PCTINCREASE MINEXTENTS MAXEXTENTS )  AUTO: Manages segment free space in a bitmap in the tablespace  MANUAL: Manages segment free space in the data dictionary  AUTOALLOCATE: Allow the system to manage extent size for all tables and other objects created in the tablespace  UNIFORM SIZE : Require the specified extent size for all tables and other objects created in the tablespace

The EXTENT MANAGEMENT and SEGMENT SPACE MANAGEMENT Clauses Syntax for dictionary-managed tablespace: EXTENT MANAGEMENT LOCAL|DICTIONARY SEGMENT SPACE MANAGEMENT MANUAL|AUTO AUTOALLOCATE|UNIFORM SIZE MINIMUM EXTENT DEFAULT STORAGE (INITIAL NEXT PCTINCREASE MINEXTENTS MAXEXTENTS ) Minimum extent size allowed for any object created in the tablespace Default storage settings for any object created in the tablespace without a STORAGE clause of its own

The EXTENT MANAGEMENT Clause Example: A new table needing 6 M of space skips over the deallocated extents Coalesce free space periodically to combine deallocated extents Example of dictionary-managed datafile

Creating a Dictionary- Managed Tablespace Example: CREATE TABLESPACE USER_TEST DATAFILE 'D:\oracle\data\user_test01.dbf' SIZE 250M AUTOEXTEND ON EXTENT MANAGEMENT DICTIONARY MINIMUM EXTENT 15M DEFAULT STORAGE (INITIAL 90M NEXT 15M PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 50);

Creating a Locally Managed Tablespace Example of locally managed datafile Example: A new table needing a 10M extent would use the free space from two 5 M deallocated extents Deallocated extents are automatically coalesced All new tables must use extents of the same size or multiples of the size

Creating a Locally Managed Tablespace Example: CREATE TABLESPACE USER_AUTO DATAFILE '<C:oracle\oradata\user_auto01.dbf' SIZE 20M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;

Segment Types and Their Uses Data segment: for tables, object tables, triggers Index segment: for indexes Temporary segment: for sorting operations and temporary tables Rollback segment: for undo data LOB segment: for LOB data stored separately from the rest of the table’s data

Temporary Tablespaces Oracle recommends creating locally managed temporary tablespaces Used for temporary segments Command syntax: CREATE TEMPORARY TABLESPACE TEMPFILE SIZE AUTOEXTEND ON|OFF EXTENT MANAGEMENT LOCAL UNIFORM SIZE

Tablespaces With Nonstandard Data Block Size Can be 2 K, 4 K, 8 K, 16 K, or 32 K Requires a special memory cache that matches the block size Create cache by setting the appropriate initialization parameter: DB_2K_CACHE_SIZE DB_4K_CACHE_SIZE DB_8K_CACHE_SIZE DB_16K_CACHE_SIZE DB_32K_CACHE_SIZE

Tablespaces With Nonstandard Data Block Size Example: CREATE TABLESPACE TBS_2K DATAFILE '<C:\oracle\oradata\tbs_2k.dbf' SIZE 4M BLOCKSIZE 2K;

Configuring and Viewing Storage Changes you can make to a tablespace: LOGGING/NOLOGGING PERMANENT/TEMPORARY READ ONLY/READ WRITE Coalesce contiguous storage space Add new datafile Rename a datafile Change size of a datafile

Configuring and Viewing Storage Syntax: ALTER TABLESPACE ADD|RENAME DATAFILE SIZE AUTOEXTEND ON|OFF REUSE DEFAULT STORAGE (INITIAL NEXT PCTINCREASE MINEXTENTS MAXEXTENTS ) MINIMUM EXTENT COALESCE

Configuring and Viewing Storage Taking a tablespace offline: Stops it from being accessed by users Methods for taking a tablespace offline: NORMAL: default TEMPORARY: for damaged datafiles IMMEDIATE: for damaged disk (media)

Read-only Tablespaces Can only be queried No inserts, updates, or deletes Example: ALTER TABLESPACE ACCOUNTING READ ONLY;

Dropping Tablespaces Syntax: DROP TABLESPACE INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS; Use when there is data in the tablespace Use when there are constraints outside the tablespace that reference this tablespace

Querying the Data Dictionary For Storage Data

Example: Find adjacent free extents that should be coalesced SELECT BLOCK_ID, BLOCK_ID+BLOCKS NEXT_BLOCK_ID, BLOCKS FROM DBA_FREE_SPACE WHERE TABLESPACE_NAME = 'USERS' ORDER BY BLOCK_ID;

Querying the Data Dictionary For Storage Data Identifying adjacent free sets of blocks

Overview of Undo Data Undo data is made of undo blocks Contain before images of data blocks Assist in read-consistency Two methods for managing: Manual: the old way (with manually created redo segments) Automatic: the new way (with undo tablespace)

Implementing Automatic Undo Management Requirements: Set initialization parameters: UNDO_MANAGEMENT=AUTO UNDO_TABLESPACE= Create UNDO tablespace: While creating the database Later with CREATE UNDO TABLESPACE command

Implementing Automatic Undo Management Optional initialization parameters: UNDO_RETENTION: time in seconds that undo data is saved after commit (default is 900 seconds) UNDO_SURPRESS_ERRORS: defines error handling when transitioning from manual to automatic undo management

Lecture Summary Database structures are divided into logical and physical groups Physical structures include datafiles, control files, and redo log files Logical structures include tablespaces, extents, and data blocks A tablespace always has at least one datafile where its data is stored Locally managed tablespaces use a bitmap to track extent free space

Lecture Summary When using OMF, omit the DATAFILE clause in the CREATE TABLESPACE command AUTOEXTEND ON allows a datafile to grow as needed Dictionary-managed tablespaces: Use the data dictionary to track extent free space Don’t automatically coalesce free space Locally managed tablespaces: Automatically coalesce free space Keep all extents the same size or a variable system- controlled size

Lecture Summary Types of segments: data, index, temporary, and rollback Temporary tablespaces store data while sorting, and temporary tables Tablespaces can be ONLINE or OFFLINE A READ ONLY tablespace is not included in regular backups or recoveries

Lecture Summary Dropping a tablespace with INCLUDING CONTENTS destroys all its data Data dictionary views for tablespaces include DBA_TABLESPACES and DBA_FREE_EXTENTS Undo data gives users read consistency Automatic undo management uses an UNDO tablespace