【TABLE】oracle表線上重定義注意事項
點選(此處)摺疊或開啟
-
DBMS_REDEFINITION
-
==================
-
-
With DBMS_REDEFINITION, you can perform an online reorganization of tables. To
-
achieve this online reorganization, incrementally maintainable local
-
materialized views are used. Snapshot logs need to be defined on the master
-
tables to support incrementally maintainable materialized views. These logs
-
keep track of the changes to the master tables and are used by the materialized
-
views during refresh synchronization. To keep table indexes and privileges you must use the
- copy_table_dependents procedure.
此處需要注意,如果想改變表的索引、許可權,必須執行過程DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS
下面是無法使用線上重定義的一些情況:
點選(此處)摺疊或開啟
-
Tables with the following characteristics cannot be redefined online:
-
- [9.0.1]Tables with no primary keys
-
- Tables that have materialized view logs defined on them
-
- [9i] Tables that are materialized view container tables and AQ tables
-
- [10g] Tables that are replicated in an n-way master configuration can
-
be redefined, but horizontal subsetting (subset of rows in the table),
-
vertical subsetting (subset of columns in the table), and column
-
transformations are not allowed.
-
- The overflow table of an IOT table
-
- Tables with fine-grained access control (row-level security)
-
- Tables with BFILE columns
-
- Tables with LONG columns can be redefined online, but those columns must be --注意LOB相關表,LONG型別必須轉換為CLOBS. LONG RAW=>BLOBS
-
converted to CLOBS. Also, LONG RAW columns must be converted to BLOBS.
-
Tables with LOB columns are acceptable.
-
- Tables in the SYS and SYSTEM schema
- - Temporary tables
其他的一些約束:
點選(此處)摺疊或開啟
-
Other restrictions:
-
- A subset of rows in the table
-
- Only simple deterministic expressions, sequences, and SYSDATE can be used
-
when mapping the columns in the interim table to those of the original table.
-
For example, subqueries are not allowed.
-
- If new columns are being added with no column mappings, then they must not
-
be declared NOT NULL until the redefinition is complete.
-
- There cannot be any referential constraints between the table being redefined
-
and the interim table.
-
- Table redefinition cannot be done NOLOGGING.
-
- [10g] For materialized view logs and queue tables, online redefinition is
-
restricted to changes in physical properties.
- - You cannot convert a nested table to a VARRAY.
使用者所需許可權
點選(此處)摺疊或開啟
-
Privileges Required
-
====================
-
Following privileges are needed to run this package:
-
- Execute privilege to DBMS_REDEFINITION
-
- Create any table
-
- Alter any table
-
- Drop any table
-
- Lock any table
-
- Select any table
-
- Create any index
- - Create any trigger
下面是相關包的說明
點選(此處)摺疊或開啟
-
Summary of DBMS_REDEFINITION Subprograms:
-
=========================================
-
-
CAN_REDEF_TABLE Procedure:
-
--------------------------
-
This procedure determines if a given table can be reorganized online. This is
-
the first step of the online reorganization process. If the table is not a
-
candidate for online redefinition, an error message is raised.
-
-
SYNTAX
-
-
DBMS_REDEFINITION.can_redef_table (
-
uname IN VARCHAR2,
-
tname IN VARCHAR2);
-
-
CAN_REDEF_TABLE Procedure Parameters:
-
-
Parameter Description
-
--------- ------------
-
uname The schema name of the table.
-
tname The name of the table to be reorganized.
-
-
-
-
START_REDEF_TABLE Procedure:
-
----------------------------
-
This procedure initiates the reorganization process. After verifying that the
-
table can be reorganized online, you create an empty interim table (in the same
-
schema as the table to be reorganized) with the desired attributes of the
-
post-reorganization table.
-
-
SYNTAX
-
-
DBMS_REDEFINITION.start_redef_table (
-
uname IN VARCHAR2,
-
orig_table IN VARCHAR2,
-
int_table IN VARCHAR2,
-
col_mapping IN VARCHAR2 := NULL);
-
-
START_REDEF_TABLE Procedure Parameters:
-
-
Parameter Description
-
---------- ------------
-
uname The schema name of the tables.
-
orig_table The name of the table to be reorganized.
-
int_table The name of the interim table.
-
col_mapping The mapping information from the columns in the interim
-
table to the columns in the original table. (This is similar
-
to the column list on the SELECT clause of a query.) If NULL,
-
all the columns in the original table are selected and have
-
the same name after reorganization.
-
-
FINISH_REDEF_TABLE Procedure:
-
----------------------------
-
This procedure completes the reorganization process. Before this step you can
-
create new indexes, triggers, grants, and constraints on the interim table. The
-
referential constraints involving the interim table must be disabled. After
-
completing this step, the original table is locked briefly during this
-
procedure.
-
-
-
SYNTAX
-
-
DBMS_REDEFINITION.finish_redef_table (
-
uname IN VARCHAR2,
-
orig_table IN VARCHAR2,
-
int_table IN VARCHAR2);
-
-
FINISH_REDEF_TABLE Procedure Parameters:
-
-
Parameter Description
-
--------- ------------
-
uname The schema name of the tables.
-
orig_table The name of the table to be reorganized.
-
int_table The name of the interim table.
-
-
-
-
SYNC_INTERIM_TABLE Procedure:
-
----------------------------
-
This procedure keeps the interim table synchronized with the original table.
-
This step is useful in minimizing the amount of synchronization needed to be
-
done by finish_reorg_table before completing the online reorganization. This
-
procedure can be called between long running operations (such as create index)
-
on the interim table to sync it up with the data in the original table and
-
speed up subsequent operations.
-
-
SYNTAX
-
-
DBMS_REDEFINITION.sync_interim_table (
-
uname IN VARCHAR2,
-
orig_table IN VARCHAR2,
-
int_table IN VARCHAR2);
-
-
SYNC_INTERIM_TABLE Procedure Parameters:
-
-
Parameters Description
-
---------- ------------
-
uname The schema name of the tables.
-
orig_table The name of the table to be reorganized.
-
int_table The name of the interim table.
-
-
-
ABORT_REDEF_TABLE Procedure:
-
----------------------------
-
This procedure cleans up errors that occur during the reorganization process.
-
This procedure can also be used to abort the reorganization process any time
-
after start_reorg_table has been called and before finish_reorg_table is called.
-
-
SYNTAX
-
-
DBMS_REDEFINITION.abort_redef_table (
-
uname IN VARCHAR2,
-
orig_table IN VARCHAR2,
-
int_table IN VARCHAR2);
-
-
ABORT_REDEF_TABLE Procedure Parameters:
-
-
Parameters Description
-
---------- ------------
-
uname The schema name of the table.
-
orig_table The name of the table to be reorganized.
-
int_table The name of the interim table.
-
-
-
If we have an encrypted column which is part of primary key then
-
follow the steps mentioned in the bug below.
-
-
Reference: Bug 6034260 DBMS_REDEFINITION.START_REDEF_TABLE FAILS ORA-32412 BECAUSE
-
OF ENCRYPTED COLUMN
-
-
COPY_TABLE_DEPENDENTS (Procedure)
-
Copies the dependent objects of the original table to the interim table
-
-
-
COPY_TABLE_DEPENDENTS.dbms_redefinition.copy_table_dependents(
-
uname IN VARCHAR2,
-
orig_table IN VARCHAR2,
-
int_table IN VARCHAR2,
-
copy_indexes IN PLS_INTEGER := 1,
-
copy_triggers IN BOOLEAN := TRUE,
-
copy_constraints IN BOOLEAN := TRUE,
-
copy_privileges IN BOOLEAN := TRUE,
-
ignore_errors IN BOOLEAN := FALSE,
-
num_errors OUT PLS_INTEGER,
-
copy_statistics IN BOOLEAN := FALSE
-
copy_mvlog IN BOOLEAN := FALSE);
-
-
RELATED DOCUMENTS
-
-----------------
-
- Oracle9i Database Administrator
可以參考相關文章:
NOTE:1089860.1 - Why are Not Null Constraints not Copied by Dbms_redefinition.copy_table_dependents?
NOTE:807004.1 - How to Disassemble (Uncluster / Decluster) Clustered Tables Online
NOTE:1116785.1 - ORA-1442 Error During Online Redefinition - DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS
NOTE:1170351.1 - Secure file Migration and Accessing securefile metadata information [Video]
NOTE:1233204.1 - Cannot Drop Unused Columns Using dbms_redefinition Without PK And Compressed Table
NOTE:251417.1 - How to Convert LONG Column to CLOB Using DBMS_REDEFINITION Package
NOTE:837751.1 - ORA-904 Error During Online Redefinition - DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS
NOTE:848298.1 - How To Encrypt/Rekey a Table for TDE and Avoid the Associated Performance Problems and Locks?
NOTE:556283.1 - How to Convert Date Column to Timestamp Using DBMS_REDEFINITION Package?
分割槽表參考
How To Partition Existing Table Using DBMS_REDEFINITION (Doc ID 472449.1)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29487349/viewspace-2140567/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 表線上重定義Oracle
- oracle表線上重定義Oracle
- 【Oracle】線上重定義表Oracle
- 【TEMPORARY TABLE】Oracle臨時表使用注意事項Oracle
- Oracle表的線上重定義(一)Oracle
- oracle線上重定義表步驟Oracle
- Oracle中重建表的線上重定義Oracle
- 線上重定義表ORACLE 11GOracle
- ogg環境線上重定義普通表到分割槽表實戰及生產操作注意事項-orastarAST
- oracle 線上重定義Oracle
- Oracle線上重定義Oracle
- oracle實驗記錄 (線上重定義表)Oracle
- ORACLE 線上重新定義表分割槽表重定義為普通表。Oracle
- 在oracle 9i下線上重定義表Oracle
- 指令碼:線上重定義,從普通表到分割槽表,redefinition_table.sh指令碼
- Oracle的線上重定義(轉)Oracle
- dbms_redefinition線上重定義表
- 使用ORACLE線上重定義將普通表改為分割槽表Oracle
- Oracle臨時表使用注意事項Oracle
- oracle分割槽表線上重定義欄位not null問題OracleNull
- ORACLE 普通錶轉換成分割槽表(線上重定義)Oracle
- 資料庫表的線上重定義資料庫
- 利用DBMS_REDEFINITION線上重定義表
- 使用DBMS_REDEFINITION包執行線上重定義表(ONLINE TABLE REDEFINITION)
- Oracle:記憶體設定注意事項Oracle記憶體
- 【徵文】應用oracle flashback(2.3)--Flashback Table之注意事項Oracle
- Oracle 重建表(rename)注意事項總結Oracle
- Oracle 重建表(rename)注意事項小結Oracle
- 【Oracle】利用線上重定義的方式改變普通表為分割槽表Oracle
- ORACLE 普通錶轉換成分割槽表(線上重定義)(zt)Oracle
- Oracle線上重定義之DBMS_REDEFINITIONOracle
- 全面學習oracle flashback特性(2.3)--Flashback Table之注意事項Oracle
- Python命令列引數定義及注意事項Python命令列
- 【C++注意事項】2 變數宣告和定義C++變數
- Oracle Online Redefinition線上重定義(上)Oracle
- Oracle Online Redefinition線上重定義(中)Oracle
- Oracle Online Redefinition線上重定義(下)Oracle
- 普通錶轉換分割槽表-線上重定義