Databases Reference
In-Depth Information
the interim table with the original table by a column mapping specified as a SQL
query. The DBA can periodically synchronize data between the two tables according
to the query before finally finishing the redefinition. At the end of the redefinition
process, the interim table takes the place of the original table. Only the final step
requires the table to go offline.
Finally, Oracle supports a feature called editions ( Oracle Edition-Based Redefi-
nition 2009 ). An edition is a logical grouping of database objects such as views and
triggers that are provided to applications for accessing a database. Using editions,
database objects are partitioned into two sets - those that can be editioned and those
that cannot. Any object that has a persistent extent, in particular tables and indexes,
cannot be editioned. So, an edition is a collection of primarily views and triggers
that provide an encapsulated version of the database.
To illustrate the use of editions, consider a simple scenario of a database that
handles data about people (Fig. 6.2 ). In version 1, the database has a table TPerson
with a single column Name. Edition 1 also provides applications with an editioned
view 1 over TPerson that includes the name column. Schema evolution is triggered
by the need to break apart Name into FirstName and LastName. So, version 2 of
the database adds two new columns - FirstName and LastName - to TPerson, but
leaves column Name present. Edition 2 of the database includes a new view 2 that
leaves out Name but includes FirstName and LastName. A background task, run
concurrently with the creation of the edition, copies existing data in Name into the
new columns but leaves existing data intact. Furthermore, Edition 2 includes two
triggers written by the developer to resolve the differences between the two versions.
The forward trigger applies to edition 2 and all future editions and takes the data
from FirstName and LastName on inserts and updates and applies the data to Name.
The reverse trigger applies to all strictly older editions and translates Name data into
FirstName and LastName on insert and update. Note that view 1 is still supported
on the changed schema so that its applications continue to work.
The resulting database presents two different external faces to different appli-
cation versions. Version 1 sees edition 1 with a Name column; and version 2 (and
beyond) sees edition 2 with FirstName and LastName columns. Both versions can
View 1
View 2
View 1
TPerson
Table
Edition 1, with a view, above
the table TPerson
Editions 1 and 2 of the view, with changes to
the table and triggers translating between old
and new columns TPerson
Fig. 6.2
Editions in Oracle
Search WWH ::




Custom Search