User Tools

Site Tools


updating_existing_objects_on_import

Updating Existing Objects on Import

On Import, when the DDL for an existing object differs from the statement as it appears in the file, then Lure needs to update the object in the database.

The strategy that Lure follows to achieve this depends on the type of the object. The main strategies are:

  1. Some objects can be updated by using the CREATE OR REPLACE mechanism of Oracle.
  2. Lure updates some objects by dropping and re-creating them again.
  3. Users can override the default updating mechanism for some objects by providing a patch file.
  4. For tables the only way to achieve an update or drop is with a patch file.
  5. Refresh Groups are updated using the DBMS_REFRESH package API.
Type CREATE OR REPLACE Update DROP and RE-CREATE Patch
Package/Package Body x
Procedure x
Function x
Trigger x
Java Source x
Type x x
Type Body x
View x
Table x
Global Temporary Table x x
Materialized View x
Materialized View Log x
Index x x
Constraint x x
Sequence x
Synonym x
Database Link x x
Object Privilege x
Refresh Group x
Cluster x x
Operator x x
Indextype x x
Library x
Dimension x

Special cases

If an operator has any dependent indextypes or functions then it cannot be updated using CREATE OR REPLACE. In that case the operator is first dropped and then re-created.

If an indextype has any dependent domain indexes then it cannot be updated using CREATE OR REPLACE. In that case the indextype is first dropped and then re-created.

If a type has any dependent types, indextypes or tables then the type cannot be updated using the CREATE OR REPLACE option. In that case you have to use the ALTER statement to update the type. Do however note the unique way in which any subsequent ALTER statements affect the source code of a type.

For example, given the following type:

CREATE TYPE MY_TYPE AS OBJECT ( id NUMBER, name VARCHAR2(30));
/

and then

ALTER TYPE MY_TYPE ADD ATTRIBUTE (length NUMBER);

The resulting source for this type is now:

TYPE MY_TYPE AS OBJECT ( id NUMBER, name VARCHAR2(30))
ALTER TYPE MY_TYPE ADD ATTRIBUTE (length NUMBER)

The ALTER statement has become part of the source code definition of the type as it is defined in the database.

Lure will export the entire source code for a type, including any additional ALTER statements. During import/deployment Lure will compare the source code for the type in the file with the source code of the type in the database. Lure will then install any ALTER statements that have not yet been installed.

updating_existing_objects_on_import.txt · Last modified: 2013/07/25 21:00 (external edit)

Page Tools