DBA Data[Home] [Help]

PACKAGE: GSMADMIN_INTERNAL.DBMS_GSM_UTILITY

Source


1 PACKAGE dbms_gsm_utility AS
2 
3 --*****************************************************************************
4 -- Package Public Variables
5 --*****************************************************************************
6 
7 --version of GDSCTL connected to this session
8 gdsctl_vers    number DEFAULT NULL;
9 
10 -- sessioninfo    gsm_session;
11 
12 
13 --*****************************************************************************
14 -- Package Public Types
15 --*****************************************************************************
16 
17 
18 --*****************************************************************************
19 -- Package Public Constants
20 --*****************************************************************************
21 
22 ------------------------------------------------------------------------------
23 -- Catalog version lookup. This table is used to translate database version
24 -- string into catalog version (a number). Each time a new database release is
25 -- supported, we need to add a new record to this lookup table. Several
26 -- database releases may resolve to the same catalog version if nothing
27 -- in the catalog interface changed between database releases (highly
28 -- unlikely, but possible). Changes in catalog interface will be:
29 --
30 --   - any changes to existing database objects or additions of new
31 --     database objects
32 --
33 --   - any changes to existing external PL/SQL procedure interfaces
34 --     executed in the catalog, or additions of new external PL/SQL
35 --     procedures executed in the catalog. This includes
36 --     all external functions and procedures in DBMS_GSM_POOLADMIN
37 --     and DBMS_GSM_CLOUDADMIN, and some procedures in DBMS_GSM_UTILITY
38 --     and DBMS_GSM_COMMON. If you are unsure, bump the catalog version.
39 --
40 -- NOTE: Adding a new catalog version may require new entries in the version
41 --       compatibility tables below
42 --
43 --       Making changes in minor patches is not allowed because they will
44 --       not be installed correctly
45 ------------------------------------------------------------------------------
46 catvers_lookup    constant   tvers_lookup_t := tvers_lookup_t(
47 --        Database Version       Catalog Version
48 --------------------------------------------------
49 tvers_rec('12.1.0.1',                 1),
50 tvers_rec('12.1.0.2',                 2)
51 );
52 
53 ------------------------------------------------------------------------------
54 -- GSM version lookup. This table is used to translate GSM version
55 -- string into GSM version (a number). Each time a new GSM release is
56 -- supported, we need to add a new record to this lookup table. Several
57 -- GSM releases may resolve to the same GSM version number if nothing
58 -- in the GSM interface changed between database releases (highly
59 -- unlikely, but possible).
60 --
61 -- NOTE: Adding a new GSM version may require new entries in the version
62 --       compatibility tables below
63 --
64 --       Making changes in minor patches will require addding another level
65 --       to the version string
66 ------------------------------------------------------------------------------
67 gsmvers_lookup    constant   tvers_lookup_t := tvers_lookup_t(
68 --     GSM Version String      GSM Version number
69 --------------------------------------------------
70 tvers_rec('12.1.0.1',                 1),
71 tvers_rec('12.1.0.2',                 2)
72 );
73 
74 ------------------------------------------------------------------------------
75 -- cloud database version lookup. This table is used to translate DB version
76 -- string into database version (a number). Each time a new DB release is
77 -- supported, we need to add a new record to this lookup table. Several
78 -- DB releases may resolve to the same DB version number if nothing
79 -- in the Database interface changed between database releases (highly
80 -- unlikely, but possible); but be aware that this would preclude a reverse
81 -- lookup (which we already use in the code) since a single version number
82 -- would resolve to several version strings.
83 --
84 -- Changes to the database interface will be:
85 --
86 --   - any changes to existing external PL/SQL procedure interfaces
87 --     executed in the cloud database, or additions of new external PL/SQL
88 --     procedures executed in the cloud database. This includes
89 --     all external functions and procedures in DBMS_GSM_DBADMIN
90 --     and some procedures in DBMS_GSM_UTILITY
91 --     and DBMS_GSM_COMMON. If you are unsure, bump the database version.
92 --
93 -- NOTE: Adding a new DB version may require new entries in the version
94 --       compatibility tables below
95 --
96 --       Making changes in minor patches is not allowed because they will
97 --       not be installed correctly
98 ------------------------------------------------------------------------------
99 dbvers_lookup    constant   tvers_lookup_t := tvers_lookup_t(
100 --      DB Version String      DB Version number
101 --------------------------------------------------
102 tvers_rec('12.1.0.1',                 1),
103 tvers_rec('12.1.0.2',                 2)
104 );
105 
106 ------------------------------------------------------------------------------
107 -- GDSCTL version lookup. This table is used to translate GDSCTL version
108 -- string into GDSCTL version (a number). Each time a new GDSCTL release is
109 -- supported, we need to add a new record to this lookup table. Several
110 -- GDSCTL releases may resolve to the same GDSCTL version number if nothing
111 -- in the GDSCTL interface changed between database releases (highly
112 -- unlikely, but possible).
113 --
114 -- NOTE: Adding a new GDSCTL version may require new entries in the version
115 --       compatibility tables below
116 --
117 --       Making changes in minor patches will require addding another level
118 --       to the version string
119 ------------------------------------------------------------------------------
120 gdsctlvers_lookup    constant   tvers_lookup_t := tvers_lookup_t(
121 --  GDSCTL Version String     GDSCTL Version number
122 --------------------------------------------------
123 tvers_rec('12.1.0.1',                 1),
124 tvers_rec('12.1.0.2',                 2)
125 );
126 
127 -------------------------------------------------------------------------------
128 -- GDSCTL <=> catalog version compatibility lookup
129 -- Each known GDSCTL version will have a list of compatible catalog versions
130 -- Current versioning rule:
131 --     - catalog version should always be greater than or equal to
132 --       GDSCTL version
133 -------------------------------------------------------------------------------
134 gdsctl_catalog_lookup    constant   vers_lookup_t := vers_lookup_t(
135 --          GDSCTL VERSION       Compatible catalog versions
136 ------------------------------------------------------------------------
137 vers_lookup_rec(   1,                  vers_list(1,2) ),
138 vers_lookup_rec(   2,                  vers_list(2)   )
139 );
140 
141 -------------------------------------------------------------------------------
142 -- GSM <=> catalog version compatibility lookup
143 -- Each known GSM version will have a list of compatible catalog versions
144 -- Current versioning rule:
145 --     - catalog version should always be greater than or equal to
146 --       GSM version
147 -------------------------------------------------------------------------------
148 gsm_catalog_lookup    constant   vers_lookup_t := vers_lookup_t(
149 --             GSM VERSION       Compatible catalog versions
150 ------------------------------------------------------------------------
151 vers_lookup_rec(   1,                  vers_list(1,2) ),
152 vers_lookup_rec(   2,                  vers_list(2)   )
153 );
154 
155 -------------------------------------------------------------------------------
156 -- Default Names
157 -------------------------------------------------------------------------------
158 default_cloud_name      constant   varchar2(10) := 'oradbcloud';
159 
160 
161 -------------------------------------------------------------------------------
162 -- Identifier lengths
163 -------------------------------------------------------------------------------
164 
165 -- Must honor max service name lengths defined by database
166 max_service_name_len     constant  number := 64;
167 max_net_service_name_len constant  number := 250;
168 
169 -- max length of an instance name
170 max_inst_name_len        constant  number := 16;
171 
172 -- max length of AQ parameters
173 -- (matches size of additional_params in
174 --  type gsm_change_message, see catgwm.sql)
175 max_param_len            constant  number := 4000;
176 
177 -- Max number of VNCRs
178 max_vncr_number constant  number :=300;
179 
180 -- Max number of services
181 max_services    constant  number := 1000;
182 
183 -- Maximum number of database pools
184 max_dbpools       constant  number := 20;
185 
186 -------------------------------------------------------------------------------
187 -- Change Log Queue and generateChangeLogEntry() definitions.
188 -- These constants are defined for use with generateChangeLogEntry().
189 -- They are also the values stored in a gsm_change_message.
190 --
191 -- NOTE: The values are used to identify AQ messages that are sent to the GSM.
192 --       This is the primary way in which the catalog communicates with the GSM
193 --       servers. We currently allow the GSM server to be at a lower level than
194 --       the catalog (but not vice-versa). Be *VERY* careful not to change
195 --       the format of any existing AQ message in such a way that a prior
196 --       version of the GSM will not understand it. If there is a requirement,
197 --       add a new AQ message type, and be aware that new AQ message types
198 --       that are not understood by old GSM servers will simply be ignored.
199 --       Use the "version" field in the "gsm" table to work out how to handle
200 --       different situations.
201 -------------------------------------------------------------------------------
202 
203 -- "adminId" values for generateChangeLogEntry().
204 -- These constants define the package that generated the change entry.
205 -- Also stored in the the change log queue in gsm_change_message.admin_id.
206 
207 cloud_admin            constant   number := 1;
208 pool_admin             constant   number := 2;
209 
210 -- special gsm_requests sequence ID for pending GDSCTL warnings
211 pendingWarning         constant   number := -1;
212 
213 -- "changeId" values for generateChangeLogEntry() when adminId is cloud_admin.
214 -- "target" of command is always the object name (e.g. GSM name).
215 --  Also stored in the change log queue in gsm_change_message.change_id.
216 
217 add_gsm                constant   number := 1;
218 modify_gsm             constant   number := 2;
219 drop_gsm               constant   number := 3;
220 start_gsm              constant   number := 4;
221 stop_gsm               constant   number := 5;
222 
223 add_region             constant   number := 10;
224 modify_region          constant   number := 11;
225 drop_region            constant   number := 12;
226 
227 add_database_pool      constant   number := 20;
228 modify_database_pool   constant   number := 21;
229 drop_database_pool     constant   number := 22;
230 
231 -- "changeId" values for generateChangeLogEntry() when adminId is pool_admin.
232 -- "target" of command is always the object name (e.g. database or service name)
233 -- Also stored in the change log queue in gsm_change_message.change_id.
234 
235 add_database           constant   number := 30;
236 modify_database        constant   number := 31;
237 drop_database          constant   number := 32;
238 start_database         constant   number := 33;
239 stop_database          constant   number := 34;
240 drop_db_phys           constant   number := 35;
241 add_broker_config      constant   number := 36;
245 
242 mod_db_status          constant   number := 37;
243 add_db_done            constant   number := 38;
244 sync_database          constant   number := 39;
246 add_service            constant   number := 50;
247 modify_service         constant   number := 51;
248 drop_service           constant   number := 52;
249 relocate_service       constant   number := 53;
250 start_service          constant   number := 54;
251 stop_service           constant   number := 55;
252 enable_service         constant   number := 56;
253 disable_service        constant   number := 57;
254 add_service_to_dbs     constant   number := 58;
255 move_service_to_db     constant   number := 59;
256 make_dbs_preferred     constant   number := 60;
257 modify_service_config  constant   number := 61;
258 modify_service_on_db   constant   number := 62;
259 update_service_state   constant   number := 63;
260 add_vncr               constant   number := 70;
261 remove_vncr            constant   number := 71;
262 drop_service_ph        constant   number := 72;
263 drop_broker_config     constant   number := 73;
264 drop_bc_phys           constant   number := 74;
265 sync_broker_config     constant   number := 75;
266 mod_db_vers            constant   number := 76;
267 -- Special number for warning messages
268 plsql_warning          constant   number := 77;
269 
270 
271 -- catalog rollback IDs. There should be a matching "do it" ID above
272 -- for simplicity, we are just adding 100 to the "do it" counterpart
273 rb_drop_service           constant  number := 152;
274 rb_modify_service_on_db   constant  number := 162;
275 
276 --*****************************************************************************
277 -- Package Public Exceptions
278 --*****************************************************************************
279 
280 
281 --*****************************************************************************
282 -- Package Public Procedures
283 --*****************************************************************************
284 -------------------------------------------------------------------------------
285 --
286 -- PROCEDURE     getCatalogLock
287 --
288 -- Description:
289 --       Gets the catalog lock prior to making a change to the cloud catalog.
290 --
291 -- Parameters:
292 --       currentChangeSeq -    The current value of cloud.change_seq#
293 --                             This is the sequence # of the last committed
294 --                             change.
295 --
296 -------------------------------------------------------------------------------
297 
298 PROCEDURE getCatalogLock( currentChangeSeq OUT number);
299 
300 
301 -------------------------------------------------------------------------------
302 --
303 -- PROCEDURE     releaseCatalogLock
304 --
305 -- Description:
306 --      Releases the catalog lock and commits or rolls back the changes
307 --      made under the lock.
308 --
309 -- Parameters:
310 --      action:  "releaseLockCommit" -> release lock and commit all
311 --                             changes
312 --               "releaseLockRollback" -> release lock and rollback
313 --                             all changes
314 --      changeSeq: If "action" = "releaseLockCommit" this is the change
315 --                 sequence number of the the last change made under this lock.
316 --                 If "action" = "releaseLockRollback" then will be set to 0.
317 --
318 --
319 -- Notes:
320 --
321 -------------------------------------------------------------------------------
322 
323 releaseLockCommit           constant  number := 1;
324 releaseLockRollback         constant  number := 2;
325 
326 
327 PROCEDURE releaseCatalogLock( action    IN number default releaseLockCommit,
328                               changeSeq OUT number );
329 
330 -------------------------------------------------------------------------------
331 --
332 -- FUNCTION     regionExists
333 --
334 -- Description:
335 --    Checks if the specified region exists in the cloud catalog.
336 --
337 -- Parameters:
338 --    region_name:   The region to check.
339 --    region_num:    If the region exists, returns its number
340 --
341 -- Returns:
342 --    TRUE if the region is in the cloud catalog.
343 --
344 -- Notes:
345 --
346 -------------------------------------------------------------------------------
347 FUNCTION regionExists( region_name IN  varchar2,
348                        region_num  OUT number )
349   RETURN boolean;
350 
351 -------------------------------------------------------------------------------
352 --
353 -- FUNCTION     databasePoolExists
354 --
355 -- Description:
356 --   Checks if the specified database pool exists in the cloud catalog.
357 --
358 -- Parameters:
359 --   database_pool_name:  The pool to check.
360 --
361 -- Returns:
362 --   TRUE if the database pool is in the cloud catalog.
363 --
364 -- Notes:
365 --
366 -------------------------------------------------------------------------------
367 FUNCTION databasePoolExists( database_pool_name IN varchar2 )
368   RETURN boolean;
369 
370 -------------------------------------------------------------------------------
371 --
372 -- FUNCTION     prepareName
373 --
374 -- Description:
375 --       Verifies the length of a (service, GSM, etc) name and prepares
376 --       it for use by the GSM package.
377 --
378 --       Trims off leading and trailing spaces and converts it to lower
379 --       case.
380 --
381 -- Parameters:
382 --       in_name:     The name to check and and prepare for use.
383 --       out_name:    The prepared name.
387 --    TRUE if the name is the correct length.
384 --       max_length:  The maximum allowable length for out_name.
385 --
386 -- Returns:
388 --    FALSE otherwise (out_name will not be set).
389 --
390 -- Notes:
391 --   Names of GSM objects (services, GSMs, regions, etc) are stored in the
392 --   catalog in lower case.
393 --
394 -------------------------------------------------------------------------------
395 FUNCTION prepareName( in_name     IN  varchar2,
396                       out_name    OUT varchar2,
397                       max_length  IN  number )
398   RETURN boolean;
399 
400 -------------------------------------------------------------------------------
401 --
402 -- FUNCTION     prepareRegionName
403 --
404 -- Description:
405 --     Returns the region name to use on a dbms_gsm_* call when the region
406 --     name in the routine call can be NULL.
407 --
408 --     If the supplied name is NULL will determine if a default region name
409 --     can be used and returns it.  A default only exists if a single
410 --     region has been defined.  The default is that region.  If more than one
411 --     region has been defined, then a default cannot be picked and FALSE is
412 --     returned.
413 --
414 --     If the supplied name is not NULL, then verifies that it is the right
415 --     length and prepares it for use: trims off leading and trailing spaces
416 --     and converts to upper case.
417 --
418 --
419 -- Parameters:
420 --       input_name  (INPUT)  - the supplied name (can be NULL)
421 --       region_name (OUTPUT) - the region name to use
422 --
423 -- Returns:
424 --       TRUE if a valid region name can be returned
425 --       FALSE if not
426 --
427 -- Notes:
428 --
429 -------------------------------------------------------------------------------
430 FUNCTION prepareRegionName( input_name IN varchar2,
431                             region_name OUT varchar2 )
432   RETURN boolean;
433 
434 -------------------------------------------------------------------------------
435 --
436 -- FUNCTION     prepareDBPoolName
437 --
438 -- Description:
439 --     Returns the database pool name to use on a dbms_gsm_* call when the
440 --     database pool name in the routine call can be NULL.
441 --
442 --     If the supplied name is NULL will determine if a default database pool
443 --     name can be used and returns it.  A default only exists if a single
444 --     pool has been defined.  The default is that pool.  If more than one
445 --     pool has been defined, then a default cannot be picked and FALSE is
446 --     returned.
447 --
448 --     If the supplied name is not NULL, then verifies that it is the right
449 --     length and prepares it for use: trims off leading and trailing spaces
450 --     and converts to upper case.
451 --
452 --
453 -- Parameters:
454 --       input_name         (INPUT)  - the supplied name (can be NULL)
455 --       database_pool_name (OUTPUT) - the database pool name to use
456 --
457 -- Returns:
458 --       TRUE if a valid database pool name can be returned
459 --       FALSE if not
460 --
461 -- Notes:
462 --
463 -------------------------------------------------------------------------------
464 FUNCTION prepareDBPoolName( input_name         IN  varchar2,
465                             database_pool_name OUT varchar2 )
466   RETURN boolean;
467 
468 
469 -------------------------------------------------------------------------------
470 --
471 -- PROCEDURE     generateChangeLogEntry
472 --
473 -- Description:
474 --       Generates a description of a change and puts it into the
475 --       change log queue.
476 --
477 -- Parameters:
478 --       adminId:   package that is calling this routine
479 --                  "cloud_admin" - dbms_gsm_cloudadmin package
480 --                  "pool_admin"  - dbms_gsm_pooladmin package
481 --       changeId:  the change made (see constant definitions above)
482 --       target:    command target (e.g. gsm name for "add gsm")
483 --       poolName:  database pool (only if adminId = pool_admin)
484 --       params:    additional parameters for the change
485 --       updateRequestTable: whether or not to also put the change into
486 --                   gsm_requests table
487 --
488 --
489 -- Notes:
490 --   See constant definitions above for "adminId" and "changeId" parameters.
491 --
492 -------------------------------------------------------------------------------
493 
494 updateFalse  constant  number := 0;
495 updateTrue   constant  number := 1;
496 
497 PROCEDURE generateChangeLogEntry( adminId             IN number,
498                                   changeId            IN number,
499                                   target              IN varchar2,
500                                   poolName            IN varchar2 default NULL,
501                                   params              IN varchar2 default NULL,
502                                   updateRequestTable  IN number
503                                      default updateTrue,
504                                   old_instances       IN instance_list
505                                      default NULL);
506 
507 
508 -------------------------------------------------------------------------------
509 --
510 -- PROCEDURE     raise_gsm_warning
511 --
512 -- Description:
513 --       Causes a warning message to display on GDSCTL session. Can be used
514 --       during catalog processing only
515 --
516 -- Parameters:
517 --       message_id: numeric value of warning message
518 --       parms       message parameters (if any)
519 --
520 -- Notes:
524 -------------------------------------------------------------------------------
521 --   causes a warning message to be sent to GDSCTL by adding a new record
522 --   to gsm_requests. Does not interrupt processing
523 --
525 PROCEDURE raise_gsm_warning (message_id     IN   number,
526                              parms          IN   message_param_list
527                                 DEFAULT message_param_list());
528 
529 -------------------------------------------------------------------------------
530 --
531 -- PROCEDURE     removeStaleRequests
532 --
533 -- Description:
534 --       Removes stale entries from gsm_requests
535 --
536 -- Parameters:
537 --       age:    IN    Requests older than this are removed
538 --
539 --
540 -- Notes:
541 -------------------------------------------------------------------------------
542 PROCEDURE removeStaleRequests; --(age IN INTERVAL DAY TO SECOND
543 --                                          default '10 minutes');
544 
545 ------------------------------------------------------------------------------
546 --
547 -- PROCEDURE isLockedByMaster
548 --
549 -- Description:
550 --      Determines if master locak is already taken
551 --
552 -- Parameters:
553 --      None
554 --
555 -- Returns:
556 --      0 - Master lock is not taken
557 --      1 - Master Lock is taken
558 --
559 ------------------------------------------------------------------------------
560 FUNCTION isLockedByMaster
561   RETURN integer;
562 
563 ------------------------------------------------------------------------------
564 --
565 -- PROCEDURE RSAEncoder
566 --
567 -- Description:
568 --      Encrypt input string to byte array using PKCS
569 --
570 -- Parameters:
571 --      input:      IN    String to be encrypted
572 --      keybyte:    IN    PKI public key bytes
573 --      output:     OUT   Encrypted bytes
574 --
575 --
576 ------------------------------------------------------------------------------
577 
578 PROCEDURE RSAEncoder( input      IN    varchar2,
579                       keybyte    IN    RAW,
580                       output     OUT   RAW);
581 
582 -------------------------------------------------------------------------------
583 --
584 -- FUNCTION     maxDBInstances
585 --
586 -- Description:
587 --       Queries the database parameter setting for the maximum number of
588 --       instances to reserve for a cloud database.
589 --
590 -- Parameters:
591 --       None
592 --
593 -- Returns:
594 --       The maximum.
595 --
596 -- Notes:
597 --
598 -------------------------------------------------------------------------------
599 FUNCTION maxDBInstances
600   RETURN number;
601 
602 ------------------------------------------------------------------------------
603 --
604 -- PROCEDURE reserveInstNums
605 --
606 -- Description:
607 --    Reserve reserve_count database numbers from cloud
608 --
609 -- Notes:
610 --   Only useful for PL/SQL calls, current value should be known already
611 --   otherwise this function has no good use.
612 --
613 ------------------------------------------------------------------------------
614 PROCEDURE reserveInstNums( reserve_count IN number );
615 
616 ------------------------------------------------------------------------------
617 --
618 -- FUNCTION reserveNextDBNum
619 --
620 -- Description:
621 --   Reserves the next available DB number for use.
622 --
623 -- Returns:
624 --   The next available number
625 --
626 -- Notes:
627 --   This function updates the cloud table, but does not commit. The caller
628 --   is expected to commit (if the number is used), or rollback (if the
629 --   number can be re-used). An update lock on the cloud table will be held
630 --   until the caller either commits or rolls back.
631 --
632 ------------------------------------------------------------------------------
633 FUNCTION reserveNextDBNum( reserve_count   IN number default NULL)
634   RETURN number;
635 
636 ------------------------------------------------------------------------------
637 --
638 -- FUNCTION getFieldSize
639 --
640 -- Description:
641 --   gets the size of a database field
642 --
643 -- Returns:
644 --   size
645 --
646 -- Notes:
647 --   Used internally by PL/SQL to verify the size of input strings
648 --
649 ------------------------------------------------------------------------------
650 FUNCTION getFieldSize( tab_name   IN varchar2,
651                        col_name   IN varchar2)
652   RETURN number;
653 
654 ------------------------------------------------------------------------------
655 --
656 -- FUNCTION getCatalogVersion
657 --
658 -- Description:
659 --   returns the version of this catalog
660 --
661 -- Returns:
662 --   catalog version (number)
663 --
664 -- Notes:
665 --    Catalog version is calculated from RDBMS version using a lookup table
666 --    (see description at the top of this file)
667 --
668 ------------------------------------------------------------------------------
669 FUNCTION getCatalogVersion
670   RETURN number;
671 
672 ------------------------------------------------------------------------------
673 --
674 -- FUNCTION getDBVersion
675 --
676 -- Description:
677 --   returns the version of this cloud database
678 --
679 -- Returns:
680 --   cloud database version (number)
681 --
682 -- Notes:
686 ------------------------------------------------------------------------------
683 --    Database version is calculated from RDBMS version using a lookup table
684 --    (see description at the top of this file)
685 --
687 FUNCTION getDBVersion
688   RETURN number;
689 
690 ------------------------------------------------------------------------------
691 --
692 -- FUNCTION DBVersRevLookup
693 --
694 -- Description:
695 --   returns the database version string given version number (reverse lookup)
696 --
697 -- Parameters:
698 --      dbvers - Database version number to look up
699 --
700 -- Returns:
701 --   cloud database version string
702 --
703 -- Notes:
704 --    Database version string is calculated from input using a lookup table
705 --    (see description at the top of this file)
706 --
707 ------------------------------------------------------------------------------
708 FUNCTION DBVersRevLookup (dbvers    IN    number)
709    RETURN varchar2;
710 
711 ------------------------------------------------------------------------------
712 --
713 -- FUNCTION GSMVersLookup
714 --
715 -- Description:
716 --   returns the numeric version of the GSM given version string
717 --
718 -- Parameters:
719 --      gsm_vers - GSM version to lookup
720 --
721 -- Returns:
722 --   GSM version (number)
723 --
724 -- Notes:
725 --    GSM version is calculated from version string using a lookup table
726 --    (see description at the top of this file)
727 --
728 ------------------------------------------------------------------------------
729 FUNCTION GSMVersLookup (gsm_vers    IN    varchar2)
730    RETURN number;
731 
732 ------------------------------------------------------------------------------
733 --
734 -- FUNCTION GDSCTLVersLookup
735 --
736 -- Description:
737 --   returns the numeric version of GDSCTL given version string
738 --
739 -- Parameters:
740 --      gdsctl_vers - GDSCTL version to lookup
741 --
742 -- Returns:
743 --   GDSCTL version (number)
744 --
745 -- Notes:
746 --    GDSCTL version is calculated from version string using a lookup table
747 --    (see description at the top of this file)
748 --
749 ------------------------------------------------------------------------------
750 FUNCTION GDSCTLVersLookup (gdsctl_vers    IN    varchar2)
751    RETURN number;
752 
753 ------------------------------------------------------------------------------
754 --
755 -- FUNCTION compatibleVersion
756 --
757 -- Description:
758 --   determines if provided versions are compatible with each other
759 --
760 -- Returns:
761 --   TRUE/FALSE - are versions compatible
762 --
763 -- Notes:
764 --   Compatible versions are determined from a lookup table (see description
765 --   at the top of this file)
766 --
767 ------------------------------------------------------------------------------
768 FUNCTION compatibleVersion (gdsctl_version    number default NULL,
769                             catalog_version   number default NULL,
770                             gsm_version       number default NULL,
771                             db_version        number default NULL)
772   RETURN boolean;
773 
774 --*****************************************************************************
775 -- End of Package Public Procedures
776 --*****************************************************************************
777 
778   -------------------------
779   --  ERRORS AND EXCEPTIONS
780   --
781   --  When adding errors remember to add a corresponding exception below.
782 err_generic_gsm      constant number := -44850;
783 err_bad_db_name      constant number := -44851;
784 err_region_max       constant number := -44852;
785 err_vncr_max         constant number := -44853;
786 err_exist_cld        constant number := -44854;
787 err_invalid_cld      constant number := -44855;
788 err_invalid_cldsvc   constant number := -44856;
789 err_nfound_cld       constant number := -44857;
790 err_remove_cld       constant number := -44858;
791 err_exist_GSM        constant number := -44859;
792 err_nfound_region    constant number := -44860;
793 err_remove_vncr      constant number := -44861;
794 err_buddy_region     constant number := -44862;
795 err_last_region      constant number := -44863;
796 err_remove_rgn_gsm   constant number := -44864;
797 err_remove_pool      constant number := -44865;
798 err_non_broker       constant number := -44866;
799 err_already_in_pool  constant number := -44867;
800 err_is_broker        constant number := -44868;
801 err_net_name         constant number := -44869;
802 err_svc_non_bc       constant number := -44870;
803 err_svc_non_pa       constant number := -44871;
804 err_db_same          constant number := -44872;
805 err_db_offer         constant number := -44873;
806 err_db_not_offer     constant number := -44874;
807 err_invalid_param    constant number := -44875;
808 err_svc_is_rng       constant number := -44876;
809 err_svc_is_dis       constant number := -44877;
810 err_svc_is_lag       constant number := -44878;
811 err_no_region        constant number := -44879;
812 err_no_cld           constant number := -44880;
813 err_nonempty_pool    constant number := -44881;
814 err_bad_dbp_name     constant number := -44882;
815 err_bad_region_name  constant number := -44883;
816 err_bad_svc_name     constant number := -44884;
817 err_bad_vncr_name    constant number := -44885;
818 err_bad_vncrgrp_name constant number := -44886;
819 err_bad_gsm_name     constant number := -44887;
823 err_nfound_gsm       constant number := -44891;
820 err_bad_gsmu_name    constant number := -44888;
821 err_exist_region     constant number := -44889;
822 err_exist_dbpool     constant number := -44890;
824 err_nfound_dbpool    constant number := -44892;
825 err_nfound_database  constant number := -44893;
826 err_nfound_service   constant number := -44894;
827 err_remove_rgn_db    constant number := -44895;
828 err_svc_in_pool      constant number := -44896;
829 err_svc_lag          constant number := -44897;
830 err_svc_failover     constant number := -44898;
831 err_exist_vncr       constant number := -44899;
832 err_string_size      constant number := -44900;
833 err_rem_db           constant number := -45500;
834 err_max_gsm          constant number := -45501;
835 err_no_priv          constant number := -45502;
836 err_db_incloud       constant number := -45503;
837 err_nopref_all       constant number := -45504;
838 err_max_service      constant number := -45505;
839 err_max_pools        constant number := -45506;
840 -- information messages for VerifyCatalog
841 err_no_buddy         constant number := -45507;
842 err_no_dbregion      constant number := -45508;
843 err_bad_dbstatus     constant number := -45509;
844 err_gsm_request      constant number := -45510;
845 err_no_preferred     constant number := -45511;
846 err_no_lcl_pref      constant number := -45512;
847 err_no_service       constant number := -45513;
848 err_no_dbreg         constant number := -45514;
849 err_no_gsm_reg       constant number := -45515;
850 err_pool_db          constant number := -45516;
851 err_pool_svc         constant number := -45517;
852 -- end information messages for VerifyCatalog
853 err_lag_lgsdby       constant number := -45518;
854 err_empty_dbpool     constant number := -45519;
855 err_loc_failover     constant number := -45520;
856 err_role_failover    constant number := -45521;
857 err_svc_relocate     constant number := -45522;
858 err_service_stopped  constant number := -45523;
859 err_need_dbp_name    constant number := -45524;
860 err_bad_retention    constant number := -45525;
861 err_bad_replay       constant number := -45526;
862 err_db_incompat      constant number := -45527;
863 err_svc_stopped      constant number := -45528;
864 err_db_spfile        constant number := -45529;
865 err_local_exists     constant number := -45530;
866 err_in_cloud         constant number := -45531;
867 err_is_cat           constant number := -45532;
868 err_service_change   constant number := -45533;
869 err_gsm_running      constant number := -45534;
870 err_unknown_catvers  constant number := -45535;
871 err_bad_gdscl_vers   constant number := -45536;
872 err_bad_gsmvers      constant number := -45537;
873 err_bad_dbvers       constant number := -45538;
874 err_add_to_pool      constant number := -45539;
875 err_srvctl_failed    constant number := -45540;
876 err_invalid_admin    constant number := -45541;
877 err_invalid_norac    constant number := -45542;
878 err_invalid_policy   constant number := -45543;
879 err_invalid_weight   constant number := -45544;
880 err_no_inst          constant number := -45545;
881 err_noproc           constant number := -45546;
882 err_srvctl_parms     constant number := -45547;
883 err_downg_db         constant number := -45548; -- Warning
884 err_no_curgsm        constant number := -45549;
885 err_nonexist_svc     constant number := -45550;
886 err_noexist_inst     constant number := -45551; -- Warning
887 err_no_del           constant number := -45552;
888 err_no_svc_inst      constant number := -45553;
889 err_no_svcs          constant number := -45554;
890 err_npa_db           constant number := -45555;
891 err_bad_disable      constant number := -45556;
892 err_empty_pool       constant number := -45557;
893 err_no_pools         constant number := -45558;
894 err_no_gsm_vers      constant number := -45559;
895 err_no_prefs         constant number := -45560;
896 err_no_region_name   constant number := -45561;
897 err_pdb_catalog      constant number := -45562;
898 err_pdb_pooldb       constant number := -45563;
899 err_cont_sleep       constant number := -45564;
900 err_old_gdsctl       constant number := -45568;
901 
902 generic_gsm       EXCEPTION;
903 PRAGMA EXCEPTION_INIT(generic_gsm,      -44850);
904 bad_db_name      EXCEPTION;
905 PRAGMA EXCEPTION_INIT(bad_db_name,      -44851);
906 region_max        EXCEPTION;
907 PRAGMA EXCEPTION_INIT(region_max,       -44852);
908 vncr_max          EXCEPTION;
909 PRAGMA EXCEPTION_INIT(vncr_max,         -44853);
910 exist_cld         EXCEPTION;
911 PRAGMA EXCEPTION_INIT(exist_cld,        -44854);
912 invalid_cld       EXCEPTION;
913 PRAGMA EXCEPTION_INIT(invalid_cld,      -44855);
914 invalid_cldsvc    EXCEPTION;
915 PRAGMA EXCEPTION_INIT(invalid_cldsvc,   -44856);
916 nfound_cld        EXCEPTION;
917 PRAGMA EXCEPTION_INIT(nfound_cld,       -44857);
918 remove_cld        EXCEPTION;
919 PRAGMA EXCEPTION_INIT(remove_cld,       -44858);
920 exist_GSM      EXCEPTION;
921 PRAGMA EXCEPTION_INIT(exist_GSM   ,     -44859);
922 nfound_region     EXCEPTION;
923 PRAGMA EXCEPTION_INIT(nfound_region,    -44860);
924 exremove_vncr     EXCEPTION;
925 PRAGMA EXCEPTION_INIT(exremove_vncr,    -44861);
926 buddy_region      EXCEPTION;
927 PRAGMA EXCEPTION_INIT(buddy_region,     -44862);
928 last_region       EXCEPTION;
929 PRAGMA EXCEPTION_INIT(last_region,      -44863);
930 remove_rgn_gsm        EXCEPTION;
931 PRAGMA EXCEPTION_INIT(remove_rgn_gsm,   -44864);
932 remove_pool       EXCEPTION;
933 PRAGMA EXCEPTION_INIT(remove_pool,      -44865);
934 non_broker        EXCEPTION;
935 PRAGMA EXCEPTION_INIT(non_broker,       -44866);
936 already_in_pool   EXCEPTION;
937 PRAGMA EXCEPTION_INIT(already_in_pool,  -44867);
938 is_broker         EXCEPTION;
939 PRAGMA EXCEPTION_INIT(is_broker,        -44868);
940 net_name          EXCEPTION;
941 PRAGMA EXCEPTION_INIT(net_name,         -44869);
942 svc_non_bc        EXCEPTION;
943 PRAGMA EXCEPTION_INIT(svc_non_bc,       -44870);
944 svc_non_pa        EXCEPTION;
945 PRAGMA EXCEPTION_INIT(svc_non_pa,       -44871);
946 db_same           EXCEPTION;
947 PRAGMA EXCEPTION_INIT(db_same,          -44872);
948 db_offer          EXCEPTION;
949 PRAGMA EXCEPTION_INIT(db_offer,         -44873);
950 db_not_offer      EXCEPTION;
951 PRAGMA EXCEPTION_INIT(db_not_offer,     -44874);
952 invalid_param     EXCEPTION;
953 PRAGMA EXCEPTION_INIT(invalid_param,    -44875);
954 svc_is_rng        EXCEPTION;
955 PRAGMA EXCEPTION_INIT(svc_is_rng,       -44876);
956 svc_is_dis        EXCEPTION;
957 PRAGMA EXCEPTION_INIT(svc_is_dis,       -44877);
958 svc_is_lag        EXCEPTION;
959 PRAGMA EXCEPTION_INIT(svc_is_lag,       -44878);
960 no_region         EXCEPTION;
961 PRAGMA EXCEPTION_INIT(no_region,        -44879);
962 no_cld         EXCEPTION;
963 PRAGMA EXCEPTION_INIT(no_cld   ,        -44880);
964 nonempty_pool         EXCEPTION;
965 PRAGMA EXCEPTION_INIT(nonempty_pool ,   -44881);
966 bad_dbp_name         EXCEPTION;
967 PRAGMA EXCEPTION_INIT(bad_dbp_name  ,   -44882);
968 bad_region_name         EXCEPTION;
969 PRAGMA EXCEPTION_INIT(bad_region_name , -44883);
970 bad_svc_name         EXCEPTION;
971 PRAGMA EXCEPTION_INIT(bad_svc_name  ,   -44884);
972 bad_vncr_name         EXCEPTION;
973 PRAGMA EXCEPTION_INIT(bad_vncr_name  ,  -44885);
974 bad_vncrgrp_name         EXCEPTION;
975 PRAGMA EXCEPTION_INIT(bad_vncrgrp_name, -44886);
976 bad_gsm_name         EXCEPTION;
977 PRAGMA EXCEPTION_INIT(bad_gsm_name  ,   -44887);
978 bad_gsmu_name         EXCEPTION;
979 PRAGMA EXCEPTION_INIT(bad_gsmu_name  ,  -44888);
980 exist_region         EXCEPTION;
981 PRAGMA EXCEPTION_INIT(exist_region   ,  -44889);
982 exist_dbpool         EXCEPTION;
983 PRAGMA EXCEPTION_INIT(exist_dbpool   ,  -44890);
984 nfound_gsm         EXCEPTION;
985 PRAGMA EXCEPTION_INIT(nfound_gsm     ,  -44891);
986 nfound_dbpool         EXCEPTION;
987 PRAGMA EXCEPTION_INIT(nfound_dbpool  ,  -44892);
988 nfound_database         EXCEPTION;
989 PRAGMA EXCEPTION_INIT(nfound_database,  -44893);
990 nfound_service        EXCEPTION;
991 PRAGMA EXCEPTION_INIT(nfound_service ,  -44894);
992 remove_rgn_db            EXCEPTION;
993 PRAGMA EXCEPTION_INIT(remove_rgn_db ,   -44895);
994 svc_in_pool            EXCEPTION;
995 PRAGMA EXCEPTION_INIT(svc_in_pool   ,   -44896);
996 svc_lag            EXCEPTION;
997 PRAGMA EXCEPTION_INIT(svc_lag       ,   -44897);
998 svc_failover            EXCEPTION;
999 PRAGMA EXCEPTION_INIT(svc_failover  ,   -44898);
1000 exist_vncr            EXCEPTION;
1001 PRAGMA EXCEPTION_INIT(exist_vncr    ,   -44899);
1002 string_size            EXCEPTION;
1003 PRAGMA EXCEPTION_INIT(string_size    ,  -44900);
1004 rem_db            EXCEPTION;
1005 PRAGMA EXCEPTION_INIT(rem_db    ,       -45500);
1006 max_gsm            EXCEPTION;
1007 PRAGMA EXCEPTION_INIT(max_gsm    ,      -45501);
1008 no_priv            EXCEPTION;
1009 PRAGMA EXCEPTION_INIT(no_priv    ,      -45502);
1010 db_incloud            EXCEPTION;
1011 PRAGMA EXCEPTION_INIT(db_incloud    ,   -45503);
1012 nopref_all            EXCEPTION;
1013 PRAGMA EXCEPTION_INIT(nopref_all    ,   -45504);
1014 max_service            EXCEPTION;
1015 PRAGMA EXCEPTION_INIT(max_service    ,  -45505);
1016 max_pools          EXCEPTION;
1017 PRAGMA EXCEPTION_INIT(max_pools    ,  -45506);
1018 empty_dbpool          EXCEPTION;
1019 PRAGMA EXCEPTION_INIT(empty_dbpool    ,  -45519);
1020 loc_failover          EXCEPTION;
1021 PRAGMA EXCEPTION_INIT(loc_failover    ,  -45520);
1022 role_failover          EXCEPTION;
1023 PRAGMA EXCEPTION_INIT(role_failover    ,  -45521);
1024 svc_relocate          EXCEPTION;
1025 PRAGMA EXCEPTION_INIT(svc_relocate    ,  -45522);
1026 svc_stopped          EXCEPTION;
1027 PRAGMA EXCEPTION_INIT(svc_stopped    ,  -45523);
1028 need_dbp_name         EXCEPTION;
1029 PRAGMA EXCEPTION_INIT(need_dbp_name   ,  -45524);
1030 bad_retention          EXCEPTION;
1031 PRAGMA EXCEPTION_INIT(bad_retention    ,  -45525);
1032 bad_replay        EXCEPTION;
1033 PRAGMA EXCEPTION_INIT(bad_replay    ,  -45526);
1034 db_incompat        EXCEPTION;
1035 PRAGMA EXCEPTION_INIT(db_incompat    ,  -45527);
1036 svc_stopped        EXCEPTION;
1037 PRAGMA EXCEPTION_INIT(svc_stopped    ,  -45528);
1038 db_spfile        EXCEPTION;
1039 PRAGMA EXCEPTION_INIT(db_spfile    ,  -45529);
1040 local_exists        EXCEPTION;
1041 PRAGMA EXCEPTION_INIT(local_exists    ,  -45530);
1042 in_cloud        EXCEPTION;
1043 PRAGMA EXCEPTION_INIT(in_cloud    ,  -45531);
1044 is_cat        EXCEPTION;
1045 PRAGMA EXCEPTION_INIT(is_cat    ,  -45532);
1046 service_change        EXCEPTION;
1047 PRAGMA EXCEPTION_INIT(service_change ,  -45533);
1048 gsm_running        EXCEPTION;
1049 PRAGMA EXCEPTION_INIT(gsm_running ,  -45534);
1050 unknown_catvers        EXCEPTION;
1051 PRAGMA EXCEPTION_INIT(unknown_catvers ,  -45535);
1052 bad_gdsctl_vers        EXCEPTION;
1053 PRAGMA EXCEPTION_INIT(bad_gdsctl_vers ,  -45536);
1054 bad_gsmvers        EXCEPTION;
1055 PRAGMA EXCEPTION_INIT(bad_gsmvers ,  -45537);
1056 bad_dbvers        EXCEPTION;
1057 PRAGMA EXCEPTION_INIT(bad_dbvers ,  -45538);
1058 add_to_pool       EXCEPTION;
1059 PRAGMA EXCEPTION_INIT(add_to_pool,       -45539);
1060 srvctl_failed       EXCEPTION;
1061 PRAGMA EXCEPTION_INIT(srvctl_failed,       -45540);
1062 invalid_admin       EXCEPTION;
1063 PRAGMA EXCEPTION_INIT(invalid_admin,       -45541);
1064 invalid_norac       EXCEPTION;
1065 PRAGMA EXCEPTION_INIT(invalid_norac,       -45542);
1066 invalid_policy      EXCEPTION;
1067 PRAGMA EXCEPTION_INIT(invalid_policy,       -45543);
1068 invalid_weight      EXCEPTION;
1069 PRAGMA EXCEPTION_INIT(invalid_weight,       -45544);
1070 no_inst      EXCEPTION;
1071 PRAGMA EXCEPTION_INIT(no_inst,       -45545);
1072 noproc      EXCEPTION;
1073 PRAGMA EXCEPTION_INIT(noproc,       -45546);
1074 srvctl_parms      EXCEPTION;
1075 PRAGMA EXCEPTION_INIT(srvctl_parms,       -45547);
1076 downg_db      EXCEPTION;
1077 PRAGMA EXCEPTION_INIT(downg_db,       -45548);
1078 no_curgsm      EXCEPTION;
1079 PRAGMA EXCEPTION_INIT(no_curgsm,       -45549);
1080 nonexist_svc      EXCEPTION;
1081 PRAGMA EXCEPTION_INIT(nonexist_svc,       -45550);
1082 noexist_inst      EXCEPTION;
1083 PRAGMA EXCEPTION_INIT(noexist_inst,       -45551);
1084 no_del      EXCEPTION;
1085 PRAGMA EXCEPTION_INIT(no_del,       -45552);
1086 no_svc_inst      EXCEPTION;
1087 PRAGMA EXCEPTION_INIT(no_svc_inst,       -45553);
1088 no_svcs     EXCEPTION;
1089 PRAGMA EXCEPTION_INIT(no_svcs,       -45554);
1090 npa_db      EXCEPTION;
1091 PRAGMA EXCEPTION_INIT(npa_db,       -45555);
1092 bad_disable      EXCEPTION;
1093 PRAGMA EXCEPTION_INIT(bad_disable,       -45556);
1094 empty_pool      EXCEPTION;
1095 PRAGMA EXCEPTION_INIT(empty_pool,       -45557);
1096 no_pools      EXCEPTION;
1097 PRAGMA EXCEPTION_INIT(no_pools,       -45558);
1098 no_gsm_vers      EXCEPTION;
1099 PRAGMA EXCEPTION_INIT(no_gsm_vers,       -45559);
1100 no_prefs      EXCEPTION;
1101 PRAGMA EXCEPTION_INIT(no_prefs,       -45560);
1102 no_region_name      EXCEPTION;
1103 PRAGMA EXCEPTION_INIT(no_region_name,       -45561);
1104 pdb_catalog        EXCEPTION;
1105 PRAGMA EXCEPTION_INIT(pdb_catalog,       -45562);
1106 pdb_pooldb        EXCEPTION;
1107 PRAGMA EXCEPTION_INIT(pdb_pooldb,       -45563);
1108 cont_sleep            EXCEPTION;
1109 PRAGMA EXCEPTION_INIT(cont_sleep    ,      -45564);
1110 END dbms_gsm_utility;