1 PACKAGE dbms_redefinition AUTHID CURRENT_USER IS
2 ------------
3 -- OVERVIEW
4 --
5 -- This package provides the API to perform an online, out-of-place
6 -- redefinition of a table
7
8 --- =========
9 --- CONSTANTS
10 --- =========
11 -- Constants for the options_flag parameter of start_redef_table
12 cons_use_pk CONSTANT PLS_INTEGER := 1;
13 cons_use_rowid CONSTANT PLS_INTEGER := 2;
14
15 -- Constants for the copy_vpd_opt parameter of start_redef_table
16 cons_vpd_none CONSTANT PLS_INTEGER := 1;
17 cons_vpd_auto CONSTANT PLS_INTEGER := 2;
18 cons_vpd_manual CONSTANT PLS_INTEGER := 4;
19
20 -- Constants used for the object types in the register_dependent_object
21 cons_index CONSTANT PLS_INTEGER := 2;
22 cons_constraint CONSTANT PLS_INTEGER := 3;
23 cons_trigger CONSTANT PLS_INTEGER := 4;
24 cons_mvlog CONSTANT PLS_INTEGER := 10;
25
26 -- constants used to specify the method of copying indexes
27 cons_orig_params CONSTANT PLS_INTEGER := 1;
28
29 PRAGMA SUPPLEMENTAL_LOG_DATA(default, AUTO_WITH_COMMIT);
30
31 -- NAME: can_redef_table - check if given table can be re-defined
32 -- INPUTS: uname - table owner name
33 -- tname - table name
34 -- options_flag - flag indicating user options to use
35 -- part_name - partition name
36 PROCEDURE can_redef_table(uname IN VARCHAR2,
37 tname IN VARCHAR2,
38 options_flag IN PLS_INTEGER := 1,
39 part_name IN VARCHAR2 := NULL);
40 PRAGMA SUPPLEMENTAL_LOG_DATA(can_redef_table, NONE);
41
42 PROCEDURE redef_table(uname IN VARCHAR2,
43 tname IN VARCHAR2,
44 table_compression_type IN VARCHAR2 := NULL,
45 table_part_tablespace IN VARCHAR2 := NULL,
46 index_key_compression_type IN VARCHAR2 := NULL,
47 index_tablespace IN VARCHAR2 := NULL,
48 lob_compression_type IN VARCHAR2 := NULL,
49 lob_tablespace IN VARCHAR2 := NULL,
50 lob_store_as IN VARCHAR2 := NULL);
51 PRAGMA SUPPLEMENTAL_LOG_DATA(redef_table, NONE);
52
53 -- NAME: start_redef_table - start the online re-organization
54 -- INPUTS: uname - schema name
55 -- orig_table - name of table to be re-organized
56 -- int_table - name of interim table
57 -- col_mapping - select list col mapping
58 -- options_flag - flag indicating user options to use
59 -- orderby_cols - comma separated list of order by columns
60 -- followed by the optional ascending/descending
61 -- keyword
62 -- part_name - name of the partition to be redefined
63 -- continue_after_errors - Continue redefining after errors?
64 PROCEDURE start_redef_table(uname IN VARCHAR2,
65 orig_table IN VARCHAR2,
66 int_table IN VARCHAR2,
67 col_mapping IN VARCHAR2 := NULL,
68 options_flag IN BINARY_INTEGER := 1,
69 orderby_cols IN VARCHAR2 := NULL,
70 part_name IN VARCHAR2 := NULL,
71 copy_vpd_opt IN BINARY_INTEGER := 1,
72 continue_after_errors IN BOOLEAN := FALSE);
73
74 -- NAME: finish_redef_table - complete the online re-organization
75 -- INPUTS: uname - schema name
76 -- orig_table - name of table to be re-organized
77 -- int_table - name of interim table
78 -- part_name - name of the partition being redefined
79 -- dml_lock_timeout - max # of seconds waiting for dml lock
80 -- continue_after_errors - Continue redefining after errors?
81 PROCEDURE finish_redef_table(uname IN VARCHAR2,
82 orig_table IN VARCHAR2,
83 int_table IN VARCHAR2,
84 part_name IN VARCHAR2 := NULL,
85 dml_lock_timeout IN PLS_INTEGER := NULL,
86 continue_after_errors IN BOOLEAN := FALSE);
87
88 -- NAME: abort_redef_table - clean up after errors or abort the
89 -- online re-organization
90 -- INPUTS: uname - schema name
91 -- orig_table - name of table to be re-organized
92 -- int_table - name of interim table
93 -- part_name - name of the partition being redefined
94 PROCEDURE abort_redef_table(uname IN VARCHAR2,
95 orig_table IN VARCHAR2,
96 int_table IN VARCHAR2,
97 part_name IN VARCHAR2 := NULL);
98
99 -- NAME: sync_interim_table - synchronize interim table with the original
100 -- table
101 -- INPUTS: uname - schema name
102 -- orig_table - name of table to be re-organized
103 -- int_table - name of interim table
104 -- part_name - name of the partition being redefined
105 -- continue_after_errors - Continue redefining after errors?
106 PROCEDURE sync_interim_table(uname IN VARCHAR2,
107 orig_table IN VARCHAR2,
108 int_table IN VARCHAR2,
109 part_name IN VARCHAR2 := NULL,
110 continue_after_errors IN BOOLEAN := FALSE);
111
112 -- NAME: register_dependent_object - register dependent object
113 --
114 -- INPUTS: uname - schema name
115 -- orig_table - name of table to be re-organized
116 -- int_table - name of interim table
117 -- dep_type - type of the dependent object
118 -- dep_owner - name of the dependent object owner
119 -- dep_orig_name- name of the dependent object defined on table
120 -- being re-organized
121 -- dep_int_name - name of the corressponding dependent object on
122 -- the interim table
123 PROCEDURE register_dependent_object(uname IN VARCHAR2,
124 orig_table IN VARCHAR2,
125 int_table IN VARCHAR2,
126 dep_type IN PLS_INTEGER,
127 dep_owner IN VARCHAR2,
128 dep_orig_name IN VARCHAR2,
129 dep_int_name IN VARCHAR2);
130
131 -- NAME: unregister_dependent_object - unregister dependent object
132 --
133 -- INPUTS: uname - schema name
134 -- orig_table - name of table to be re-organized
135 -- int_table - name of interim table
136 -- dep_type - type of the dependent object
137 -- dep_owner - name of the dependent object owner
138 -- dep_orig_name- name of the dependent object defined on table
139 -- being re-organized
140 -- dep_int_name - name of the corressponding dependent object on
141 -- the interim table
142 PROCEDURE unregister_dependent_object(uname IN VARCHAR2,
143 orig_table IN VARCHAR2,
144 int_table IN VARCHAR2,
145 dep_type IN PLS_INTEGER,
146 dep_owner IN VARCHAR2,
147 dep_orig_name IN VARCHAR2,
148 dep_int_name IN VARCHAR2);
149
150 -- NAME: copy_table_dependents
151 --
152 -- INPUTS: uname - schema name
153 -- orig_table - name of table to be re-organized
154 -- int_table - name of interim table
155 -- copy_indexes - integer value indicating whether to
156 -- copy indexes
157 -- 0 - don't copy
158 -- 1 - copy using storage params/tablespace
159 -- of original index
160 -- copy_triggers - TRUE implies copy triggers, FALSE otherwise
161 -- copy_constraints - TRUE implies copy constraints, FALSE
162 -- otherwise
163 -- copy_privileges - TRUE implies copy privileges, FALSE
164 -- otherwise
165 -- ignore errors - TRUE implies continue after errors, FALSE
166 -- otherwise
167 -- num_errors - number of errors that occurred while
168 -- cloning ddl
169 -- copy_statistics - TRUE implies copy table statistics, FALSE
170 -- otherwise.
171 -- If copy_indexes is 1, copy index
172 -- related statistics, 0 otherwise.
173 -- copy_mvlog - TRUE implies copy table's MV log, FALSE
174 -- otherwise.
175 PROCEDURE copy_table_dependents(uname IN VARCHAR2,
176 orig_table IN VARCHAR2,
177 int_table IN VARCHAR2,
178 copy_indexes IN PLS_INTEGER := 1,
179 copy_triggers IN BOOLEAN := TRUE,
180 copy_constraints IN BOOLEAN := TRUE,
181 copy_privileges IN BOOLEAN := TRUE,
182 ignore_errors IN BOOLEAN := FALSE,
183 num_errors OUT PLS_INTEGER,
184 copy_statistics IN BOOLEAN := FALSE,
185 copy_mvlog IN BOOLEAN := FALSE);
186
187 END;