1 PACKAGE DBMS_EXTENDED_TTS_CHECKS IS
2
3 /*************************************************************************
4 Data Structures
5 *************************************************************************/
6
7 -- following data structure is used to pass information about an object
8 TYPE objrec IS RECORD (
9 v_pobjschema varchar2(30),
10 v_pobjname varchar2(30),
11 v_objid number,
12 v_objname varchar2(30),
13 v_objsubname varchar2(30),
14 v_objowner varchar2(30),
15 v_objtype varchar2(15));
16
17 -- List of object records
18 TYPE t_objlist IS TABLE OF objrec
19 INDEX BY BINARY_INTEGER;
20
21 --++
22 -- Definition: This function verifies Schema based XMLType tables that are
23 -- part of the transport set are self contained. i.e. the out of
24 -- line pieces that the table points to are also part of the
25 -- transport set. This will ensure that the SB XMLType table is
26 -- self contained.
27 --
28 -- Inputs: tsnames - plsql table of tablespace names
29 -- fromexp - stop after first violation found
30 --
31 -- Outputs: None
32 --
33 -- Returns: If fromExp is true, return false if violation found, true
34 -- for all other cases (even if violations have been found).
35 --++
36 Function verify_XMLSchema(
37 tsnames dbms_tts.tablespace_names,
38 fromExp in boolean)
39 RETURN boolean;
40
41 --++
42 -- Function check_csx_closure
43 --
44 -- Description: Verifies that all token manager tables for XML tables and columns
45 -- with binary storage (CSX) are also contained in the transported
46 -- tablespaces. This is needed so that data at the import site can be
47 -- decoded without a full remapping.
48 --
49 -- To be combined with verify_XMLSchema.
50 --
51 -- Inputs: tsnames - comma separated list of tablespace names
52 -- fromExp - being called by export?
53 --
54 -- Outputs: None
55 --
56 -- Results True if contained, otherwise false.
57 -- As for verify_XMLSchema, even if violation is found, returns true
58 -- if from Exp is false.
59 --++
60 FUNCTION check_csx_closure(
61 tsnames IN dbms_tts.tablespace_names,
62 fromExp IN boolean )
63 RETURN boolean;
64
65 --++
66
67 --++
68 -- Definition: This function verifies secondary objects that are associated
69 -- with an extensible index are contained in the list of
70 -- tablespaces or fully outside the list. This guarantees self
71 -- containment of all or none of the secondary objects
72 -- associated with the extensible index. For simple types like
73 -- tables and indexes it is clear why this check works. What may
74 -- not be so obvious is that this works even for objects like
75 -- partitions, lobs etc. For e.g. if Table T1 is partitioned
76 -- two ways P1 and P2, has a lob object L1 and Table T2 is an
77 -- IOT, and extensible index E1 is associated with L1 and T2
78 -- then it is sufficient just check that tablespace(L1) and
79 -- tablespace(T2) are either fully contained or fully out of
80 -- the tts set. Self Containment of T1 and T2 is guaranteed by
81 -- the straddling_rs_objects function
82 --
83 -- Inputs: fromexp - stop after first violation found
84 --
85 -- Outputs: None
86 --
87 -- Returns: If fromExp is true, return false if violation found, true
88 -- for all other cases (even if violations have been found).
89 --++
90 Function verify_Extensible (
91 fromExp in boolean)
92 RETURN boolean;
93
94 --++
95 -- Definition : This function verifies that:
96 -- 1. Materialized view logs stored as tables and the
97 -- corresponding master tables are self contained. The
98 -- containment check is similar to tables and its indexes:
99 -- If full_check is TRUE, then BOTH the MV log and the
100 -- master table must be in or both must be out of the
101 -- transportable set. If full_check is FALSE, then it is ok
102 -- for the MV log to be out of the transportable set but it
103 -- is NOT ok for the MV log to be in and its master table to
104 -- be out of the set.
105 -- 2. Updateable Materialized view tables and their
106 -- corresponding logs are fully contained in the
107 -- transportable set.
108 --
109 -- If fromExp is false, populate the violation table with the
110 -- offending violation object information for each violation.
111 --
112 -- Note that it is ok to transport just the MVs and not their
113 -- masters or vice versa. It is also ok to just transport
114 -- master tables without the mv logs, but NOT vice versa.
115 --
116 -- Inputs: fromexp - stop after first violation found
117 -- full_check - perform full check - described above
118 --
119 -- Outputs: None
120 --
121 -- Returns: If fromExp is true, return false if violation found, true
122 -- for all other cases (even if violations have been found).
123 --++
124 FUNCTION verify_MV (
125 fromExp in boolean,
126 full_check in boolean)
127 RETURN boolean;
128
129 --++
130 -- Definition: This function verifies that all nested tables are fully in or
131 -- out of the tts set.
132 --
133 -- Inputs: fromexp - stop after first violation found
134 --
135 -- Outputs: None
136 --
137 -- Returns: If fromExp is true, return false if violation found, true
138 -- for all other cases (even if violations have been found).
139 --++
140 FUNCTION verify_NT(
141 fromExp in boolean)
142 RETURN boolean;
143
144 --++
145 -- Definition: This function ensures that the group of objects that are
146 -- passed in either are fully IN or OUT of the tslist (set of
147 -- tablespaces to be transported
148 --
149 -- Inputs: vobjlist
150 --
151 -- Outputs: None
152 --
153 -- Return: straddling objects across transportable set - 0
154 -- all objects in list are fully contained - 1
155 -- all objects in list are fully outside - 2
156 --++
157 FUNCTION objectlist_Contained(
158 vobjlist t_objlist)
159 RETURN number;
160
161 --
162 -- The following get_tablespace_* functions take information about an object
163 -- that takes up physical storage in the database and returns the tablespace
164 -- name associated with the object.
165 --
166
167 --++
168 -- Definition: This function checks if table is non partitioned and not an
169 -- IOT then return its tablespace. If the TABLE is an IOT or
170 -- partitioned then just return the tablespace associated with
171 -- the index or the first partition respectively. If a specific
172 -- tablespace is needed then the get_tablespace_tabpart routine
173 -- should be invoked by the caller.
174 --
175 -- Inputs: object_id - obj# of object to check
176 -- object_owner - owner of object
177 -- object_name - object name
178 -- object_subname - object subname (partition or subpartition)
179 -- object_type - object type
180 --
181 -- Outputs: None
182 --
183 -- Returns: Tablespace name
184 --++
185 FUNCTION get_tablespace_tab(
186 object_id number,
187 object_owner varchar2,
188 object_name varchar2,
189 object_subname varchar2,
190 object_type varchar2)
191 RETURN varchar2;
192
193 --++
194 -- Description: If the INDEX is partitioned then simply return the
195 -- tablespace associated the first partition
196 --
197 -- Inputs: object_id - obj# of object to check
198 -- object_owner - owner of object
199 -- object_name - object name
200 -- object_subname - object subname (partition or subpartition)
201 -- object_type - object type
202 --
203 -- Outputs: None
204 --
205 -- Returns: Tablespace name
206 --++
207 FUNCTION get_tablespace_ind(
208 object_id number,
209 object_owner varchar2,
210 object_name varchar2,
211 object_subname varchar2,
212 object_type varchar2)
213 RETURN varchar2;
214
215 --++
216 -- Definition: If the table is partitioned, then return the tablespace
217 -- associated with the first partition
218 --
219 -- Inputs: object_id - obj# of object to check
220 -- object_owner - owner of object
221 -- object_name - object name
222 -- object_subname - object subname (partition or subpartition)
223 -- object_type - object type
224 --
225 -- Outputs: None
226 --
227 -- Returns: Tablespace name
228 --++
229 FUNCTION get_tablespace_tabpart(
230 object_id number,
231 object_owner varchar2,
232 object_name varchar2,
233 object_subname varchar2,
234 object_type varchar2)
235 RETURN varchar2;
236
237 --++
238 -- Definition: If the index is partitioned, then return the tablespace
239 -- associated with the first partition
240 --
241 -- Inputs: object_id - obj# of object to check
242 -- object_owner - owner of object
243 -- object_name - object name
244 -- object_subname - object subname (partition or subpartition)
245 -- object_type - object type
246 --
247 -- Outputs: None
248 --
249 -- Returns: Tablespace name
250 --++
251 FUNCTION get_tablespace_indpart(
252 object_id IN number,
253 object_owner varchar2,
254 object_name varchar2,
255 object_subname varchar2,
256 object_type varchar2)
257 RETURN varchar2;
258
259 --++
260 -- Definition: Return the tablespace associated with the first subpartition
261 --
262 -- Inputs: object_id - obj# of object to check
263 -- object_owner - owner of object
264 -- object_name - object name
265 -- object_subname - object subname (partition or subpartition)
266 -- object_type - object type
267 --
268 -- Outputs: None
269 --
270 -- Returns: Tablespace name
271 --++
272 FUNCTION get_tablespace_tabsubpart(
273 object_id number,
274 object_owner varchar2,
275 object_name varchar2,
276 object_subname varchar2,
277 object_type varchar2)
278 RETURN varchar2;
279
280 --++
281 -- Definition: Return the tablespace associated with the first subpartition
282 --
283 -- Inputs: object_id - obj# of object to check
284 -- object_owner - owner of object
285 -- object_name - object name
286 -- object_subname - object subname (partition or subpartition)
287 -- object_type - object type
288 --
289 -- Outputs: None
290 --
291 -- Returns: Tablespace name
292 --++
293 FUNCTION get_tablespace_indsubpart(
294 object_id number,
295 object_owner varchar2,
296 object_name varchar2,
297 object_subname varchar2,
298 object_type varchar2)
299 RETURN varchar2;
300
301 --++
302 -- Description: This function returns objects associated with an extensible
303 -- index in a list format
304 --
305 -- Inputs: objn - object number
306 --
307 -- Outputs: None
308 --
309 -- Returns objects associated with an extensible index in a list format
310 FUNCTION get_domain_index_secobj(
311 objn number)
312 RETURN t_objlist;
313
314 --++
315 -- Description: This function returns child nested tables associated with a
316 -- parent nested table object in a list format
317 --
318 -- Inputs: objn - object number
319 --
320 -- Outputs: None
321 --
322 -- Returns child nested tables associated with a parent nested table
323 -- object in a list format
324 FUNCTION get_child_nested_tables(
325 objn number)
326 RETURN t_objlist;
327
328 END DBMS_EXTENDED_TTS_CHECKS;