SlideShare a Scribd company logo
Locally Managed Tablespace                                                      Administration Tips




Locally Managed versus Dictionary Managed Tablespaces

There's no real issue here at all. Locally Managed tablespaces knock the spots of their
Dictionary Managed cousins, and I'd go so far as to suggest that every single tablespace you
create should be locally managed.

That's for two principle reasons, one a matter of efficient resources, the other for
performance.

Dictionary Managed tablespace can simply NOT be made to guarantee consistent extent
sizes. It doesn't help that their default PCTINCREASE is 50%, thus absolutely guaranteeing
odd-sized extents, and hence eventual fragmentation. But even when you remember when
to set that to 0%, you are still going to get odd-sized extents. The tablespace DEFAULT
STORAGE clause is just that -a default. Anyone who sticks in a real STORAGE clause when
creating a table is going to over-ride whatever the default storage clause happens to allow
for. And yes, there's a MINIMUM EXTENT clause in Oracle 8.0 and above which can try and
alleviate that problem by guaranteeing that all extents must be a minimum size, or
multiples thereof. But if I have a MINIMUM EXTENT of 500K, and request a new extent of
1232K, I'm going to get a 1500K extent -which is not consistent with all the other 500K
extents I've already acquired. So the problem is still there.

Locally Managed tablespace, created with the 'UNIFORM SIZE x' clause simply can NOT have
odd-sized extents, ever. Ask for 1232K on a 500K locally managed uniform size tablespace,
and you'll get 3 500K extents. You still get all the space you wanted, but always in
consistent allocations. It is therefore absolutely impossible for a uniform size locally
managed tablespace ever to experience fragmentation.

So which is better for efficient use of scarce disk resources? It has to be locally managed
tablespace.... with one critical proviso. You have to make intelligent use of them,
otherwise you end up chewing your way through far more disk space than you ever thought
possible! Consider a true case: application installs itself by creating something like 300
tables, each of a single extent, each sized to be around 48K big. Installed into dictionary
managed tablespace, that applicaiton uses around 14.5Mb of disk space. Installed by an
eager but inexperienced Junior DBA into locally managed tablespace, with a uniform size
of 1M, the install now takes 300Mb of disk space. That's because there are now 300 1Mb
extents all sitting their practically empty. Now when senior DBA saw that (no-one you
know!) and re-installed having created 16K, 64K and 128K tablespaces, the install came
back down to a far more reasonable 15.2Mb. Used carefully, they can be good for disk
space. Used unwisely, they'll be an utter disaster.




Copyright © Howard Rogers 2001            10/17/2001                                     Page 1 of 3
Locally Managed Tablespace                                                    Administration Tips


As for performance: there's no question: Locally Managed tablespaces every time.

The issue is one of dynamic extent allocation and de-allocation. When a table runs out of
space in Dictionary Managed tablespace, it has to consult and update the Data Dictionary
to record the acquisition of a new extent. That involves doing inserts on the UET$ table
(which records used extents) and deletes from the FET$ table (which records free extents)
-because an allocation of a new extent means you've gained some more used space, but
lost some old free space. Inserts and deletes are both expensive in the amount of redo
they generate -one half of the redo is always the entire row being inserted or deleted.
That's multi-byte-sized redo. The rollback for a delete is also the entire row. So the
updates to FET$ suffer the double-whammy of expensive redo AND rollback. That
translates into relatively slow extent allocation... and, of course, the same happens
whenever extents are de-allocated (by means of a truncate or drop command).

In Locally Managed tablespace, however, extent allocations are controlled by setting a bit
in a bitmap at the head of the tablespace. A bit of "1" indicates an extent is allocated,
and a bit of "0" means it's free. An extent allocation by a table now therefore consists of
updating a "0" to a "1".

That's a trivially small operation, the redo and rollback for which would be correspondingly
tiny (and hence quick to perform). Dynamic extent allocations and de-allocations are
therefore easy meat for Locally Managed tablespaces -and that translates into better
performance during normal working hours. (It's true that there are still some updates in
the data dictionary to record which table has acquired the extent, but you'd be doing
those anyway, whatever type of tablespace you have -they are therefore not a factor that
needs to be taken into account when deciding on the one type or the other).

In particular, where do dynamic extent allocations and de-allocations happen all the time?
In TEMP and ROLLBACk tablespace, that's where. So, even if you don't want to implement
Locally Managed tablespaces throughout your entire database, you really ought to make
those two specific tablespace types locally managed.

Which brings me to the one nasty with Locally Managed tablespace for rollback segments:it
is impossible to create your first rollback segment in a Locally Managed tablespace unless
there is already in existence a non-system rollback segment in Dictionary Managed
tablespace.

That's because creating the first segment requires updating the bitmap of the tablespace
to record the extent allocations. -and that's an update to a non-SYSTEM tablespace, which
are not permitted if the system rollback segment is the only one you've got. You therefore
have to create a rollback segment in some Dictionary Managed tablespace first -and that
tablespace can be the SYSTEM tablespace if you like (being created in the SYSTEM
tablespace doesn't make it a system rollback segment). Once that's been created and
brought online, you can create the real segment in Locally Managed tablespace without a
problem. And once that's been brought online, you don't need the Dictionary Managed one

Copyright © Howard Rogers 2001            10/17/2001                                   Page 2 of 3
Locally Managed Tablespace                                                    Administration Tips


at all any more, so you can simply offline it and then drop it. The creation of all other
rollback segments in Locally Managed tablespace is then handled perfectly well by the first
one you managed to create.

One final word: it is 100% utterly impossible to create the SYSTEM tablespace itself as
Locally Managed, despite the Oracle documentation itself telling you that it is possible.
The documentation is wrong. SYSTEM is Dictionary Managed, even in Oracle 9i, and there's
nothing you can do about it. Neither is there any need to want to do anything about it.
SYSTEM breaks most of the "good DBA" rules, including this one, and it is fine that it does
so. It knows what it is doing, and has been designed and tuned to do it that way. Don't try
and second-guess Oracle on this one!




Copyright © Howard Rogers 2001           10/17/2001                                    Page 3 of 3

More Related Content

PDF
Ppt professions
monballieu
 
PDF
Sql scripting sorcerypresentation
oracle documents
 
PDF
Rollback1555s
oracle documents
 
PDF
Beginbackup
oracle documents
 
PDF
Hjrbur
oracle documents
 
PDF
Userpasswrd
oracle documents
 
PDF
Database architectureby howard
oracle documents
 
PDF
Rollbackshrinks
oracle documents
 
Ppt professions
monballieu
 
Sql scripting sorcerypresentation
oracle documents
 
Rollback1555s
oracle documents
 
Beginbackup
oracle documents
 
Userpasswrd
oracle documents
 
Database architectureby howard
oracle documents
 
Rollbackshrinks
oracle documents
 

Similar to Tablespacelmt (20)

PDF
8 i locally_mgr_tbsp
Anil Pandey
 
PDF
Rollbacklmt
oracle documents
 
PPTX
tablespaces and datafiles in database administration
AsharJaved14
 
PPT
database-stucture-and-space-managment.ppt
Iftikhar70
 
PPT
database-stucture-and-space-managment.ppt
subbu998029
 
PDF
DB2 TABLESPACES
Rahul Anand
 
PPT
Less06 Storage
vivaankumar
 
PPT
Less05 storage
Imran Ali
 
PPT
Week 10-11 Managing Tablespaces and Data Files.ppt
IqraHanif27
 
PPT
Les 18 space
Femi Adeyemi
 
PPTX
Clase 11 manejo tablas modificada
Titiushko Jazz
 
PPTX
Clase 11 manejo tablas modificada
Titiushko Jazz
 
PPTX
Relational Database Management System
sweetysweety8
 
PPT
Oracle real application_cluster
Prabhat gangwar
 
PPT
Less07 storage
Amit Bhalla
 
PDF
Tablespaces
Vinay Thota
 
PDF
Extentnumbers
oracle documents
 
PDF
02-Oracle 19c-Storage-Management de Base de Datos
FreddyRonaldSandoval
 
ODP
Optimizing InnoDB bufferpool usage
Zarafa
 
PPTX
SQL Server 2014 Extreme Transaction Processing (Hekaton) - Basics
Tony Rogerson
 
8 i locally_mgr_tbsp
Anil Pandey
 
Rollbacklmt
oracle documents
 
tablespaces and datafiles in database administration
AsharJaved14
 
database-stucture-and-space-managment.ppt
Iftikhar70
 
database-stucture-and-space-managment.ppt
subbu998029
 
DB2 TABLESPACES
Rahul Anand
 
Less06 Storage
vivaankumar
 
Less05 storage
Imran Ali
 
Week 10-11 Managing Tablespaces and Data Files.ppt
IqraHanif27
 
Les 18 space
Femi Adeyemi
 
Clase 11 manejo tablas modificada
Titiushko Jazz
 
Clase 11 manejo tablas modificada
Titiushko Jazz
 
Relational Database Management System
sweetysweety8
 
Oracle real application_cluster
Prabhat gangwar
 
Less07 storage
Amit Bhalla
 
Tablespaces
Vinay Thota
 
Extentnumbers
oracle documents
 
02-Oracle 19c-Storage-Management de Base de Datos
FreddyRonaldSandoval
 
Optimizing InnoDB bufferpool usage
Zarafa
 
SQL Server 2014 Extreme Transaction Processing (Hekaton) - Basics
Tony Rogerson
 
Ad

More from oracle documents (20)

PPT
Applyinga blockcentricapproachtotuning
oracle documents
 
PDF
Windowsosauthent
oracle documents
 
PDF
Whatistnsnames
oracle documents
 
PDF
Whatisadatabaselink
oracle documents
 
PDF
Varraysandnestedtables
oracle documents
 
PDF
Usertracing
oracle documents
 
PDF
Userlimit
oracle documents
 
PDF
Undo internalspresentation
oracle documents
 
PDF
Undo internals paper
oracle documents
 
PDF
Tablerename
oracle documents
 
PDF
Sql scripting sorcerypaper
oracle documents
 
PDF
Sql for dbaspresentation
oracle documents
 
PDF
Sequencereset
oracle documents
 
PDF
Rollbacksizes
oracle documents
 
PDF
Rollbackblocking
oracle documents
 
PDF
Redosize
oracle documents
 
PDF
Real liferecoverypresentation
oracle documents
 
PDF
Real liferecoverypaper
oracle documents
 
PDF
Perfstats
oracle documents
 
PDF
Oracledates
oracle documents
 
Applyinga blockcentricapproachtotuning
oracle documents
 
Windowsosauthent
oracle documents
 
Whatistnsnames
oracle documents
 
Whatisadatabaselink
oracle documents
 
Varraysandnestedtables
oracle documents
 
Usertracing
oracle documents
 
Userlimit
oracle documents
 
Undo internalspresentation
oracle documents
 
Undo internals paper
oracle documents
 
Tablerename
oracle documents
 
Sql scripting sorcerypaper
oracle documents
 
Sql for dbaspresentation
oracle documents
 
Sequencereset
oracle documents
 
Rollbacksizes
oracle documents
 
Rollbackblocking
oracle documents
 
Real liferecoverypresentation
oracle documents
 
Real liferecoverypaper
oracle documents
 
Perfstats
oracle documents
 
Oracledates
oracle documents
 
Ad

Tablespacelmt

  • 1. Locally Managed Tablespace Administration Tips Locally Managed versus Dictionary Managed Tablespaces There's no real issue here at all. Locally Managed tablespaces knock the spots of their Dictionary Managed cousins, and I'd go so far as to suggest that every single tablespace you create should be locally managed. That's for two principle reasons, one a matter of efficient resources, the other for performance. Dictionary Managed tablespace can simply NOT be made to guarantee consistent extent sizes. It doesn't help that their default PCTINCREASE is 50%, thus absolutely guaranteeing odd-sized extents, and hence eventual fragmentation. But even when you remember when to set that to 0%, you are still going to get odd-sized extents. The tablespace DEFAULT STORAGE clause is just that -a default. Anyone who sticks in a real STORAGE clause when creating a table is going to over-ride whatever the default storage clause happens to allow for. And yes, there's a MINIMUM EXTENT clause in Oracle 8.0 and above which can try and alleviate that problem by guaranteeing that all extents must be a minimum size, or multiples thereof. But if I have a MINIMUM EXTENT of 500K, and request a new extent of 1232K, I'm going to get a 1500K extent -which is not consistent with all the other 500K extents I've already acquired. So the problem is still there. Locally Managed tablespace, created with the 'UNIFORM SIZE x' clause simply can NOT have odd-sized extents, ever. Ask for 1232K on a 500K locally managed uniform size tablespace, and you'll get 3 500K extents. You still get all the space you wanted, but always in consistent allocations. It is therefore absolutely impossible for a uniform size locally managed tablespace ever to experience fragmentation. So which is better for efficient use of scarce disk resources? It has to be locally managed tablespace.... with one critical proviso. You have to make intelligent use of them, otherwise you end up chewing your way through far more disk space than you ever thought possible! Consider a true case: application installs itself by creating something like 300 tables, each of a single extent, each sized to be around 48K big. Installed into dictionary managed tablespace, that applicaiton uses around 14.5Mb of disk space. Installed by an eager but inexperienced Junior DBA into locally managed tablespace, with a uniform size of 1M, the install now takes 300Mb of disk space. That's because there are now 300 1Mb extents all sitting their practically empty. Now when senior DBA saw that (no-one you know!) and re-installed having created 16K, 64K and 128K tablespaces, the install came back down to a far more reasonable 15.2Mb. Used carefully, they can be good for disk space. Used unwisely, they'll be an utter disaster. Copyright © Howard Rogers 2001 10/17/2001 Page 1 of 3
  • 2. Locally Managed Tablespace Administration Tips As for performance: there's no question: Locally Managed tablespaces every time. The issue is one of dynamic extent allocation and de-allocation. When a table runs out of space in Dictionary Managed tablespace, it has to consult and update the Data Dictionary to record the acquisition of a new extent. That involves doing inserts on the UET$ table (which records used extents) and deletes from the FET$ table (which records free extents) -because an allocation of a new extent means you've gained some more used space, but lost some old free space. Inserts and deletes are both expensive in the amount of redo they generate -one half of the redo is always the entire row being inserted or deleted. That's multi-byte-sized redo. The rollback for a delete is also the entire row. So the updates to FET$ suffer the double-whammy of expensive redo AND rollback. That translates into relatively slow extent allocation... and, of course, the same happens whenever extents are de-allocated (by means of a truncate or drop command). In Locally Managed tablespace, however, extent allocations are controlled by setting a bit in a bitmap at the head of the tablespace. A bit of "1" indicates an extent is allocated, and a bit of "0" means it's free. An extent allocation by a table now therefore consists of updating a "0" to a "1". That's a trivially small operation, the redo and rollback for which would be correspondingly tiny (and hence quick to perform). Dynamic extent allocations and de-allocations are therefore easy meat for Locally Managed tablespaces -and that translates into better performance during normal working hours. (It's true that there are still some updates in the data dictionary to record which table has acquired the extent, but you'd be doing those anyway, whatever type of tablespace you have -they are therefore not a factor that needs to be taken into account when deciding on the one type or the other). In particular, where do dynamic extent allocations and de-allocations happen all the time? In TEMP and ROLLBACk tablespace, that's where. So, even if you don't want to implement Locally Managed tablespaces throughout your entire database, you really ought to make those two specific tablespace types locally managed. Which brings me to the one nasty with Locally Managed tablespace for rollback segments:it is impossible to create your first rollback segment in a Locally Managed tablespace unless there is already in existence a non-system rollback segment in Dictionary Managed tablespace. That's because creating the first segment requires updating the bitmap of the tablespace to record the extent allocations. -and that's an update to a non-SYSTEM tablespace, which are not permitted if the system rollback segment is the only one you've got. You therefore have to create a rollback segment in some Dictionary Managed tablespace first -and that tablespace can be the SYSTEM tablespace if you like (being created in the SYSTEM tablespace doesn't make it a system rollback segment). Once that's been created and brought online, you can create the real segment in Locally Managed tablespace without a problem. And once that's been brought online, you don't need the Dictionary Managed one Copyright © Howard Rogers 2001 10/17/2001 Page 2 of 3
  • 3. Locally Managed Tablespace Administration Tips at all any more, so you can simply offline it and then drop it. The creation of all other rollback segments in Locally Managed tablespace is then handled perfectly well by the first one you managed to create. One final word: it is 100% utterly impossible to create the SYSTEM tablespace itself as Locally Managed, despite the Oracle documentation itself telling you that it is possible. The documentation is wrong. SYSTEM is Dictionary Managed, even in Oracle 9i, and there's nothing you can do about it. Neither is there any need to want to do anything about it. SYSTEM breaks most of the "good DBA" rules, including this one, and it is fine that it does so. It knows what it is doing, and has been designed and tuned to do it that way. Don't try and second-guess Oracle on this one! Copyright © Howard Rogers 2001 10/17/2001 Page 3 of 3