Beruflich Dokumente
Kultur Dokumente
If you have space issues on a tablespace you can shrink tables and move indexes while online. MMON will
send the alert for any tablespace if thresholds have been exceeded. To shrink table segments you can use the
below commands, cascade will shrink both table and indexes(only these objects are affected), compact will stop
before moving the high water mark (hwm) thus not reclaiming space back. , this may be useful as moving the
hwm locks the table thus this may impact users.
• Full table scans will take less time (a table scan will always scan upto the hwm even if space is not used)
• Better index access takes place because of a smaller b-tree
• Space is freed up for other database objects
• Space below the HWM is released and the HWM is moved down
Note: it is not guaranteed that all chained rows will be fixed because not all blocks may be read in a segment
shrink operation.
During compaction the rows are compacted and moved towards the left side of the segment, the
Compaction
HWM remains the same so the free space is still not available. DML is still available while the
phase
object is being compacted
Adjustment of
This hase is very short, oracle lowers the HWM and releases the free space. Oracle locks the object
HWM
in an exclusive mode while the HMW is being lowered, meaning that no DML operations can take
(release free
place.
space)
A shrink could fail because the tablespace is not locally managed or do not have ASSM (automatic segment
managed) enabled, the table has a column of long, row movement has not been enabled or it is a clustered table.
There is no tool to display how often a segment is used but using the segment advisor in the OEM you can
perform any of the below commands
dbms_advisor
You can setup your own PL/SQL program to advise on tables, etc and to implement the recommendations. This
can also be done under the EM console.
The standard table type is a heap table, a heap consists of variable-length rows in random order, there is no
structure to the physical storage. There are more advanced tables which can offer many benefits over the
standard heap table.
IOT Index organised table (IOT) is a B-Tree index but the leaf blocks contain key values followed by the
(index rest of the row, the saving is that only one segment is needed not two like a heap table and a index.
organized
table) For further details on creating, removing, etc see Oracle tables.doc
An index cluster is a group of tables stored in one physical segment. All tables must be linked via a
common key, it can be used to de-normalise tables in a foreign key relationship.
Index clusters
For further details on creating, removing, etc see Oracle tables.doc
A hash cluster is created with a cluster key, as is a index cluster but rather than creating a index on this
key oracle will use it to construct a hashing algorithm, oracle can calculate a rows location via this
key. It is only useful if you search using the equality predicate on the key. Range search or get-next-
record operations will almost certainly result in a full cluster scan. Don’t use hash clusters if you do
Hash clusters
not know how many rows will be returned. The new access path in a sorted hash cluster is used only if
an equality predicate is used.