Rollback Segments Nilendu Misra (MAR99)

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

Office of the Accountant General (A&E) Andhra Pradesh Hyderabad
11 Copyright © Oracle Corporation, All rights reserved. Managing Tables.
The Architecture of Oracle
Introduction to Oracle
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
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
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.
A Guide to Oracle9i1 Introduction to Oracle9i Database Administration Chapter 11.
Database Backup and Recovery
Backup and Recovery Part 1.
ITEC474 Redo Log Files.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
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.
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.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Oracle Locking Michael Messina Principal Database Analyst Indiana University.
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.
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.
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 
Database Storage Structures
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
Managing Tablespaces and Data Files
The Self-managing Database: Proactive Space and Schema Object Management Amit Ganesh Director, Data, Space and Transaction Processing Oracle Corporation.
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.
Over view  Why Oracle Forensic  California Breach security Act  Oracle Logical Structure  Oracle System Change Number  Oracle Data Block Structure.
© 2006 Northgate Information Solutions plc and its associated companies. All rights reserved. Slide 1.
Backup and Recovery - II - Checkpoint - Transaction log – active portion - Database Recovery.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
IT Database Administration Section 05. Rollback Segments: An Introduction  What are they?  Space within a database used to store “before” images.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
8 Copyright © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
Oracle Database Architectural Components
9 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
Data, Space and Transaction Processing
Database structure and space Management
Maintaining Online Redo Log Files
Instance and Media Recovery Structures
Oracle 10g Database Administrator: Implementation and Administration
Database structure and space Management
Physical Database Structure .
Introduction To Oracle 10g
Managing Tablespaces and Data Files
ISYS366, Oracle Disk Internals
Database administration
Presentation transcript:

Rollback Segments Nilendu Misra (MAR99)

Areas Covered Guidelines to Manage Creating/Altering/Dropping RBS Storage Parameters Monitoring & Tuning

What Is For every transaction taking place RBS keeps the BEFORE IMAGE of the DATA READ CONSISTENCY ROLLBACK Transaction RECOVER Database

Read Consistency For a query, only data blocks written on or before that SCN are read. Blocks changed after that are read from RBS. e.g.,when this query started the SCN noted was 10023

Number During creation SYSTEM RBS After creation create several RBS in a separate tablespace Every RBS should be of same size Every EXTENT in a RBS is of same size Ideally number of RBS should be equal to Maximum number of concurrent transactions (WHY?)

Number (Cont.) Thumb Rule is to create N RBS where N = no. of users / 4 One transaction can use ONE RBS Many transactions can acquire the same RBS TRANSACTION TABLE contains the address of the row modified & status(Committed / Active)

Number (Cont.) CIRCULAR BUFFER. Should have at least 2 extents If the NEXT extent is not available, new extent is allocated PCTINCREASE = 0 OPTIMAL SET TRANSACTION USE ROLLBACK SEGMENT R01 ;

Tips Should be minimum 20 extents ALTER ROLLBACK SEGMENT R01 OFFLINE; Sizing should be done W.R.T largest transaction Another Thumb Rule : SIZE = 10% of Largest Table Size SYSTEM rollback segment cannot be taken OFFLINE

Creation CREATE [PUBLIC] ROLLBACK SEGMENT R5 TABLESPACE RBS STORAGE (INITIAL 1024K NEXT 1024K OPTIMAL 5M MINEXTENTS 20 MAXEXTENTS 40); Rules : (a) INITIAL = NEXT (b) MINEXTENTS = 2 (DEFAULT) (c) MAXEXTENTS = Calculated Value (d) PCTINCREASE = 0 (DEFAULT) (e) Unless running PARALLEL instances dont use PUBLIC

Alter Storage ALTER PUBLIC ROLLBACK SEGMENT R05 STORAGE (NEXT 256K); [Note : This could result in mismatched extent size] ALTER ROLLBACK SEGMENT R05 SHRINK TO 1000K; ALTER ROLLBACK SEGMENT R05 SHRINK TO OPTIMAL;

Dropping A RBS must not be in USE After dropping MUST be removed from init.ora. Otherwise database cannot be restarted. [Note : RBS mentioned in the init.ora are taken ONLINE while the database is restarted. Or by default, when an instance starts, it acquires TRANSACTIONS/TRANSACTIONS_PER_RO LLBACK_SEGMENT] Drop rollback segments when the extents are too fragmented on disk, or the segment needs to be relocated in a different tablespace.

Display Info SELECT SEGMENT_NAME, TABLESPACE_NAME,STATUS FROM SYS.DBA_ROLLBACK_SEGS; STATUSDESCRIPTION IN USEOnline AVAILABLE Created,but not online OFFLINE Offline INVALID Dropped NEEDS RECOVERY Corrupted PARTLY AVAILABLE Unresolved transaction data in a Distributed DB

Reiterate IDEALLY (1) Each Transaction should fit in one extent of a RBS (2) All user RBS should be outside SYSTEM tablespace (3) All RBS will have same size

ORA SNAPSHOT TOO OLD Occurs because the RBS is small. So the old Snapshot of the old transaction gets overwritten by other undo information. When some user queries the data it is not there in RBS. Solution : Create Larger RBS

Sizing RBS Before & After the largest transaction issue : SELECT SUM(WRITES) FROM V$ROLLSTAT; (No other transaction should go on) UNDO generated = (AFTER Value - BEFORE Value)

View OPTIMAL SELECT A.NAME,B.OPTSIZE FROM V$ROLLNAME A, V$ROLLSTAT B WHERE A.USN=B.USN; V$ROLLSTAT COLUMNS XACTS - No of active transactions WRITES - No of Bytes written to the RBS HWMSIZE - Max size(B) reached during usage SHRINKS - No of shrinks to OPTIMAL size WRAPS - No of times an entry wrapped into a new extent EXTENDS - No of new extent acquisition

This RBS is used by Transactions acquire lock (type TX) within RBS header.So join V$LOCK to V$ROLLNAME. Each lock is owned by a process. So further join V$LOCK to V$PROCESS to map Process with RBS(script given in Lab) SELECT R.NAME RBS, P.PID ORACLE_PID, P.SPID OS_PID, NVL(P.USERNAME,'NO TRANSACTION') TRANSACTION, P.TERMINAL FROM V$LOCK L,V$PROCESS P,V$ROLLNAME R WHERE L.ADDR = P.ADDR(+) AND TRUNC(L.IDL(+)/65536) = R.USN AND L.TYPE(+) = 'TX' AND L.MODE(+) =6 ORDER BY R.NAME ;

Tips For BATCH jobs use big RBS explicitly assigned TRUNCATE does not use RBS [well almost] In Import use COMMIT = Y Use OPTIMAL judiciously Better waste some space on RBS datafile (keep AUTOEXTEND) PUBLIC cannot be altered to PRIVATE PRIVATE cannot be altered to PUBLIC

A Few Questions Your database has 20 RBS. Each RBS has 50 maxextents. Each extent size is 20K. Minextent is 2. Now an overnight batch operation generates 18M undo volume. This batch (PLSQL) deletes all records from 10 large tables. (a) Could the batch operation be done normally? (b) Suggest improvement(s)

Few Questions(!!!) DB has 4 RBS. Size Details for each : INITIAL 1024K NEXT 1024K MAXEXTENTS 25 OPTIMAL 5M. High Water mark for each is 25M. The datafile to RBS tablespace is 100m. Now, when the DB is just up what % of that datafile will be full?