10 Managing Rollback Segments. 10-2 Objectives Planning the number and size of rollback segments Creating rollback segments using appropriate storage.

Slides:



Advertisements
Similar presentations
Office of the Accountant General (A&E) Andhra Pradesh Hyderabad
Advertisements

Rollback Segments Nilendu Misra (MAR99)
The Architecture of Oracle
Introduction to Oracle
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Oracle Architecture. Instances and Databases (1/2)
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
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
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.
INTRODUCTION TO ORACLE
Backup and Recovery Part 1.
ITEC474 Redo Log Files.
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
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 Architecture Client Computer Application Server Oracle Database Lan Or Internet Lan Or Internet Client Server Environment Application By Java or.Net.
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.
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
Oracle Locking Michael Messina Principal Database Analyst Indiana University.
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.
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.
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.
Week 3 Lecture 2 Basic Storage Concepts and Settings.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
Nitin Singh,AAO/EDP,RTI Allahabad1 Troubleshooting.
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
Managing Tablespaces and Data Files
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
Over view  Why Oracle Forensic  California Breach security Act  Oracle Logical Structure  Oracle System Change Number  Oracle Data Block Structure.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
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.
6 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
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.
9 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
Initialization Parameters
Database structure and space Management
Database Tuning - User and Rollback Data Spaces, Recovery, Backup
Oracle 10g Database Administrator: Implementation and Administration
Database structure and space Management
Oracle9i Database Administrator: Implementation and Administration
Managing Tablespaces and Data Files
Chapter 5 The Redo Log Files.
Database administration
Presentation transcript:

10 Managing Rollback Segments

10-2 Objectives Planning the number and size of rollback segments Creating rollback segments using appropriate storage settings Maintaining rollback segments Obtaining rollback segment information from the data dictionary Troubleshooting rollback segment problems Planning the number and size of rollback segments Creating rollback segments using appropriate storage settings Maintaining rollback segments Obtaining rollback segment information from the data dictionary Troubleshooting rollback segment problems

10-3 Rollback Segment (Introduction) Used for delete and update operations only Used to ‘undo’ a transaction Used to save the old value when a process changes data. Stores location and value of data before modification A transaction can use only one rollback segment

10-4 Rollback Segment Update transaction Old image New image Rollback segment Table

10-5 Rollback Segment (Steps) Data block brought into DB buffer Rollback segment brought into DB buffer Old data written to the rollback segment Update made to data block

10-6 Rollback Segments: Purpose Transaction rollback Transaction recovery (when instance fails) Rollback segment Read consistency

10-7 Read-Consistency Image at statement commencement New image Table SELECT * FROM table

10-8 Read-Consistency When Oracle begins execution of a SELECT statement, it determines the current SCN Ensures that changes not committed before the SCN are not processed by the statement In the case of a long running transaction, Oracle constructs a read-consistent image of the block by retrieving the before-image and applying changes to it in memory

10-9 Read-Consistency Read consistency is always provided for a SQL statement Request read consistency for a transaction: SET TRANSACTION READ ONLY; Or SET TRANSACTION SERIALIZABLE;

10-10 Types of Rollback Segments SYSTEM: used for objects in the SYSTEM tablespace; created in the SYSTEM ts Non-SYSTEM: objects in other tablespaces – At least one needed – Private: acquire by a single instance – Public: acquired by any instance (used with parallel server) SYSTEM: used for objects in the SYSTEM tablespace; created in the SYSTEM ts Non-SYSTEM: objects in other tablespaces – At least one needed – Private: acquire by a single instance – Public: acquired by any instance (used with parallel server)

10-11 Transactions and Rollback Segments Transactions need rollback segments to be assigned: – SET TRANSACTION Use Rollback Segment rbs1 If no request is made, Oracle uses segment with fewest transactions Transactions use extents in a circular fashion More than one transaction can write to the same extent of a segment; however each block contains information from only one transaction Transactions need rollback segments to be assigned: – SET TRANSACTION Use Rollback Segment rbs1 If no request is made, Oracle uses segment with fewest transactions Transactions use extents in a circular fashion More than one transaction can write to the same extent of a segment; however each block contains information from only one transaction

10-12 Transactions and Rollback Segments Example Transaction 1 Active extent Inactive extent Transaction 2 Begin at extent 3 When full, move to extent 4 (called a wrap) When that fills, can use the 1 st extent if it is free or inactive

10-13 Growth of Rollback Segments Active extent Inactive extent New extent Cannot skip an extent; if next extent is being used, an additional extent is allocated. This is called an extend. Can grow this way until it reaches the maximum number of extents specified in the MAXEXTENTS parameter

10-14 Shrinkage of Rollback Segments Active extent Inactive extent Optimal

10-15 Shrinkage of Rollback Segments Deallocation of extents is not done as soon as transactions end. Deallocation performed when head moves from one extent to next and: Current size of rollback segment > OPTIMAL There are contiguous inactive extents

10-16 Creating Rollback Segments CREATE ROLLBACK SEGMENT rbs01 TABLESPACE rbs STORAGE ( INITIAL 100K NEXT 100K OPTIMAL 4M MINEXTENTS 20 MAXEXTENTS 100); CREATE ROLLBACK SEGMENT rbs01 TABLESPACE rbs STORAGE ( INITIAL 100K NEXT 100K OPTIMAL 4M MINEXTENTS 20 MAXEXTENTS 100); Example MINEXTENTS: at least 2; PCTINCREASE not specified: always 0 Always use INITIAL = NEXT; OPTIMAL specifies size in bytes that the rollback segment must shrink to, if possible AVOID setting MAXEXTENTS to UNLIMITED: can cause unnecessary extension due to program error

10-17 Planning Rollback Segments: Number OLTP – Small, but many segments – One RBS/4 transactions Batch – Large, but few Always place rollback segments in a separate exclusive tablespace Always use INITIAL=NEXT PCTINCREASE cannot be specified (always 0) Set an OPTIMAL value OLTP – Small, but many segments – One RBS/4 transactions Batch – Large, but few Always place rollback segments in a separate exclusive tablespace Always use INITIAL=NEXT PCTINCREASE cannot be specified (always 0) Set an OPTIMAL value

10-18 Planning Rollback Segments: Number of Extents Number of extents Probability of extending

10-19 Bringing Rollback Segments Online Use the following command to make a rollback segment available (when created, they are offline): Specify the following initialization parameter to ensure rollback segments are brought online at STARTUP: Use the following command to make a rollback segment available (when created, they are offline): Specify the following initialization parameter to ensure rollback segments are brought online at STARTUP: ALTER ROLLBACK SEGMENT rbs01 ONLINE; ROLLBACK_SEGMENTS=(rbs01, rbs02)

10-20 How Instances Acquire Rollback Segments when DB is opened Bring all acquired RBSs ONLINE Acquire named private RBS Are there enough RBS ? Acquire public RBS Compute required number of RBS Yes No

10-21 Changing Rollback Segment Storage Settings ALTER ROLLBACK SEGMENT rbs01 STORAGE( MAXEXTENTS 200 ); ALTER ROLLBACK SEGMENT rbs01 STORAGE( MAXEXTENTS 200 ); Use ALTER ROLLBACK SEGMENT

10-22 Manually Deallocating Space from Rollback Segments ALTER ROLLBACK SEGMENT rbs01 SHRINK TO 4M; ALTER ROLLBACK SEGMENT rbs01 SHRINK TO 4M; If OPTIMAL is specified, Oracle will attempt to deallocate Use ALTER ROLLBACK SEGMENT (if extents are active, may not shrink to the requested size) If OPTIMAL is specified, Oracle will attempt to deallocate Use ALTER ROLLBACK SEGMENT (if extents are active, may not shrink to the requested size)

10-23 Taking Rollback Segment Offline ALTER ROLLBACK SEGMENT rbs01 OFFLINE; Take a rollback segment offline to make it unavailable.

10-24 Dropping Rollback Segments A rollback segment must be offline before it can be dropped. DROP ROLLBACK SEGMENT rbs01;

10-25 Rollback Segments in the Database DBA_ROLLBACK_SEGS Identification – SEGMENT_ID – SEGMENT_NAME Location, type, and status – TABLESPACE_NAME – OWNER (PUBLIC or SYS) – STATUS (ONLINE or OFFLINE) DBA_ROLLBACK_SEGS Identification – SEGMENT_ID – SEGMENT_NAME Location, type, and status – TABLESPACE_NAME – OWNER (PUBLIC or SYS) – STATUS (ONLINE or OFFLINE)

10-26 Rollback Segments in the Database Select segment_name, tablespace_name, owner, status From dba_rollback_segs; Select segment_name, tablespace_name, owner, status From dba_rollback_segs;

10-27 Rollback Segment Statistics V$ROLLNAME USN NAME V$ROLLSTAT USN EXTENTS RSSIZE XACTS OPTSIZE HWMSIZE AVEACTIVE STATUS CUREXT CURBLK

10-28 Rollback Segment: Current Activity V$SESSION SADDR USERNAME SID SERIAL# V$TRANSACTION SES_ADDR XIDUSN UBAFIL UBABLK UBASQN UBAREC STATUS USED_UBLK USED_UREC

10-29 Rollback Segment Problems Insufficient space for transactions Read-consistency error Blocking transaction Error in taking tablespace offline Insufficient space for transactions Read-consistency error Blocking transaction Error in taking tablespace offline

10-30 Insufficient Space for Transactions No space in tablespace to extend – Extend data files – Allow automatic extension of data files – Add data files MAXEXTENTS reached for segment – Increase MAXEXTENTS – Recreate segments with larger extent sizes No space in tablespace to extend – Extend data files – Allow automatic extension of data files – Add data files MAXEXTENTS reached for segment – Increase MAXEXTENTS – Recreate segments with larger extent sizes

10-31 Read-Consistency Error (snapshot too old) Image at statement commencement New image Table SELECT * FROM table Reused block A long running Trans Another transaction commits Rollback segment is reused Soln: Higher MINEXTENTS; larger extents; higher OPTIMAL value

10-32 Blocking Session Extent 3 Existing extent New extent Blocking session A long running trans keeps an extent occupied and blocks other trans from writing to it; segment keeps extending Soln: DBA intervention

10-33 Error in Taking a Tablespace Offline Cannot take tablespace containing active RBS offline Check rollback segments in the tablespace Find active transactions using these rollback segments Find session ID and serial number Terminate the session, if necessary Cannot take tablespace containing active RBS offline Check rollback segments in the tablespace Find active transactions using these rollback segments Find session ID and serial number Terminate the session, if necessary

10-34 Summary Creating adequate rollback segments Troubleshooting rollback segment problems Creating adequate rollback segments Troubleshooting rollback segment problems