1 package dbms_dbfs_sfs_admin
2 authid definer
3 as
4
5
6
7 /*
8 * Bless the current session user with sufficient _direct_
9 * privileges to enable them to use various DBFS API types in their
10 * internal tables.
11 *
12 * This procedure is not meant to be invoked directly, but is a
13 * helper function available for use with the
14 * "dbms_dbfs_sfs.createFilesystem" method.
15 *
16 *
17 */
18
19 procedure blessUser(forView in boolean default false);
20
21
22
23 /*
24 * Helper function for store creation (only for use with
25 * dbms_dbfs_sfs.createFilesystem).
26 *
27 */
28
29 function defaultTablespace(
30 uname in varchar2)
31 return varchar2;
32
33
34
35 /*
36 * Helper function for looking up a store id (only for use with
37 * dbms_dbfs_sfs.getStoreId).
38 *
39 */
40
41 function getStoreId(
42 schema_name in varchar2,
43 tbl_name in varchar2)
44 return number;
45
46
47
48 /*
49 * Helper functions for space usage queries (only for use with
50 * dbms_dbfs_sfs.spaceUsage).
51 *
52 */
53
54 procedure spaceDependents(
55 schema_name in varchar2,
56 tbl_name in varchar2,
57 potbl_name in varchar2,
58 dseg in out nocopy dbms_dbfs_sfs.dsegments_t);
59
60 procedure spaceUsage(
61 tbs in out nocopy dbms_dbfs_content_properties_t,
62 schema_name in varchar2,
63 tbl_name in varchar2,
64 potbl_name in varchar2,
65 dseg in out nocopy dbms_dbfs_sfs.dsegments_t,
66 blksize out integer,
67 tbytes out integer,
68 ubytes out integer,
69 fbytes out integer,
70 do_fast in boolean default false,
71 useEstimate in integer default 0);
72
73 function tbsUsage(
74 tbs in dbms_dbfs_content_properties_t)
75 return integer;
76
77
78
79 /*
80 * Helper function for space usage queries (only for use with
81 * dbms_dbfs_sfs.shrinkFS).
82 *
83 */
84
85 procedure lobUsage(
86 schema_name in varchar2,
87 tbl_name in varchar2,
88 part_name in varchar2 default null,
89 nbytes out integer);
90
91
92
93 /*
94 * Create a POSIX store.
95 *
96 * Helper function for store creation (only for use with
97 * dbms_dbfs_sfs.createFilesystem).
98 *
99 *
100 * Add a newly created POSIX table to the list of known POSIX
101 * tables. At this stage, no store is registered to a particular
102 * owner as an accessible filesystem (use "registerFilesystem", if
103 * needed).
104 *
105 * The (schema_name, tbl_name) and its identifier (tabid) must both
106 * be database-wide unique. If the table uses object-types,
107 * "ptbl_name" should be "null", else the name of a valid properties
108 * table.
109 *
110 */
111
112 procedure createFilesystem(
113 tabid in number,
114 schema_name in varchar2,
115 tbl_name in varchar2,
116 ptbl_name in varchar2,
117 version in varchar2,
118 properties in dbms_dbfs_content_properties_t
119 default null);
120
121 /* createFilesystem_log: INTERNAL USE ONLY */
122 procedure createFilesystem_log(
123 tabid in number,
124 schema_name in varchar2,
125 tbl_name in varchar2,
126 ptbl_name in varchar2,
127 version in varchar2,
128 properties in dbms_dbfs_content_properties_t,
129 suid in varchar2,
130 ctime in timestamp);
131 pragma supplemental_log_data(
132 createFilesystem_log,
133 AUTO);
134
135
136
137 /*
138 * Register a POSIX store.
139 *
140 *
141 * Register an already created POSIX store table
142 * (dbms_dbfs_sfs.createFilesystem) in schema "schema_name", table
143 * "tbl_name", as a new filesystem named "store_name".
144 *
145 * The new filesystem/store can optionally be volume/snapshot
146 * qualified (by default the "main" volume and current snapshot are
147 * used).
148 *
149 * The same table can be registered as different filesystems by the
150 * same/different user as long as the "store_name" and (schema_name,
151 * tbl_name, volume_name, snapshot_name) tuple are unique per-user.
152 *
153 */
154
155 procedure registerFilesystem(
156 store_name in varchar2,
157 schema_name in varchar2,
158 tbl_name in varchar2,
159 volume_name in varchar2 default 'main',
160 snapshot_name in varchar2 default null);
161
162 /* registerFilesystem_log: INTERNAL USE ONLY */
163 procedure registerFilesystem_log(
164 store_name in varchar2,
165 schema_name in varchar2,
166 tbl_name in varchar2,
167 volume_name in varchar2,
168 snapshot_name in varchar2,
169 suid in varchar2,
170 ctime in timestamp);
171 pragma supplemental_log_data(
172 registerFilesystem_log,
173 AUTO);
174
175
176
177 /*
178 * Unregister a POSIX store.
179 *
180 *
181 * The store is removed from the metadata tables, unregistered from
182 * the DBFS API, but the underlying filesystem itself is otherwise
183 * untouched.
184 *
185 */
186
187 procedure unregisterFilesystem(
188 store in varchar2);
189
190 /* unregisterFilesystem_log: INTERNAL USE ONLY */
191 procedure unregisterFilesystem_log(
192 store in varchar2,
193 suid in varchar2,
194 ctime in timestamp);
195 pragma supplemental_log_data(
196 unregisterFilesystem_log,
197 AUTO);
198
199
200
201 /*
202 * Initialize a POSIX store.
203 *
204 * Helper function for store initialization (only for use with
205 * dbms_dbfs_sfs.initFS).
206 *
207 *
208 * Remove all volumes and snapshots associated with a POSIX
209 * filesystem table, and update its "formatted" timestamp.
210 *
211 */
212
213 procedure initFilesystem(
214 schema_name in varchar2,
215 tbl_name in varchar2);
216
217 /* initFilesystem_log: INTERNAL USE ONLY */
218 procedure initFilesystem_log(
219 schema_name in varchar2,
220 tbl_name in varchar2,
221 suid in varchar2,
222 ctime in timestamp);
223 pragma supplemental_log_data(
224 initFilesystem_log,
225 AUTO);
226
227
228
229 /*
230 * Update the properties of a POSIX store.
231 *
232 * Helper function for store modification (only for use with
233 * dbms_dbfs_sfs.{add,delete,set}FSProperties).
234 *
235 *
236 * Update the store-wide properties of a POSIX store.
237 *
238 */
239
240 procedure setFSProperties(
241 schema_name in varchar2,
242 tbl_name in varchar2,
243 properties in dbms_dbfs_content_properties_t);
244
245 /* setFSProperties_log: INTERNAL USE ONLY */
246 procedure setFSProperties_log(
247 schema_name in varchar2,
248 tbl_name in varchar2,
249 properties in dbms_dbfs_content_properties_t,
250 suid in varchar2,
251 ctime in timestamp);
252 pragma supplemental_log_data(
253 setFSProperties_log,
254 AUTO);
255
256
257
258 /*
259 * Drop a POSIX store.
260 *
261 * Helper function for store creation (only for use with
262 * dbms_dbfs_sfs.dropFilesystem).
263 *
264 *
265 * Remove a POSIX filesystem table from the list of known POSIX
266 * filesystem tables.
267 *
268 * The table underlying the store must not be in use (i.e. all
269 * filesystems referring to this table must have been unregistered
270 * prior to this call).
271 *
272 */
273
274 procedure dropFilesystem(
275 schema_name in varchar2,
276 tbl_name in varchar2);
277
278 /* dropFilesystem_log: INTERNAL USE ONLY */
279 procedure dropFilesystem_log(
280 schema_name in varchar2,
281 tbl_name in varchar2,
282 suid in varchar2,
283 ctime in timestamp);
284 pragma supplemental_log_data(
285 dropFilesystem_log,
286 AUTO);
287
288
289
290 /*
291 * Snapshot operations.
292 *
293 * Helper functions for snapshot operations meant to be invoked only
294 * from "dbms_dbfs_sfs".
295 *
296 */
297
298 procedure createSnapshot(
299 store_name in varchar2,
300 snap_name in varchar2,
301 vol_name in varchar2 default 'main');
302
303 procedure revertSnapshot(
304 store_name in varchar2,
305 snap_name in varchar2,
306 vol_name in varchar2 default 'main');
307
308 procedure dropSnapshot(
309 store_name in varchar2,
310 snap_name in varchar2,
311 vol_name in varchar2 default 'main');
312
313
314
315 /*
316 * Drop _all_ POSIX filesystem tables.
317 *
318 * Action to be invoked only during cleanup/downgrade.
319 *
320 *
321 * The procedure executes like a DDL (i.e. auto-commits before and
322 * after its execution).
323 *
324 */
325
326 procedure drop_all_tables;
327
328
329
330 /*
331 * Delete orphaned filesystem/table entries.
332 *
333 * Action to be invoked only during explicit and immediate cleanup
334 * (for cases where the user does not want to wait for auto
335 * cleanup).
336 *
337 *
338 * The procedure executes like a DDL (i.e. auto-commits before and
339 * after its execution).
340 *
341 */
342
343 procedure delete_orphans;
344
345 /* delete_orphans: INTERNAL USE ONLY */
346 procedure delete_orphans_log(
347 suid in varchar2,
348 ctime in timestamp);
349 pragma supplemental_log_data(
350 delete_orphans_log,
351 AUTO_WITH_COMMIT);
352
353
354
355 /*
356 * Partition the SFS sequence# generator for distributed
357 * multi-master environments.
358 *
359 *
360 * The procedure partitions (by regenerating the sequence) for use
361 * with "nodes" nodes/databases, where the current node/database has
362 * an index of "myid" (in the range [0 .. nodes-1]).
363 *
364 *
365 * A "newstart" value can be specified as the starting value for the
366 * sequence and will be used as long as it is larger than the
367 * current sequence value.
368 *
369 * The same value of "newstart" must be specified across the various
370 * "nodes" to make sure that the sequence#s generated by each node
371 * have no overlap.
372 *
373 * **NOTE**: do not invoke this procedure unless you know exactly
374 * what you are doing.
375 *
376 *
377 * The procedure executes like a DDL (i.e. auto-commits before and
378 * after its execution).
379 *
380 */
381
382 procedure partition_sequence(
383 nodes in number,
384 myid in number,
385 newstart in number default null);
386
387 /* partition_sequence_log: INTERNAL USE ONLY */
388 procedure partition_sequence_log(
389 nodes in number,
390 myid in number,
391 newstart in number);
392 pragma supplemental_log_data(
393 partition_sequence_log,
394 AUTO_WITH_COMMIT);
395
396
397
398 /*
399 * Adjust the SFS sequence# cache to allow for higher concurrency
400 * and file ingest throughput.
401 *
402 *
403 * The default cache size of "20" is increased to "8192" (or the
404 * user-specified value).
405 *
406 *
407 * The procedure executes like a DDL (i.e. auto-commits before and
408 * after its execution).
409 *
410 */
411
412 procedure recache_sequence(
413 newcache in number default 8192);
414
415 /* recache_sequence_log: INTERNAL USE ONLY */
416 procedure recache_sequence_log(
417 newcache in number);
418 pragma supplemental_log_data(
419 recache_sequence_log,
420 AUTO_WITH_COMMIT);
421
422
423
424 /*
425 * DBFS export/import procedural actions.
426 *
427 * For internal use only. See project-5464 for details.
428 *
429 */
430
431 function system_info_exp(
432 prepost in pls_integer,
433 connectstring out nocopy varchar2,
434 version in varchar2,
435 new_block out pls_integer)
436 return varchar2;
437
438 function schema_info_exp(
439 schema in varchar2,
440 prepost in pls_integer,
441 isdba in pls_integer,
442 version in varchar2,
443 new_block out pls_integer)
444 return varchar2;
445
446 function instance_info_exp(
447 name in varchar2,
448 schema in varchar2,
449 prepost in pls_integer,
450 isdba in pls_integer,
451 version in varchar2,
452 new_block out pls_integer)
453 return varchar2;
454
455
456
457 /*
458 * DBFS export/import support.
459 *
460 * A one-time action to register the SFS entities with the
461 * procedural action infrastructure.
462 *
463 * The registrations should normally have already occurred
464 * implicitly during catalog initialization; however, invoking this
465 * procedure (one or more times) explicitly is harmless.
466 *
467 *
468 * The procedure executes like a DDL (i.e. auto-commits before and
469 * after its execution).
470 *
471 */
472
473 procedure eximRegisterAll;
474
475
476
477 /*
478 * DBFS export/import support (helper functions).
479 *
480 * These functions are _strictly_ for internal use in the DBFS
481 * export/import infrastructure. Do not even _think_ about using
482 * them explicitly.
483 *
484 */
485
486 procedure exim_seq(
487 newval in number);
488 pragma supplemental_log_data(
489 exim_seq,
490 AUTO);
491
492 procedure exim_tab(
493 tabid out number,
494 schema_name in varchar2,
495 table_name in varchar2,
496 ptable_name in varchar2,
497 version# in varchar2,
498 created in number,
499 formatted in number);
500
501 /* exim_tab_log: INTERNAL USE ONLY */
502 procedure exim_tab_log(
503 tabid in number,
504 schema_name in varchar2,
505 table_name in varchar2,
506 ptable_name in varchar2,
507 version# in varchar2,
508 created in number,
509 formatted in number);
510 pragma supplemental_log_data(
511 exim_tab_log,
512 AUTO);
513
514 procedure exim_tabp(
515 tabid in number,
516 propname in varchar2,
517 propvalue in varchar2,
518 typecode in number);
519 pragma supplemental_log_data(
520 exim_tabp,
521 AUTO);
522
523 procedure exim_vol(
524 tabid in number,
525 volid in number,
526 volname in varchar2,
527 created in number,
528 csnap# in number,
529 dvolid in number,
530 dsnap# in number,
531 deleted in number);
532 pragma supplemental_log_data(
533 exim_vol,
534 AUTO);
535
536 procedure exim_snap(
537 tabid in number,
538 volid in number,
539 snap# in varchar2,
540 snapname in varchar2,
541 created in number,
542 deleted in number);
543 pragma supplemental_log_data(
544 exim_snap,
545 AUTO);
546
547 procedure exim_fs(
548 tabid in number,
549 store_owner in varchar2,
550 store_name in varchar2,
551 volid in number,
552 snap# in varchar2,
553 created in number);
554 pragma supplemental_log_data(
555 exim_fs,
556 AUTO);
557
558 procedure exim_grants(
559 tabid in number);
560 pragma supplemental_log_data(
561 exim_grants,
562 AUTO_WITH_COMMIT);
563
564 procedure exim_attrv(
565 tabid in number,
566 attrv in varchar2,
567 asof in number,
568 vol# in number,
569 goff in number);
570 pragma supplemental_log_data(
571 exim_attrv,
572 AUTO_WITH_COMMIT);
573
574
575
576 end;