11

Managing Storage
Copyright © 2008, Oracle. All rights reserved.

• Space

Objectives

After completing this lesson, you should be able to: • Describe how the Oracle database automatically manages space • Proactively monitor and manage tablespace space usage • se the Segment Advisor • !eclaim wasted space from tables and inde"es by using the segment shrin# functionality • Manage resumable space allocation • Describe the concepts of transportable tablespaces and databases
11 - 2 Copyright © 2008, Oracle. All rights reserved.

Management • Proactive Monitoring • Seg$ Advisor % Seg$Shrin# • !esumable Allocation • &ransportable &'S and D'

Space Management: Overview
Space is automatically managed by the Oracle database$ (t generates alerts about potential problems and recommends possible solutions$ )eatures include: • Oracle Managed )iles *OM)+ • )ree,space management with bitmaps *-locally managed.+ and automatic data file e"tension • Proactive space management *default thresholds and server,generated alerts+ • Space reclamation *shrin#ing segments, online table redefinition+ • /apacity planning *growth reports+

11 - 3

Copyright © 2008, Oracle. All rights reserved.

time adjustment • Multiple process search of 'M's . Oracle.)ree Space Management 'M' 'M' 'M' 'M' 'M' 'M' 2 2 2 2 2 2 2 2 2 2 'M' Segment 11 . All rights reserved. { 0"tent Data bloc# 2 • Automatic • 0nabled by the use of locally managed tablespaces • &rac#ed by bitmaps in segments 'enefits: • More fle"ible space utili1ation • !un.4 Copyright © 2008.

Oracle. .&ypes of Segments • A segment is a set of e"tents allocated for a certain logical structure$ &he different types of segments are: Data segment (nde" segment &emporary segment !ollbac# segment • Segments are dynamically allocated by the database$ 11 . All rights reserved.5 Copyright © 2008.

All rights reserved. .Allocating 0"tents • • Searching the data file3s bitmap for the re4uired number of adjacent free bloc#s Si1ing e"tents with storage clauses: UNIFORM AUTOALLOCATE • • 5iewing e"tent map Obtaining deallocation advice 11 .! Copyright © 2008. Oracle.

All rights reserved." Deletes Deletes )ull bloc# Copyright © 2008. Oracle. .'loc# Space Management PCTFREE = 10 )S6 )S7 )S8 FS1 FS2 (nserts. updates FS3 FS4 )ull bloc# 11 .

. Oracle.!ow /haining and Migration 0"ample: • On update: !ow length increases.8 Copyright © 2008. All rights reserved. e"ceeding the available free space in the bloc#$ • Data needs to be stored in a new bloc#$ • Original physical identifier of row *ROWID+ is preserved$ • &he Oracle database needs to read two bloc#s to retrieve data$ • &he Segment Advisor finds segments containing the migrated rows$ Old Origi#al $loc% &ith poi#ter to 'igrated ro& (e& data 11 .

. Oracle.Proactive &ablespace Monitoring Space Management 9 Proactive $ Monitoring Seg$ Advisor % Seg$Shrin# !esumable Allocation &ransportable &'S and D' 11 . All rights reserved.) Copyright © 2008.

Oracle.< full or 8== M' left warning @ocally managed tablespace Alert D'A !esolve space problem !esolve space problem by: • Adding or resi1ing data file • Setting AUTOEXTEND ON • Shrin#ing objects • !educing UNDO_RETENTION • /hec#ing for long.running 4ueries in temporary tablespaces 11 . . All rights reserved. M' left critical :.&hresholds and !esolving Space Problems >?< full or .10 Copyright © 2008.

< Barning /leared /leared MMOA • • • • !ead. Oracle. All rights reserved.only and offline tablespaces: Do not set up alerts$ &emporary tablespace: &hreshold corresponds to space currently used by sessions$ ndo tablespace: &hreshold corresponds to space used by active and une"pired e"tents$ Autoe"tensible files: &hreshold is based on the ma"imum file si1e$ Copyright © 2008.11 . 11 .Monitoring &ablespace Space sage /hec# every 8= min$ Alert Alert >?< /ritical :.

. All rights reserved. Oracle.Shrin#ing Segments Space Management Proactive Monitoring 9 Seg$ Advisor % Seg$Shrin# !esumable Allocation &ransportable &'S and D' CBM 8 ALTER TABLE employees SHRIN SPACE COMPACT! CBM DM@ operations and 4ueries can be issued during compaction$ 6 ALTER TABLE employees SHRIN SPACE! CBM DM@ operations are bloc#ed when the CBM is adjusted$ 11 .12 Copyright © 2008.

!esults of Shrin# Operation • • • • • (mproved performance and space utili1ation (nde"es maintained &riggers not e"ecuted Aumber of migrated rows may be reduced !ebuilding secondary inde"es on (O&s recommended (nde" &able Shrin# D'A &riggers not e"ecuted 11 . All rights reserved. Oracle. .13 Copyright © 2008.

organi1ed tables and inde".organi1ed tables (nde"es Partitions and subpartitions Materiali1ed views and materiali1ed view logs 11 . All rights reserved.place operation Applicable only to segments residing in ASSM tablespaces /andidate segment types: Ceap.14 Copyright © 2008.Space !eclamation with ASSM • • • Online and in. Oracle. .

. All rights reserved.15 Copyright © 2008. Oracle.Segment Advisor: Overview 11 .

Segment Advisor 11 . . All rights reserved.1! Copyright © 2008. Oracle.

All rights reserved. Oracle.1" Copyright © 2008. .ll (otes -age 11 .*eg'e#t Advisor +.

. Oracle.18 Copyright © 2008.(mplementing !ecommendations 11 . All rights reserved.

Database /ontrol and Segment Shrin# 11 .1) Copyright © 2008. All rights reserved. . Oracle.

Shrin#ing Segments by sing SD@ ALTER " SHRIN TABLE #O%ERFLOW$ INDEX SPACE #CASCADE$ MATERIALI&ED %IEW LO' MATERIALI&ED %IEW MODIF( PARTITION MODIF( SUBPARTITION MODIF( LOB ALTER TABLE employees ENABLE ROW MO%EMENT! ALTER TABLE employees SHRIN SPACE CASCADE! 8 6 SPACE.!7 ALTER TABLE employees MODIF( LOB)*es+me. All rights reserved.20 Copyright © 2008. )SHRIN ALTER TABLE employees O%ERFLOW SHRIN SPACE! E 11 . Oracle. .

Oracle. . All rights reserved. rather than starting over • (s suspended for the following conditions: Out of space Ma"imum e"tents reached Space 4uota e"ceeded Space Management Proactive Monitoring Seg$ Advisor % Seg$Shrin# 9 !esumable Allocation &ransportable &'S and D' 11 .Managing !esumable Space Allocation A resumable statement: • 0nables you to suspend large operations instead of receiving an error • Fives you a chance to fi" the problem while the operation is suspended.21 Copyright © 2008.

All rights reserved.of.sing !esumable Space Allocation • Dueries.e/ SELECT 0 FROM s12s-les! ALTER SESSION DISABLE RESUMABLE! 11 . Oracle. you must first enable resumable statements for your session$ • • ALTER SESSION ENABLE RESUMABLE! INSERT INTO s-les_. and certain DD@ operations can be resumed if they encounter an out.space error$ A resumable statement can be issued through SD@. P@GSD@. DM@ operations. .22 Copyright © 2008. or the Oracle /all (nterface *O/(+$ &o run a resumable statement. SD@H@oader.

ll (otes -age 11 .si#g /es. Oracle.23 Copyright © 2008..'a$le *pace Allocatio# +. All rights reserved. .

Oracle. . AFTER SUSPEND trigger Abort 11 .24 Copyright © 2008. All rights reserved.!esuming Suspended Statements 8 SD@ statement )ull table 6 Suspended /ontinue SD@ operation &able with free space 7 Optionally E .

ll (otes -age 11 . .25 Copyright © 2008.'i#g *. All rights reserved.spe#ded *tate'e#ts +. Oracle./es.

2! Copyright © 2008...Ope# 50* 0icroso1t 2i#do&s 6A 9!4-$it: 680 =*eries 8ased <i#. <i#.platform transportable tablespaces: • Simplify data distribution between data warehouse and data marts • Allow database migration from one platform to another • Supported platforms: *olaris?t'@ OA 932-$it: *olaris?t'@ OA 9!4-$it: 0icroso1t 2i#do&s 6A 932-$it: <i#. All rights reserved.. Oracle.(67 4--.&ransporting &ablespaces 2 !esumable Allocation $ 9 &ransportable &'S &ransportable D' /oncept: /ross.7 9!4-$it: 4. .!4 . 6A 9!4-$it: 4.8!: 11 .7 6A 9!4-$it: <i#.>r. 6A 932-$it: A67-8ased *yste's 9!4-$it: 4--.. !4-$it 1or A03 Apple 0ac O* 0icroso1t 2i#do&s !4-$it 1or A03 *olaris Operati#g *yste' 9.

/oncept: Minimum /ompatibility @evel • • • 'oth source and target databases must have COMPATIBLE set to 102020 or higher$ Data file headers are platform. only COMPATIBLE=102020 Copyright © 2008. All rights reserved.aware$ 'efore transporting. .only and offline files are platform. only COMPATIBLE=32420 11 . ma#e sure that all read. Oracle.2" !eadG write !ead. only !eadG write !ead.aware$ !eadG write !ead.

All rights reserved.only$ se Data Pump to e"tract metadata$ &arget uses the same endian formatJ Ies Ao /onvert data files by using !MAA$ Ship data files and dump file to target$ se Data Pump to import metadata$ &arget 11 . . Oracle.28 Ma#e tablespaces readGwrite$ Copyright © 2008.&ransportable &ablespace Procedure Source Ma#e tablespaces read.

-se 6 WHERE 5p2pl-58o*m_. .Determining the 0ndian )ormat of a Platform SELECT 5p2e.2) Copyright © 2008.67-. All rights reserved. Oracle._8o*m-5 FROM 9:5*-.le_pl-58o*m 5p< 9:6-5-.-me! Source &arget 11 .spo*5-.-me = 62pl-58o*m_.

&ransporting Databases • • 2 !esumable Allocation &ransportable &'S 9 &ransportable D' • Fenerali1e the transportable tablespace feature$ Data can easily be distributed from a data warehousing environment to data marts.30 Aew database Copyright © 2008. which are usually on smaller platforms$ A database can be migrated from one platform to another very 4uic#ly$ Platform K Same -endianness. . All rights reserved. Platform I Database files transfer 0"isting database 11 . Oracle.

31 Copyright © 2008. only Ship files !ead. only !ead. All rights reserved.Database &ransportation Procedure: Source System /onversion Open database in READ ONL( mode and COMPATIBLE=102020 !ead. Oracle. only !ead. only CON%ERT DATABASE TO PLATFORM Source system &arget system 11 . .

only Ship files !ead.Database &ransportation Procedure: &arget System /onversion Open database in READ ONL( mode and COMPATIBLE=102020 !ead. only CON%ERT DATABASE ON TAR'ET Source system &arget system 11 . All rights reserved. .32 Copyright © 2008. Oracle. only !ead. only !ead.

.Database &ransportation: /onsiderations • • • • /reate the password file on the target platform$ &ransport the BFILEs used in the source database$ &he generated pfile and transport script use OM)$ se DBNEWID to change the DBID$ 11 . Oracle. All rights reserved.33 Copyright © 2008.

you should have learned how to: • se the Oracle database to automatically manage space • Proactively monitor and manage tablespace space usage • se the Segment Advisor • !eclaim wasted space from tables and inde"es by using the segment shrin# functionality • Manage resumable space allocation • Describe the concepts of transportable tablespaces and databases 11 .34 Copyright © 2008.Summary (n this lesson. All rights reserved. . Oracle.

Oracle.Practice Overview: Managing Storage &his practice covers the following topics: • sing threshold alerts to proactively manage tablespaces • sing the Segment Advisor to shrin# space • 5iewing alerts and alert history in SD@HPlus and 0nterprise Manager 11 . All rights reserved.35 Copyright © 2008. .

3! Copyright © 2008. Oracle. All rights reserved.11 . .