Before Oracle9i appeared, you can only re-define the table by moving or exporting and importing the table. Therefore, the table redefinition process may be quite long or offline.
Before Oracle9i appeared, you can only re-define the table by moving or exporting and importing the table. Therefore, the table redefinition process may be quite long or offline.
Before Oracle9i appeared, you can only re-define the table by moving or exporting and importing the table. Therefore, the table redefinition process may be quite long or offline, during this period, the application will fail to operate on the table. Besides this, if exp is used, we cannot guarantee that the data in the table is not changed (unless it is a single user) during exp, and imp is a long process. To solve this problem, Oracle9i introduced the online redefinition function in its DBMS_REDEFINITION software package. This feature is very important for 24*7 database systems. Using this technology, DBA can modify the structure while keeping the table allow DML statements, for example, you can add columns, move tables to other tablespaces, and Process Table fragments. Of course, you can use the shrink operation to Process Table fragments after 10 Gb, we will not discuss shrink here.
Online redefinition has the following features:
(1) Modify Table Storage parameters;
(2) tables can be transferred to other tablespaces;
(3) add, modify, or delete one or more columns in the table;
(4) added the parallel query option;
(5) add partition support;
(6) modify the partition structure;
(7) recreate the table to reduce fragments;
(8) change the heap table to an index organization table or the opposite operation;
Online redefinition Method
1. Based on the primary key
2. Based on ROWID. The ROWID method cannot be used to index the Organizational table, and the hidden column M_ROW $ will exist after being redefined.
The primary key is used by default.
Restrictions on online redefinition
1. The original and intermediate tables must be in the same solution;
2. Two or more times the tablespace space is required;
3. If the primary key is redefined, the original table must have a primary key;
Here, we will not describe the steps for online redefinition. We will use an experiment to demonstrate how to convert a common table into a partitioned table online redefinition.
1. create user tj and grant permissions and roles that can be redefined online.
SQL> create user tj identified by tj
2 default tablespace users
3 temporary tablespace temp
4 quota unlimited on users;
User created.
SQL> GRANT CREATE SESSION, CREATE ANY TABLE, ALTER ANY TABLE,
2 drop any table, lock any table, select any table,
3 create any index, CREATE ANY TRIGGER
4 to tj;
Grant succeeded.
SQL> GRANT EXECUTE_CATALOG_ROLE TO TJ;
Grant succeeded.