$!----------------------------------------------------------------------------! $! $! MODULE: CDD$UPGRADE.COM $! $!----------------------------------------------------------------------------! $! $! Copyright (c) Oracle Corporation 1991, 1999. All rights reserved. $! $!----------------------------------------------------------------------------! $! $! Functional Description: $! $! This procedure is used to convert dictionaries to V5.n. $! $! Arguments: $! P1 - Anchor spec - the OpenVMS anchor of the repository $! to be updated $! $! P2 - are you satisfied with the backup of your repository $! $! P3 - Current repository version $! (V5, V4, V50, V51, J51, V52, V53, V61, V70) $! $! P4 - Only do an export (Y, N) $! $! P5 - output defaults to TT: $! $! P6 - Do you want to give [*,*] all access? $! $! SYSPRV, ownership, or read & write access to the dictionary $! directory files is required. $! $! Created: 6-MAR-1991 $! $!-- $ set on $ ON control_y THEN goto CTRL_Y_ABORT $ ON warning THEN GOTO INCOMPLETE $ ON error THEN GOTO FAILURE $ set_prot_flag = "N" $!~ $! Check for architecture type $! Requires at least OpenVMS 5.4-2 $!~ $ CDD$PLATFORM == F$EDIT (F$GETSYI ("ARCH_NAME"), "TRIM,UPCASE") $ $!+ $! define symbols $!- $ wr := "WRITE SYS$OUTPUT" $ rdo := $SYS$SYSTEM:RDO $!+ $! save users current logicals & set performance tuning params $!- $ rdm$$bind_buffers = f$logical("RDM$BIND_BUFFERS") $ cdd$$max_objects_in_mem = f$logical("CDD$MAX_OBJECTS_IN_MEMORY") $ define/nolog RDM$BIND_BUFFERS 200 $ define/nolog CDD$MAX_OBJECTS_IN_MEMORY 50000 $ if p5 .nes. "" .and. P5 .nes. " " then wr := "!" $ wr "" $ wr " CDD$UPGRADE.COM" $ wr "" $ wr " This procedure is used to upgrade repositories that were created" $ wr " under a previous version of Oracle CDD/Repository." $ wr "" $!+ $! read parameters $!- $CHECK_P1: $ IF P1 .eqs. "" then goto INQUIRE_P1 $!~ $! Get rid of .][ in rooted logicals $!~ $ PARSE_ANCHOR: $ cdd$dict_anchor = P1 $ 7912A$: $!+ $! translate the name, remove the .; & any ][ that result from the translation $!- $ cdd$dict_anchor = f$parse (cdd$dict_anchor,"[...]") $ cdd$dict_anchor = f$extract(0,f$length(cdd$dict_anchor)-2,cdd$dict_anchor) $ cdd$count = f$locate("][",cdd$dict_anchor) $ cdd$curr_len = f$length(cdd$dict_anchor) $ if cdd$count .gt. cdd$curr_len then goto PARSE_COMPLETE $ cdd$tmp1 = f$extract (0,cdd$count,cdd$dict_anchor) $ cdd$tmp2 = f$extract (cdd$count+2,cdd$curr_len,cdd$dict_anchor) $ cdd$dict_anchor := 'cdd$tmp1''cdd$tmp2' $ P1 = cdd$dict_anchor $PARSE_COMPLETE: $ if P1 .nes. "" then goto CHECK_CDDX $ INQUIRE_P1: $ wr := "WRITE SYS$OUTPUT" $ wr "" $ wr " Please enter the OpenVMS anchor of the repository to be upgraded." $ wr "" $ inquire P1 " DEVICE:[DIRECTORY] " $ goto CHECK_P1 $! $CHECK_CDDX: $ export_file := 'f$parse("CDD$UPGRADE.CDDX",P1)' $ if f$search (export_file) .eqs. "" then goto CHECK_P2 $! $CHECK_P6: $ if P6 .eqs. "Y" .or. P6 .eqs. "y" then goto SET_PROT_FLAG_YES $ if P6 .eqs. "N" .or. P6 .eqs. "n" then goto SET_PROT_FLAG_NO $ ! Otherwise, if param was not passed in then, inquire. $ ! $INQUIRE_P6: $!+ $! Check if the repository's acl should give [*,*] READ/WRITE access. $!- $ wr "" $ wr " By default, all users [*,*] will have READ-ONLY access to this " $ wr " repository. Do you want to give all users READ/WRITE access to " $ wr " this repository? [ Y | N ] " $ wr "" $ inquire P6 " [ Y ] " $ if P6 .eqs. "Y" .or. P6 .eqs. "y" .or. P6 .eqs. "" then - goto SET_PROT_FLAG_YES $ ! else $ goto SET_PROT_FLAG_NO $! $SET_PROT_FLAG_YES: $ set_prot_flag = "Y" $ GOTO CHECK_PROT_FLAG $ ! $SET_PROT_FLAG_NO: $ set_prot_flag = "N" $ GOTO CHECK_PROT_FLAG $ ! $CHECK_PROT_FLAG: $!+ $! If the user said 'yes', let them know the potential for failure if there are $! distributed repositories involved. $!- $ if set_prot_flag .eqs. "Y" $ then $ wr "" $ wr " Note: If this repository is linked to other repositories, the" $ wr " DEFINE PROTECTION command will fail if all linked repositories" $ wr " have not yet been upgraded. In this case the command would need" $ wr " to be entered manually in CDO after all linked repositories have" $ wr " been upgraded. $ wr "" $ endif $! $! $ wr "" $ wr " CDD$UPGRADE.CDDX file found in ''P1'." $ wr " Skipping EXPORT and proceeding directly to IMPORT" $ wr "" $ wr " There are no more questions." $ wr "" $ goto IMPORT $ $CHECK_P2: $ if P2 .eqs. "Y" then goto CHECK_P3 $ if P2 .eqs. "y" then goto CHECK_P3 $ if P2 .eqs. "N" then goto BACKUP $ if P2 .eqs. "n" then goto BACKUP $ wr := "WRITE SYS$OUTPUT" $ wr "" $ inquire P2 " Are you satisfied with the backup of your repository? [Y/N] (N)" $ if p2 .eqs. "" then P2 = "N" $ goto CHECK_P2 $ $CHECK_P3: $ if CDD$PLATFORM .EQS. "VAX" then goto V_CHECK_P3 $! ** ALPHA PLATFORM ** $A_CHECK_P3: $ if P3 .eqs. "V52" then goto CONVERT_DICTIONARY $ if P3 .eqs. "v52" then goto CONVERT_DICTIONARY $ if P3 .eqs. "V53" then goto CONVERT_DICTIONARY $ if P3 .eqs. "v53" then goto CONVERT_DICTIONARY $ if P3 .eqs. "V61" then goto CONVERT_DICTIONARY $ if P3 .eqs. "v61" then goto CONVERT_DICTIONARY $ if P3 .eqs. "V70" then goto CHECK_P4 $ if P3 .eqs. "v70" then goto CHECK_P4 $ P3 = "V52" $A_INQUIRE_P3: $ wr := "WRITE SYS$OUTPUT" $ wr " $ wr " -------------------------------------------------------- " $ wr " What version are you upgrading this repository from? " $ wr " " $ wr " (If you are only exporting the repository, what " $ wr " version is the repository you are exporting?) " $ wr " " $ wr " Note: Upgrade is not required from V6.1 to V7.0. " $ wr " " $ wr " [ V52 | V53 | V61 | V70] " $ wr " -------------------------------------------------------- " $ wr " " $ inquire P3 " [V70] " $! default to V7.0 $ if P3 .eqs. "" then P3 = "V70" $ goto A_CHECK_P3 $! ** VAX PLATFORM ** $V_CHECK_P3: $! No need to ask if it's V4 $ if P3 .eqs. "V4" then goto CHECK_P4 $ if P3 .eqs. "v4" then goto CHECK_P4 $! If it's V5 then we need to know V50 or V51 or V53 $ if P3 .eqs. "V50" then goto CONVERT_DICTIONARY $ if P3 .eqs. "v50" then goto CONVERT_DICTIONARY $ if P3 .eqs. "J51" then P3 = "V51" $ if P3 .eqs. "j51" then P3 = "V51" $ if P3 .eqs. "V51" then goto CONVERT_DICTIONARY $ if P3 .eqs. "v51" then goto CONVERT_DICTIONARY $ if P3 .eqs. "V52" then goto NO_VAX_V52 $ if P3 .eqs. "v52" then goto NO_VAX_V52 $ if P3 .eqs. "V53" then goto CONVERT_DICTIONARY $ if P3 .eqs. "v53" then goto CONVERT_DICTIONARY $ if P3 .eqs. "V61" then goto CONVERT_DICTIONARY $ if P3 .eqs. "v61" then goto CONVERT_DICTIONARY $ if P3 .eqs. "V70" then goto CHECK_P4 $ if P3 .eqs. "v70" then goto CHECK_P4 $ P3 = "V4" $ contexts_dir := 'f$parse("CONTEXTS.DIR", P1)' $ if f$search (contexts_dir) .nes. "" then P3 = "V5" $ if P3 .eqs. "V4" then goto CHECK_P4 $V_INQUIRE_P3: $ wr := "WRITE SYS$OUTPUT" $ wr " " $ wr " -------------------------------------------------------- " $ wr " What version are you upgrading this repository from? " $ wr " " $ wr " (If you are only exporting the repository, what " $ wr " version is the repository you are exporting?) " $ wr " " $ wr " Note: Upgrade is not required from V6.1 to V7.0. " $ wr " " $ wr " [ V50 | V51 | J51 | V53 | V61 | V70 ] " $ wr " -------------------------------------------------------- " $ wr " " $ inquire P3 " [V70] " $! default to V7.0 $ if P3 .eqs. "" then P3 = "V70" $ goto V_CHECK_P3 $ $NO_VAX_V52: $ wr := "WRITE SYS$OUTPUT" $ wr "" $ wr " Invalid repository version number. V5.2 was an OpenVMS Alpha $ wr " platform release only." $ wr "" $ goto V_INQUIRE_P3 $CHECK_P4: $ if P4 .eqs. "Y" then goto EXPORT $ if P4 .eqs. "y" then goto EXPORT $ if P4 .eqs. "N" then goto EXPORT $ if P4 .eqs. "n" then goto EXPORT $ wr := "WRITE SYS$OUTPUT" $ wr "" $ wr " Do you ONLY want to perform an EXPORT of this repository? [ Y | N ]" $ wr "" $ inquire P4 " [ N ] " $ if p4 .eqs. "" then P4 = "N" $ goto CHECK_P4 $ $CONVERT_DICTIONARY: $! $ ask_continue == 0 $! Check the system's virtual page count and warn them if it's below 200K $! $ virtual_page = F$GETSYI("VIRTUALPAGECNT") $ node_name = F$GETSYI("NODENAME") $ if virtual_page .lt. 200000 $ then $ ask_continue == 1 $ wr " " $ wr " The system parameter VIRTUALPAGECNT on ''node_name' " $ wr " is set to ''virtual_page'. Under 200000 will cause " $ wr " the upgrade to be slow. Under 100000 may cause " $ wr " the upgrade to fail with insufficient virtual memory " $ wr " errors. " $ wr " " $ wr " The recommended course of action would be to answer " $ wr " 'N' to the following prompt, which asks if you wish " $ wr " to continue, and then to either reboot this system " $ wr " with a VIRTUALPAGECNT of approximately 200000, or " $ wr " else to run the upgrade on a system that has this " $ wr " parameter set to 200000 or higher. " $ wr " " $ endif $! $ if ask_continue .eqs. 1 $ then $! $ wr := "WRITE SYS$OUTPUT" $ wr " " $ wr " Do you want to continue the upgrade of this repository? [ Y | N ]" $ wr " " $ inquire yes_or_no " [ N ]" $ if yes_or_no .eqs. "" then goto INCOMPLETE $ if yes_or_no .eqs. "N" then goto INCOMPLETE $ if yes_or_no .eqs. "n" then goto INCOMPLETE $ endif $! $ wr "" $ wr " There are no more questions." $ wr "" $ wr " Converting repository ''P1' to V7.0... " $ wr "" $ define/user sys$command sys$input $ DICTIONARY OPERATOR CONVERT/DICTIONARY 'p1' y $ cddx$$status = $status $ if .not. cddx$$STATUS then goto FAILURE $!~ $! All Done $! $ goto FINISHED $EXPORT: $! $EXPORT_CHECK_P6: $ if P6 .eqs. "Y" .or. P6 .eqs. "y" then goto EXPORT_SET_PROT_FLAG_YES $ if P6 .eqs. "N" .or. P6 .eqs. "n" then goto EXPORT_SET_PROT_FLAG_NO $ ! Otherwise, if param was not passed in then, inquire. $ ! $EXPORT_INQUIRE_P6: $!+ $! Check if the repository's acl should give [*,*] READ/WRITE access. $!- $ wr "" $ wr " By default, all users [*,*] will have READ-ONLY access to this " $ wr " repository. Do you want to give all users READ/WRITE access to " $ wr " this repository? [ Y | N ] " $ wr "" $ inquire P6 " [ Y ] " $ if P6 .eqs. "Y" .or. P6 .eqs. "y" .or. P6 .eqs. "" then - goto EXPORT_SET_PROT_FLAG_YES $ ! else $ goto EXPORT_SET_PROT_FLAG_NO $! $EXPORT_SET_PROT_FLAG_YES: $ set_prot_flag = "Y" $ GOTO EXPORT_CHECK_PROT_FLAG $ ! $EXPORT_SET_PROT_FLAG_NO: $ set_prot_flag = "N" $ GOTO EXPORT_CHECK_PROT_FLAG $ ! $EXPORT_CHECK_PROT_FLAG: $ if set_prot_flag .eqs. "Y" $ then $ wr "" $ wr " Note: If this repository is linked to other repositories, the" $ wr " DEFINE PROTECTION command will fail if all linked repositories" $ wr " have not yet been upgraded. In this case the command would need" $ wr " to be entered manually in CDO after all linked repositories have" $ wr " been upgraded. $ wr "" $ endif $! $! $!~ $! Determine pgflquota needed and see if user has enough $!~ $ cdd$actual_pgfil == 0 $ cdd$export_file_size == 0 $ !~ $ ! Estimate amount of space needed for export file $ !~ $ if P3 .eqs. "V4" $ then $ cdd$export_file_size == 2000 $ cdd$$rdb_file := 'f$parse ("CDD$DATABASE.RDB",P1)' $ cdd$$rdb_file_size = f$file_attributes(cdd$$rdb_file, "EOF") $ else $ cdd$export_file_size == 10000 $ cdd$$rda_file_1 := 'f$parse ("CDD$DATA.RDA",P1)' $ cdd$$rda_file_2 := 'f$parse ("CDD$DATABASE.RDA",P1)' $ cdd$$rdb_file_size_1 := 'f$file_attributes(cdd$$rda_file_1, "EOF")' $ cdd$$rdb_file_size_2 := 'f$file_attributes(cdd$$rda_file_2, "EOF")' $ cdd$$rdb_file_size = '('cdd$$rdb_file_size_1'+'cdd$$rdb_file_size_2')' $ endif $ !~ $ ! ** FORMULA ** MAX(CDD$DATABASE.RDB/2 OR 10k-V5 OR 2k-V4) $ ! note this is just an estimate and is not foolproof $ !~ $ if (cdd$$rdb_file_size/2) .gt. cdd$export_file_size $ then $ cdd$export_file_size == cdd$$rdb_file_size/2 $ endif $ $ !~ $ ! Figure out whether the user has enough pagefile quota $ ! for upgrade - if he doesn't default to NO for the upgrade $ ! $ ! ** FORMULA ** MAX(CDD$DATABASE.RDB + 20 OR 50000) $ ! note this is just an estimate and is not foolproof $ !~ $ cdd$pgfil_needed_for_export = 50000 $ if cdd$$rdb_file_size .gt. 20000 then cdd$pgfil_needed_for_export = 70000 $ if cdd$$rdb_file_size .gt. 35000 then cdd$pgfil_needed_for_export =100000 $ if cdd$$rdb_file_size .gt. 55000 then cdd$pgfil_needed_for_export =200000 $ cdd$actual_pgfil == f$getjpi("","PGFLQUOTA") $ ! $ ask_continue == 0 $ IF cdd$pgfil_needed_for_export .gt. cdd$actual_pgfil $ THEN $ !~ $ ! Tell the user they might more pagefilquota in order to $ ! export - tell them to either cancel this installation $ ! or say no to UPgrade and IVP and run them separate from $ ! the installation $ !~ $ ask_continue == 1 $ if cdd$pgfil_needed_for_export .eq. 200000 $ then $ wr "" $ wr " *************************************************************" $ wr " " $ wr " The size of your repository ''P1' " $ wr " may require an increase of the process account quota " $ wr " PGFLQUOTA to 200000 or higher. " $ wr " Please note that this is a minimum requirement recommendation." $ wr " You should cancel this upgrade and increase the " $ wr " PGFLQUOTA to the recommended range. " $ wr " " $ wr " *************************************************************" $ else $ wr "" $ wr " *************************************************************" $ wr "" $ wr " The size of your repository ''P1' " $ wr " may require an increase of the process account quota " $ wr " PGFLQUOTA to between ''cdd$pgfil_needed_for_export' " $ wr " and 200000. " $ wr " Please note that this is a minimum requirement recommendation." $ wr " You should cancel this upgrade and increase the " $ wr " pgflquota to the recommended range." $ wr "" $ wr " *************************************************************" $ wr "" $ $ endif $ endif $!~ $! Check for enough disk space $!~ $ cdd$dict_dev = f$parse (P1,,, "device", "no_conceal") $ if cdd$export_file_size .gt. f$getdvi (cdd$dict_dev, "freeblocks") $ then $ wr "" $ wr "********************************************************" $ wr "" $ wr " Upgrade of ''P1' may fail because of insufficient disk " $ wr " space on device ''cdd$dict_dev'." $ wr " ''cdd$export_file_size' free blocks required." $ wr "" $ wr "********************************************************" $ wr "" $ ask_continue == 1 $ endif $ if .not. ask_continue then goto DO_EXPORT $!~ $! Ask the user if they want to continue $!~ $CONTINUE_EXPORT: $ wr := "WRITE SYS$OUTPUT" $ wr "" $ wr " Do you want to continue the EXPORT of this repository? [ Y | N ]" $ wr "" $ inquire yes_or_no " [ N ] " $ if yes_or_no .eqs. "Y" then goto DO_EXPORT $ if yes_or_no .eqs. "y" then goto DO_EXPORT $ if yes_or_no .eqs. "" then goto INCOMPLETE $ if yes_or_no .eqs. "N" then goto INCOMPLETE $ if yes_or_no .eqs. "n" then goto INCOMPLETE $ goto CONTINUE_EXPORT $ $ DO_EXPORT: $ wr "" $ wr " There are no more questions." $ wr "" $ wr " Exporting repository ''P1'..." $ wr "" $ if P3 .eqs. "V4" then goto EXPORT_V4 $ if P3 .eqs. "v4" then goto EXPORT_V4 $ $ define/user cdd$separator "/" $ dictionary export/version='P3'/schema 'P1' 'export_file' $ cddx$$status = $status $ if .not. cddx$$STATUS then goto FAILURE $ goto DELETE_FILES $ $EXPORT_V4: $ define/user sys$command sys$input $ define/user cdd$separator "/" $ DICTIONARY EXPORT/VERSION='P3'/CONVERT/SCHEMA 'P1' 'export_file' y $ cddx$$status = $status $ if .not. cddx$$STATUS then goto FAILURE $ $DELETE_FILES: $!+ $! delete old dictionary $!- $ cddx$$status = $status $ if .not. cddx$$STATUS then goto FAILURE $ cdd$current_default := 'f$environment("DEFAULT")' $ set default 'P1' $ pass = 0 $DELETE_FILES2: $ pass = pass + 1 $ deletexxx/exclude=(*.BAK,*.CDDX) [...]*.*; $ cddx_file = f$search ("CDD$UPGRADE.CDDX") $! Default it if the file is not there so the search will move on $ IF cddx_file .eqs. "" THEN cddx_file = "CDD$UPGRADE.CDDX" $ BAK_file = f$search ("CDD$UPGRADE.BAK") $! Default it if the file is not there so the search will move on $ IF BAK_file .eqs. "" THEN BAK_file = "CDD$UPGRADE.BAK" $SEARCH_FILES: $ rep_files = f$search ("[...]*.*;",'pass') $ if rep_files .eqs. cddx_file then goto SEARCH_FILES $ if rep_files .eqs. BAK_file then goto SEARCH_FILES $ if rep_files .nes. "" then goto DELETE_FILES2 $ set default 'cdd$current_default' $ $ if P4 .eqs. "Y" then goto EXPORT_ONLY $ if P4 .eqs. "y" then goto EXPORT_ONLY $ $IMPORT: $ wr "" $ wr " Importing into repository ''P1'..." $ wr "" $!+ $! set params for better performance $!- $ define/user CDD$WAIT EXCLUSIVE $ DICTIONARY IMPORT 'export_file' 'P1' $ cddx$$status = $status $ if .not. cddx$$status then goto FAILURE $ deletexxx 'export_file' $ export_binaries_file := 'f$parse("CDD$UPGRADE.BAK",P1)' $ if f$search (export_binaries_file) .nes. "" then deletexxx 'export_binaries_file' $ $FINISHED: $!+ $! All done $!- $ wr "" $ wr " CDD$UPGRADE completed successfully." $ wr "" $! $ if set_prot_flag .eqs. "Y" then goto SET_WORLD_READ_ACCESS $ if set_prot_flag .eqs. "N" then goto CLEANUP $! $SET_WORLD_READ_ACCESS: $ on error then goto NO_SET_PROT $! $ define/user cdd$default cdd$top $ dictionary operator define protection for repository 'P1' - position 15 ident [*,*] access change+show+define. $ define/user cdd$default cdd$top $ dictionary operator define protection for repository 'P1' - position 15 ident [*,*] default_access all. $ goto CLEANUP $! $!+ $! Handle errors $!- $NO_SET_PROT: $ wr "" $ wr " Unable to set protection on repository. " $ wr " Refer to previous messages for cause of error." $ wr "" $ goto CLEANUP $! $EXPORT_ONLY: $ wr "" $ wr " Repository was successfully exported. $ wr "" $ goto INCOMPLETE $! $BACKUP: $ wr "" $ wr " Backup your repository at this time and rerun this procedure." $ wr "" $ goto INCOMPLETE $! $INCOMPLETE: $ cddx$$status = $status $ wr "" $ wr " *** CDD$UPGRADE did not complete ***" $ wr " Refer to previous message for further explanation." $ wr "" $ goto CLEANUP $! $FAILURE: $ cddx$$status = $status $ wr "" $ wr " *** CDD$UPGRADE failed. ***" $ wr " Refer to previous message for cause of error." $ wr "" $! $CLEANUP: $ set noon $ if rdm$$bind_buffers .nes. "" $ then $ define/nolog RDM$BIND_BUFFERS "''rdm$$bind_buffers'" $ else $ deassign RDM$BIND_BUFFERS $ endif $ if cdd$$max_objects_in_mem .nes. "" $ then $ define/nolog CDD$MAX_OBJECTS_IN_MEMORY "''cdd$$max_objects_in_mem'" $ else $ deassign CDD$MAX_OBJECTS_IN_MEMORY $ endif $ EXIT cddx$$status .or. %x10000000 $! $CTRL_Y_ABORT: $ set noon $ if rdm$$bind_buffers .nes. "" $ then $ define/nolog RDM$BIND_BUFFERS "''rdm$$bind_buffers'" $ else $ deassign RDM$BIND_BUFFERS $ endif $ if cdd$$max_objects_in_mem .nes. "" $ then $ define/nolog CDD$MAX_OBJECTS_IN_MEMORY "''cdd$$max_objects_in_mem'" $ else $ deassign CDD$MAX_OBJECTS_IN_MEMORY $ endif $ write sys$output "" $ write sys$output " UPGRADE aborted by CTRL/Y" $ write sys$output "" $ EXIT 0 .or. %x10000000