Online Data Reorganization & Redefinition
As business become more web and e-commerce enabled, high availability computing
solutions are becoming increasingly important because of the extremely high cost
of application downtime. According to a recent Gartner Group study, the cost of outage for
corporations involved in e-commerce can easily reach millions of dollars per
hour. Therefore, database availability and manageability have become increasingly
important in many of today's mission-critical environments. One
way to enhance availability and manageability is to allow users
full access to the database during a data reorganization operation.
The Online Reorganization & Redefinition feature in Oracle Database 11g,
offers administrators unprecedented flexibility to modify
table physical attributes and transform both data and table structure
while allowing users full access to the database. This capability
improves data availability, query performance, response time and
disk space utilization, all of which are important in a mission-critical
environment and it can make the application upgrade process easier, safer and
faster.
When a table is redefined
online, it is accessible by all read and write operations during the
redefinition process.
During an application upgrade, administrators can start the redefinition
process, then periodically synchronize the interim table so that the interim
table includes the latest changes to the original table.
This reduces the amount of time to complete the final redefinition step.
Administrators can also validate and use the data in the interim table
before completing the redefinition process.
This is a very useful feature for administrators, who must ensure that
the upgrade process goes smoothly.Administrators
then have control over when to switch from the original to the newly redefined
table. The switch process is very
brief and is independent of the size of the table or the complexity of the
redefinition. The redefinition
process effectively creates a new table and improves
its data block layout efficiency.
When tables and indexes are partitioned, this allows administrators
to perform maintenance on these objects - one partition at a time
- while the other partitions remain online.
Oracle online data reorganization can be accomplished using either Oracle Enterprise
Manager (OEM) or SQL*Plus command line interface. Depending on the type of online reorganization that is required,
it can be performed using either the DBMS_REDEFINITION package
or using the SQL CREATE/ALTER TABLE and INDEX commands as shown
in the table below.
What's New in Oracle Database 11g
Fast 'add column' for default values
Instead of the default value being written to existing records, thereby accessing each row in the table, they are simply maintained in the data dictionary. This enables 'add column' to complete in sub-seconds, independent of the existing data volume, and consumes virtually no space.
Invisible Indexes
An invisible index is an alternative to making an index unusable or even to drop it. An invisible index is maintained for any DML operation but is not used by the optimizer unless you explicitly specify the index with a hint.
Invisible indexes can speed up application migration and testing. Applications often have to be modified without bringing the complete application offline. Invisible indexes enable you to leverage temporary index structures for certain operations or modules of an application without affecting the overall application. Furthermore, invisible indexes can be used to test the removal of an index without dropping it right away, thus enabling a grace period for testing in production environments.
DDL Enhancements
DDL operations can wait for a user configurable time period (DDL_LOCK_TIMEOUT), if underlying resource is busy, and is supported at system and session levels. This allows DDL to retry within the specified timeout period versus failing if a lock is not immediately obtained.
More DDL operations (add/modify constraint, add column, index create/rebuild) only require shared lock versus DML locks. This allows more DDL to complete successfully, regardless of DML workload.
DBMS_REDEFINITION Enhancements
- Additional supported table types: Tables with materialized view logs and materialized views can be redefined.
- Faster access to tables, post-redefinition: No recompilation of dependent objects (e.g. PL/SQL) is needed when redefinition does not logically affect the objects
Data Reorganization Feature Comparison
Action
|
Oracle 9i
|
Oracle Database 10g
Release 1
|
Oracle Database 10g Release 2
|
Oracle Database 11g
|
| Online Reorganization using the package DBMS_REDEFINITION |
- modify table storage parameters
- move table to a different tablespace
- add support for parallel queries
- add or drop partitioning support
- recreate table to avoid fragmentation
- change from table to IOT or vice-versa
- add or drop a column
- transform a column using a function
|
- clones grants, constraints and triggers
- convert a LONG to a LOB
- reorganize using a unique key
- specify columns to order table by
|
- reorganize a single partition
- advanced queue and clustered tables
- table containing an ADT
- retain & clone statistics
- clone check and not null constraints
- copies dependent objects for nested tables
|
- table with materialized view logs or materialized views
- no recompilation of dependent objects when redefinition does not logically affect objects
|
| Reclaiming Unused Space |
|
Use SHRINK SPACE clause on following statements:
- ALTER TABLE
- ALTER INDEX
- ALTER MATERIALIZED VIEW
- ALTER MATERIALIZED VIEW LOG
|
|
|
| Index Create Online |
CREATE INDEX emp.ename.idx ON emp(ename) ONLINE;
- Parallel operations supported
- Partitions supported
- All index types except cluster
|
|
|
- DML lock-free online index creation, allowing transparent creation with no dependency on workload.
|
| Index Rebuild Online |
ALTER INDEX emp.ename_idx REBUILD ONLINE;
- Parallel operations supported
- Partitions supported,
- All index types except cluster
|
|
|
- DML lock-free online index rebuild, allowing transparent rebuild with no dependency on workload.
|
| Index Coalesce Online |
ALTER INDEX emp.ename_idx COALESCE;
- Parallel operations supported
- Partitions supported
- All index types
|
|
|
|
| Index-Organized Table Move Online |
ALTER TABLE emp MOVE ONLINE;
- Parallel operations not supported
- Partitions supported
- IOT only
|
|
|
|
For More Information
White Papers
Articles