diff --git a/.gitignore b/.gitignore index 5b17f33..5bc5760 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,15 @@ - .DS_Store -main.retry +*.log *.txt -*.log \ No newline at end of file +/user_scripts/report/* +config_oci_dev.yml +config_oci_leg.yml +config_oci_prd.yml +config_oci_stg.yml +config_oci.yml +loader_uploads.yml +main.retry +tasks/main_loader_uploads.yml +user_scripts_old/odbfcl/sh_extractor.*/build_zip.sh +user_scripts_old/odbfcl/sh_extractor.*/oradiff_exporter/* +user_scripts/odbfcl/oradiff_exporter.zip diff --git a/README.md b/README.md index ccb1cd3..0af54d2 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,21 @@ Using VirtualBox VM snapshots, the playbook will loop over a list of the availab ## Available version ## -The playbook was tested and is currently working for all PSUs, OJVM PSUs, Bundle Patches, RUs or RURs for the following versions: +The playbook was tested and is currently working for all PSUs, OJVM PSUs, Bundle Patches, RUs, RURs and MRPs for the following versions: +- 11.1.0.6 +- 11.1.0.7 +- 11.2.0.1 +- 11.2.0.2 +- 11.2.0.3 - 11.2.0.4 - 12.1.0.1 - 12.1.0.2 - 12.2.0.1 - 18 - 19 +- 21 +- 23 _P.S: For details of versions and patches that are processed, check list_versions.yml and list_patches.yml files._ @@ -78,5 +85,5 @@ _P.S: Note that all the 5 parameters above are independent._ * Passwordless SSH connection to VM user. * Passwordless sudo to root for VM user. * A shared folder between your machine and the VirtualBox VM must exists and properly configured in config_vars.yml. -* Base Image used for each release must already have latest OPatch version. +* Base Image used for each release. * VM must be configured to have the network interface auto-started as soon as snapshot is loaded. diff --git a/ansible.cfg b/ansible.cfg index fa8af7a..d4f50a0 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -20,7 +20,7 @@ log_path = main.log retry_files_enabled = False   # default ssh user -remote_user = rodrigo +remote_user = opc # connection timeout timeout = 30 diff --git a/config_main.yml b/config_main.yml new file mode 100644 index 0000000..68be7a3 --- /dev/null +++ b/config_main.yml @@ -0,0 +1,17 @@ +# OCI Mode? If true, script will load and run in OCI move, otherwise, VBox. +oci_mode : true + +# This parameter will skip execution for patches that already have a dump file generated in "dump_folder" ("output_folder"/expdp). +skip_dump_exists: true + +# If true, will only deploy the patch and skip the expdp and the pre/post steps. +only_deploy_patch: false + +# Target DB version where dumps will be imported +target_db_version: 19 # Used to check if version parameter will be required on expdp + +# Download Mode? If true, script will try to download the patch listed in list_patches.yml if not found in "patch_location_path". +download_patch : false + +# Stop when patch zip is not found? Control if the code will fail or just skip that patch. +error_on_no_patch : true diff --git a/config_oci.yml b/config_oci.yml new file mode 100644 index 0000000..2dcc2d5 --- /dev/null +++ b/config_oci.yml @@ -0,0 +1,68 @@ +# Patch location type: Can be "folder" or "bucket" +# Patch location path: Can be the local folder path or the bucket name. +# Folder where the database patches are placed. The patches can also be placed in sub-folders of the directory specified below. +patch_location_type : bucket +patch_location_path : patches + +# Folder in RW mode on local compute and shared with the VM. It is used to move the patches to the VMs and also to copy back the expdp output. +stage_folder : "/u01/patch_automation/stage" +shared_mount : "/u02" +shared_folder : "/u02/prd" + +# Path of the folder mounted within the VM. This is the path of the "shared_folder" in the VM. +VM_mount : "/u02" +VM_folder : "/u02/prd" + +# Oracle SID of the database that we are collecting data from. Must be included in /etc/oratab for oraenv utility. +default_sid : "orcl" + +# Folder to store the final generated files. +output_folder : "/u01/patch_automation/output" + +# Download utility info, if you are using one. +# wget https://github.com/MarisElsins/getMOSPatch/raw/master/getMOSPatch.jar +downloader_tool : "/u01/patch_automation/getMOSPatch.jar" +downloader_user : "" +downloader_pass : "" + +# Files in "user_scripts" folder that will run before and after the final expdp. script_types can be "shell", "sql" or "yml". +user_expdp_pre : +- { file : "runExtractor.yml" , folder : "user_scripts/odbfcl" , type : "yml", task_action : "Collect DB Info" } +- { file : "externalDir.yml" , type : "yml" , task_action : "Create External Directory" } + +user_expdp_post : +- { file : "def_adb_variables.yml" , folder : "user_scripts/odbfcl" , type : "yml", task_action : "Define ansible ADB variables" } +- { file : "adb_load_expdp.yml" , folder : "user_scripts/odbfcl/adb_load_expdp" , type : "yml", task_action : "impdp files from OS to ADB" } +- { file : "diff_calculate.yml" , folder : "user_scripts/odbfcl/diff_calculate" , type : "yml", task_action : "Generate differences between 2 releases" } + +# User that will hold your tables outputs and be exported after each execution. If the database is CDB, "C##" will be automatically be appended. +dump_user : hash +dump_pass : hash +dump_dir_name : expdir_hash + +# OCI Information to deploy VM +oci_compartment_id : ocid1.compartment.oc1..xxx + +# OCI Information to upload objects to OS +oci_namespace: xxx +oci_adb_bucket: xxx + +# OCI Information to connect and load in ADB +oci_adb_user: xxx +oci_adb_pass: xxx +oci_adb_tns: xxx_tp +oci_adb_credential: XXX +oci_adb_os_url_prefix: https://objectstorage.us-ashburn-1.oraclecloud.com/n/xxx/b/xxx/o +oci_adb_use_wallet: true + +########################### +### For loader.yml only ### +########################### + +# Files in "user_scripts" folder that will run before and after the final expdp. +user_impdp_pre : +- { file : "pre_prepare_dump_file.yml" , folder : "user_scripts/odbfcl/adb_load_expdp" , type : "yml", task_action : "Prepare files for impdp" } + +user_impdp_post : +- { file : "post_remove_dump_file.yml" , folder : "user_scripts/odbfcl/adb_load_expdp" , type : "yml", task_action : "Clean files used for impdp" } +- { file : "mark_dump_file_loaded.yml" , folder : "user_scripts/odbfcl/adb_load_expdp" , type : "yml", task_action : "Mark dpfile as loaded." } diff --git a/config_vars.yml b/config_vbox.yml similarity index 80% rename from config_vars.yml rename to config_vbox.yml index a6f73cd..5cced11 100644 --- a/config_vars.yml +++ b/config_vbox.yml @@ -1,17 +1,18 @@ # Folder where the database patches are placed. The patches can also be placed in sub-folders of the directory specified below. -source_folder : "/Volumes/Untitled/Rodrigo/ORACHKSUM/DB\ Install" +patch_location_type : folder +patch_location_path : "/Volumes/Untitled/Rodrigo/ORACHKSUM/DB\ Install" -# Folder in RW mode on your compute shared with VM to process files. +# Folder in RW mode on local compute and shared with the VM. It is used to process the files. shared_folder : "/Users/rodrigo.jorge/Desktop/extract" # Path of the folder mounted within the VM. VM_folder : "/media/sf_Patch/" # Oracle SID. Must be included in /etc/oratab for oraenv utility. -mysid : "orcl" +default_sid : "orcl" -# Folder to store the final generated DB dump -dump_folder : "/Volumes/Samsung_T3/OraSum/files/exp" +# Folder to store the final generated files. It must contain the subfolder expdp +output_folder : "/Volumes/Samsung_T3/OraSum/files" # Files in "user_scripts" folder that will run before and after the final expdp. script_types can be "shell", "sql" or "yml". user_expdp_pre : @@ -30,9 +31,6 @@ dump_user : hash # User pass dump_pass : hash -# This parameter will skip execution for patches that already have a dump file generated in "dump_folder". -skip_dump_exists: true - ########################### ### For loader.yml only ### ########################### @@ -49,4 +47,5 @@ user_impdp_pre : user_impdp_post : - { file : "fileLoad.yml" , folder : "user_scripts/load" , type : "yml" , task_action : "Load chksum table" } -- { file : "insert_all_exec.sql" , folder : "user_scripts/load" , type : "sql" , task_action : "Create consolidated tables" } \ No newline at end of file +- { file : "insert_all_exec.sql" , folder : "user_scripts/load" , type : "sql" , task_action : "Create consolidated tables" } +- { file : "changed_object.sql" , folder : "user_scripts/report" , type : "sql" , task_action : "Create list of changed objects" } \ No newline at end of file diff --git a/examples.sh b/examples.sh new file mode 100644 index 0000000..2aaf573 --- /dev/null +++ b/examples.sh @@ -0,0 +1,20 @@ +ansible-playbook main.yml --extra-vars "param_type=OJVM" +ansible-playbook main.yml --extra-vars "param_version=12.1.0.2 param_patch=191015" +ansible-playbook main.yml --extra-vars "param_version=18.0.0.0 param_type=OJVM param_patch=190716" +ansible-playbook main.yml --extra-vars "param_version=12.2.0.1 param_type=RU param_patch=191015" +### +while true +do + ssh rodrigo@192.168.56.101 '(ps -fu oracle | grep -q pmon) && printf "set lines 10000 pages 10000\nselect count(*) from dba_objects;" | sudo su - oracle -c "sqlplus / as sysdba"' + sleep 60 +done +### +while true +do + #ansible-playbook main.yml --extra-vars "param_version=19.0.0.0" + ansible-playbook main.yml + ret=$? + [ $ret -eq 0 ] && break +done +### +ansible-playbook loader.yml \ No newline at end of file diff --git a/files/ocm.rsp b/files/ocm.rsp old mode 100755 new mode 100644 diff --git a/list_exceptions.yml b/list_exceptions.yml index c16c1f5..4666d2f 100644 --- a/list_exceptions.yml +++ b/list_exceptions.yml @@ -5,29 +5,91 @@ # Patches that will retry "datapatch" if they fail. Max retries is 3. list_retry_datapatch: + - { version: "12.1.0.2" , type : "BP" , id : 8 , retries : 2 } + - { version: "12.1.0.2" , type : "BP" , id : 9 , retries : 2 } + - { version: "12.1.0.2" , type : "BP" , id : 190115 , retries : 2 } - { version: "12.1.0.2" , type : "BP" , id : 190716 , retries : 2 } - - { version: "12.2.0.1" , type : "RU" , id : 190716 , retries : 1 } - - { version: "12.2.0.1" , type : "RUR" , id : 190716 , retries : 1 } - { version: "12.1.0.2" , type : "BP" , id : 191015 , retries : 2 } - - { version: "12.2.0.1" , type : "RU" , id : 191015 , retries : 1 } - - { version: "12.2.0.1" , type : "RUR" , id : 191015 , retries : 1 } - { version: "12.1.0.2" , type : "BP" , id : 200114 , retries : 2 } - - { version: "12.2.0.1" , type : "RU" , id : 200114 , retries : 1 } - - { version: "12.2.0.1" , type : "RUR" , id : 200114 , retries : 1 } - { version: "12.1.0.2" , type : "BP" , id : 200414 , retries : 2 } - - { version: "12.2.0.1" , type : "RU" , id : 200414 , retries : 1 } - - { version: "12.2.0.1" , type : "RUR" , id : 200414 , retries : 1 } - - { version: "12.1.0.2" , type : "PSU" , id : 200714 , retries : 2 } - { version: "12.1.0.2" , type : "BP" , id : 200714 , retries : 2 } - - { version: "12.2.0.1" , type : "RU" , id : 200714 , retries : 1 } - - { version: "12.2.0.1" , type : "RUR" , id : 200714 , retries : 1 } - - { version: "12.1.0.2" , type : "PSU" , id : 201020 , retries : 2 } - { version: "12.1.0.2" , type : "BP" , id : 201020 , retries : 2 } - - { version: "12.2.0.1" , type : "RU" , id : 201020 , retries : 1 } - - { version: "12.2.0.1" , type : "RUR" , id : 201020 , retries : 1 } - - { version: "12.1.0.2" , type : "PSU" , id : 210119 , retries : 2 } - { version: "12.1.0.2" , type : "BP" , id : 210119 , retries : 2 } - - { version: "12.2.0.1" , type : "RU" , id : 210119 , retries : 1 } - - { version: "12.1.0.2" , type : "PSU" , id : 210420 , retries : 2 } - { version: "12.1.0.2" , type : "BP" , id : 210420 , retries : 2 } + - { version: "12.1.0.2" , type : "BP" , id : 210720 , retries : 2 } + - { version: "12.1.0.2" , type : "BP" , id : 211019 , retries : 2 } + - { version: "12.1.0.2" , type : "BP" , id : 220118 , retries : 2 } + - { version: "12.1.0.2" , type : "BP" , id : 220419 , retries : 2 } + - { version: "12.1.0.2" , type : "BP" , id : 220719 , retries : 2 } + - { version: "12.1.0.2" , type : "BP" , id : 221018 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 230117 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 230418 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 230718 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 231017 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 240416 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 240716 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 241015 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 250121 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 250415 , retries : 3 } + - { version: "12.1.0.2" , type : "BP" , id : 250715 , retries : 3 } +###### + - { version: "12.1.0.2" , type : "PSU" , id : 200714 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 201020 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 210119 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 210420 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 210720 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 211019 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 220118 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 220419 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 220719 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 221018 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 230117 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 230418 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 230718 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 231017 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 240416 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 240716 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 241015 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 250415 , retries : 2 } + - { version: "12.1.0.2" , type : "PSU" , id : 250715 , retries : 2 } +###### + - { version: "12.2.0.1" , type : "RU" , id : 190716 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 191015 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 200114 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 200414 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 200714 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 201020 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 210119 , retries : 1 } - { version: "12.2.0.1" , type : "RU" , id : 210420 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 210720 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 211019 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 220118 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 220419 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 220719 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 221018 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 230117 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 230418 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 230718 , retries : 1 } + - { version: "12.2.0.1" , type : "RU" , id : 231017 , retries : 1 } +###### + - { version: "12.2.0.1" , type : "RUR" , id : 180717 , retries : 1 } + - { version: "12.2.0.1" , type : "RUR" , id : 181016 , retries : 1 } + - { version: "12.2.0.1" , type : "RUR" , id : 190716 , retries : 1 } + - { version: "12.2.0.1" , type : "RUR" , id : 191015 , retries : 1 } + - { version: "12.2.0.1" , type : "RUR" , id : 200114 , retries : 1 } + - { version: "12.2.0.1" , type : "RUR" , id : 200414 , retries : 1 } + - { version: "12.2.0.1" , type : "RUR" , id : 200714 , retries : 1 } + - { version: "12.2.0.1" , type : "RUR" , id : 201020 , retries : 1 } +###### + - { version: "19.0.0.0" , type : "DPBP" , id : 10 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 11 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 12 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 13 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 14 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 15 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 16 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 17 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 18 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 19 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 20 , retries : 1 } + - { version: "19.0.0.0" , type : "DPBP" , id : 21 , retries : 1 } \ No newline at end of file diff --git a/list_patches.yml b/list_patches.yml index 461ff16..fd6feb8 100644 --- a/list_patches.yml +++ b/list_patches.yml @@ -1,3 +1,292 @@ +#################### +##### 10.2.0.X ##### +#################### + +# 10.2.0.4 Patch Set Updates - List of Fixes in each PSU (Doc ID 1340024.1) +# 10.2.0.5 Patch Set Updates - List of Fixes in each PSU (Doc ID 1337394.1) + +list_1020X: +# 10.2.0.1 + - { version : "10.2.0.1" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.10.2.0.1.tar.gz" } + - { version : "10.2.0.1" , type : "DEP" , id : 0 , patch_number : 5240469 , dep_type : 'BASE' , dep_id : 0 } # Due to a bug, patches can only be applied after 5240469 fix + - { version : "10.2.0.1" , type : "CPU" , id : 200601 , patch_number : 4751931 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUJan2006/catcpu.sql" } + - { version : "10.2.0.1" , type : "CPU" , id : 200604 , patch_number : 5049080 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUApr2006/catcpu.sql" } + - { version : "10.2.0.1" , type : "CPU" , id : 200607 , patch_number : 5225798 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUJul2006/catcpu.sql" } + - { version : "10.2.0.1" , type : "CPU" , id : 200610 , patch_number : 5490846 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUOct2006/catcpu.sql" } + - { version : "10.2.0.1" , type : "CPU" , id : 200701 , patch_number : 5689937 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUJan2007/catcpu.sql" } +# - { version : "10.2.0.1" , type : "CPU" , id : 200704 , patch_number : 5901880 , dep_type : 'DEP' , dep_id : 0 } # NO PATCH FOR LINUX +# 10.2.0.2 + - { version : "10.2.0.2" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.10.2.0.2.tar.gz" } + - { version : "10.2.0.2" , type : "DEP" , id : 0 , patch_number : 5240469 , dep_type : 'BASE' , dep_id : 0 } # Due to a bug, patches can only be applied after 5240469 fix + - { version : "10.2.0.2" , type : "CPU" , id : 200604 , patch_number : 5079037 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUApr2006/catcpu.sql" } + - { version : "10.2.0.2" , type : "CPU" , id : 200607 , patch_number : 5225799 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUJul2006/catcpu.sql" } + - { version : "10.2.0.2" , type : "CPU" , id : 200610 , patch_number : 5490848 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUOct2006/catcpu.sql" } + - { version : "10.2.0.2" , type : "CPU" , id : 200701 , patch_number : 5689957 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUJan2007/catcpu.sql" } + - { version : "10.2.0.2" , type : "CPU" , id : 200704 , patch_number : 5901881 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUApr2007/catcpu.sql" } + - { version : "10.2.0.2" , type : "CPU" , id : 200707 , patch_number : 6079588 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUJul2007/catcpu.sql" } + - { version : "10.2.0.2" , type : "CPU" , id : 200710 , patch_number : 6394997 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUOct2007/catcpu.sql" } + - { version : "10.2.0.2" , type : "CPU" , id : 200801 , patch_number : 6646850 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUJan2008/catcpu.sql" } +# - { version : "10.2.0.2" , type : "CPU" , id : 200804 , patch_number : 6864071 , dep_type : 'DEP' , dep_id : 0 } # NO PATCH FOR LINUX +# - { version : "10.2.0.2" , type : "CPU" , id : 200807 , patch_number : 7154083 , dep_type : 'DEP' , dep_id : 0 } # NO PATCH FOR LINUX +# - { version : "10.2.0.2" , type : "CPU" , id : 200810 , patch_number : 7375660 , dep_type : 'DEP' , dep_id : 0 } # NO PATCH FOR LINUX +# - { version : "10.2.0.2" , type : "CPU" , id : 200901 , patch_number : 7592355 , dep_type : 'DEP' , dep_id : 0 } # NO PATCH FOR LINUX +# 10.2.0.3 + - { version : "10.2.0.3" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.10.2.0.3.tar.gz" } + - { version : "10.2.0.3" , type : "DEP" , id : 0 , patch_number : 5240469 , dep_type : 'BASE', dep_id : 0 } # Due to a bug, patches can only be applied after 5240469 fix + - { version : "10.2.0.3" , type : "CPU" , id : 200701 , patch_number : 5881721 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUJan2007/catcpu.sql" } + - { version : "10.2.0.3" , type : "CPU" , id : 200704 , patch_number : 5901891 , dep_type : 'DEP' , dep_id : 0 , cat_script : "cpu/CPUApr2007/catcpu.sql" } + - { version : "10.2.0.3" , type : "CPU" , id : 200707 , patch_number : 6079591 , dep_type : 'DEP' , dep_id : 0 , apply_method : "napply" , cat_script : "cpu/CPUJul2007/catcpu.sql" } + - { version : "10.2.0.3" , type : "CPU" , id : 200710 , patch_number : 6394981 , dep_type : 'DEP' , dep_id : 0 , apply_method : "napply" , cat_script : "cpu/CPUOct2007/catcpu.sql" } + - { version : "10.2.0.3" , type : "CPU" , id : 200801 , patch_number : 6646853 , dep_type : 'DEP' , dep_id : 0 , apply_method : "napply" , cat_script : "cpu/CPUJan2008/catcpu.sql" } + - { version : "10.2.0.3" , type : "CPU" , id : 200804 , patch_number : 6864068 , dep_type : 'DEP' , dep_id : 0 , apply_method : "napply" , cat_script : "cpu/CPUApr2008/catcpu.sql" } + - { version : "10.2.0.3" , type : "CPU" , id : 200807 , patch_number : 7150622 , dep_type : 'DEP' , dep_id : 0 , apply_method : "napply" , cat_script : "cpu/CPUJul2008/catcpu.sql" } + - { version : "10.2.0.3" , type : "CPU" , id : 200810 , patch_number : 7369190 , dep_type : 'DEP' , dep_id : 0 , apply_method : "napply" , cat_script : "cpu/CPUOct2008/catcpu.sql" } + - { version : "10.2.0.3" , type : "CPU" , id : 200901 , patch_number : 7592354 , dep_type : 'DEP' , dep_id : 0 , apply_method : "napply" , cat_script : "cpu/CPUJan2009/catcpu.sql" } +# 10.2.0.4 + - { version : "10.2.0.4" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.10.2.0.4.tar.gz" } + - { version : "10.2.0.4" , type : "PSU" , id : 1 , patch_number : 8576156 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.4" , type : "PSU" , id : 2 , patch_number : 8833280 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.4" , type : "PSU" , id : 3 , patch_number : 9119284 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.4" , type : "PSU" , id : 4 , patch_number : 9352164 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.4" , type : "PSU" , id : 5 , patch_number : 9654991 , dep_type : 'PSU' , dep_id : 4 } + - { version : "10.2.0.4" , type : "PSU" , id : 6 , patch_number : 9952234 , dep_type : 'PSU' , dep_id : 4 } + - { version : "10.2.0.4" , type : "PSU" , id : 7 , patch_number : 10248636 , dep_type : 'PSU' , dep_id : 4 } + - { version : "10.2.0.4" , type : "PSU" , id : 8 , patch_number : 11724977 , dep_type : 'PSU' , dep_id : 4 } + - { version : "10.2.0.4" , type : "PSU" , id : 9 , patch_number : 12419397 , dep_type : 'PSU' , dep_id : 4 } + - { version : "10.2.0.4" , type : "PSU" , id : 10 , patch_number : 12827778 , dep_type : 'PSU' , dep_id : 4 } + - { version : "10.2.0.4" , type : "PSU" , id : 11 , patch_number : 12879929 , dep_type : 'PSU' , dep_id : 4 } + - { version : "10.2.0.4" , type : "PSU" , id : 12 , patch_number : 12879933 , dep_type : 'PSU' , dep_id : 4 } +# - { version : "10.2.0.4" , type : "PSU" , id : 13 , patch_number : 13923851 , dep_type : 'BASE' , dep_id : 0 } # NO PATCH FOR LINUX +# - { version : "10.2.0.4" , type : "PSU" , id : 14 , patch_number : 14275630 , dep_type : 'BASE' , dep_id : 0 } # NO PATCH FOR LINUX +# - { version : "10.2.0.4" , type : "PSU" , id : 15 , patch_number : 14736542 , dep_type : 'BASE' , dep_id : 0 } # NO PATCH FOR LINUX +# - { version : "10.2.0.4" , type : "PSU" , id : 16 , patch_number : 16056269 , dep_type : 'BASE' , dep_id : 0 } # NO PATCH FOR LINUX +# - { version : "10.2.0.4" , type : "PSU" , id : 17 , patch_number : 16619897 , dep_type : 'BASE' , dep_id : 0 } # NO PATCH FOR LINUX + - { version : "10.2.0.4" , type : "CPU" , id : 200807 , patch_number : 7150470 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 200810 , patch_number : 7375644 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 200901 , patch_number : 7592346 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 200904 , patch_number : 8290506 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 200907 , patch_number : 8534387 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 200910 , patch_number : 8836308 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201001 , patch_number : 9119226 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201004 , patch_number : 9352191 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201007 , patch_number : 9655017 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201010 , patch_number : 9952272 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201101 , patch_number : 10249540 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201104 , patch_number : 11725015 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201107 , patch_number : 12419249 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201110 , patch_number : 12828112 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201201 , patch_number : 12879912 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.4" , type : "CPU" , id : 201204 , patch_number : 12879926 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } +# - { version : "10.2.0.4" , type : "CPU" , id : 201207 , patch_number : 14038814 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # NOT AVAILABLE + - { version : "10.2.0.4" , type : "CPU" , id : 201207 , patch_number : 14038833 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # EXCEPTION - PASSWORD PROTECTED +# - { version : "10.2.0.4" , type : "CPU" , id : 201210 , patch_number : 14390410 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # NOT AVAILABLE + - { version : "10.2.0.4" , type : "CPU" , id : 201210 , patch_number : 14038840 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # EXCEPTION - PASSWORD PROTECTED +# - { version : "10.2.0.4" , type : "CPU" , id : 201301 , patch_number : 14841471 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # NOT AVAILABLE + - { version : "10.2.0.4" , type : "CPU" , id : 201301 , patch_number : 14038841 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # EXCEPTION - PASSWORD PROTECTED +# - { version : "10.2.0.4" , type : "CPU" , id : 201304 , patch_number : 16270931 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # NOT AVAILABLE + - { version : "10.2.0.4" , type : "CPU" , id : 201304 , patch_number : 14038843 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # EXCEPTION - PASSWORD PROTECTED +# - { version : "10.2.0.4" , type : "CPU" , id : 201307 , patch_number : 16742253 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # NOT AVAILABLE + - { version : "10.2.0.4" , type : "CPU" , id : 201307 , patch_number : 14038845 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # EXCEPTION - PASSWORD PROTECTED +# 10.2.0.5 + - { version : "10.2.0.5" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.10.2.0.5.tar.gz" } + - { version : "10.2.0.5" , type : "PSU" , id : 1 , patch_number : 9952230 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 2 , patch_number : 10248542 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 3 , patch_number : 11724962 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 4 , patch_number : 12419392 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 5 , patch_number : 12827745 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 6 , patch_number : 13343471 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 7 , patch_number : 13632743 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 8 , patch_number : 13923855 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 9 , patch_number : 14275629 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 10 , patch_number : 14727319 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 11 , patch_number : 16056270 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 12 , patch_number : 16619894 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 13 , patch_number : 17082365 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 14 , patch_number : 17465584 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 15 , patch_number : 18031728 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 16 , patch_number : 18522511 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 17 , patch_number : 19274523 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 18 , patch_number : 19769505 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "PSU" , id : 19 , patch_number : 20299014 , dep_type : 'BASE' , dep_id : 0 } + - { version : "10.2.0.5" , type : "CPU" , id : 201010 , patch_number : 9952270 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201101 , patch_number : 10249537 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201104 , patch_number : 11725006 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201107 , patch_number : 12419258 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201110 , patch_number : 12828105 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201201 , patch_number : 13343467 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201204 , patch_number : 13632738 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201207 , patch_number : 14038805 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201210 , patch_number : 14390396 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201301 , patch_number : 14841459 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201304 , patch_number : 16270946 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201307 , patch_number : 16742123 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201310 , patch_number : 17082371 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201401 , patch_number : 17551414 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201404 , patch_number : 18139709 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201407 , patch_number : 18681879 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201410 , patch_number : 19274521 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "10.2.0.5" , type : "CPU" , id : 201501 , patch_number : 19854436 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } +# - { version : "10.2.0.5" , type : "CPU" , id : 201504 , patch_number : x , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # NOTHING TO FIX - NO PATCH CREATED + - { version : "10.2.0.5" , type : "CPU" , id : 201507 , patch_number : 20299021 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + +#################### +##### 11.1.0.X ##### +#################### + +# 11.1.0.7 Patch Set Updates - List of Fixes in each PSU (Doc ID 1337836.1) + +list_1110X: +# 11.1.0.6 + - { version : "11.1.0.6" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.11.1.0.6.tar.gz" } + - { version : "11.1.0.6" , type : "CPU" , id : 200804 , patch_number : 6864063 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" , cat_script : "cpu/CPUApr2008/catcpu.sql" } + - { version : "11.1.0.6" , type : "CPU" , id : 200807 , patch_number : 7150417 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.6" , type : "CPU" , id : 200810 , patch_number : 7375639 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.6" , type : "CPU" , id : 200901 , patch_number : 7592335 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.6" , type : "CPU" , id : 200904 , patch_number : 8290402 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.6" , type : "CPU" , id : 200907 , patch_number : 8534378 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } +# 11.1.0.7 + - { version : "11.1.0.7" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.11.1.0.7.tar.gz" } + - { version : "11.1.0.7" , type : "PSU" , id : 1 , patch_number : 8833297 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 2 , patch_number : 9209238 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 3 , patch_number : 9352179 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 4 , patch_number : 9654987 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 5 , patch_number : 9952228 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 6 , patch_number : 10248531 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 7 , patch_number : 11724936 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 8 , patch_number : 12419384 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 9 , patch_number : 12827740 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 10 , patch_number : 13343461 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 11 , patch_number : 13621679 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 12 , patch_number : 13923474 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 13 , patch_number : 14275623 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 14 , patch_number : 14739378 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 15 , patch_number : 16056268 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 16 , patch_number : 16619896 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 17 , patch_number : 17082366 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 18 , patch_number : 17465583 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 19 , patch_number : 18031726 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 20 , patch_number : 18522513 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 21 , patch_number : 19152553 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 22 , patch_number : 19769499 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 23 , patch_number : 20299012 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "PSU" , id : 24 , patch_number : 20761024 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.1.0.7" , type : "CPU" , id : 200904 , patch_number : 8290478 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 200907 , patch_number : 8534338 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 200910 , patch_number : 8836375 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201001 , patch_number : 9114072 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201004 , patch_number : 9369783 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201007 , patch_number : 9655014 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201010 , patch_number : 9952269 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201101 , patch_number : 10249534 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201104 , patch_number : 11724999 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201107 , patch_number : 12419265 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201110 , patch_number : 12828097 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201201 , patch_number : 13343453 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201204 , patch_number : 13632731 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201207 , patch_number : 14038803 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201210 , patch_number : 14390384 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201301 , patch_number : 14841452 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201304 , patch_number : 16308394 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201307 , patch_number : 16742110 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201310 , patch_number : 17082374 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201401 , patch_number : 17551415 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201404 , patch_number : 18139703 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201407 , patch_number : 18681875 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201410 , patch_number : 19274522 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201501 , patch_number : 19854433 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201504 , patch_number : 20299020 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "CPU" , id : 201507 , patch_number : 20803573 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.1.0.7" , type : "OJVM" , id : 1 , patch_number : 19282002 } + - { version : "11.1.0.7" , type : "OJVM" , id : 2 , patch_number : 19877446 } + - { version : "11.1.0.7" , type : "OJVM" , id : 3 , patch_number : 20406213 } + - { version : "11.1.0.7" , type : "OJVM" , id : 4 , patch_number : 21068565 } + +#################### +##### 11.2.0.X ##### +#################### + +# 11.2.0.1 Patch Set Updates - List of Fixes in each PSU (Doc ID 1340010.1) +# 11.2.0.2 Patch Set Updates - List of Fixes in each PSU (Doc ID 1340011.1) +# 11.2.0.3 Patch Set Updates - List of Fixes in each PSU (Doc ID 1449750.1) + +list_1120X: +# 11.2.0.1 + - { version : "11.2.0.1" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.11.2.0.1.tar.gz" } + - { version : "11.2.0.1" , type : "PSU" , id : 1 , patch_number : 9352237 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.1" , type : "PSU" , id : 2 , patch_number : 9654983 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.1" , type : "PSU" , id : 3 , patch_number : 9952216 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.1" , type : "PSU" , id : 4 , patch_number : 10248516 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.1" , type : "PSU" , id : 5 , patch_number : 11724930 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.1" , type : "PSU" , id : 6 , patch_number : 12419378 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.1" , type : "CPU" , id : 1 , patch_number : 9369797 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.1" , type : "CPU" , id : 2 , patch_number : 9655013 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.1" , type : "CPU" , id : 3 , patch_number : 9952260 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.1" , type : "CPU" , id : 4 , patch_number : 10249532 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.1" , type : "CPU" , id : 5 , patch_number : 11724991 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.1" , type : "CPU" , id : 6 , patch_number : 12419278 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } +# 11.2.0.2 + - { version : "11.2.0.2" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.11.2.0.2.tar.gz" } + - { version : "11.2.0.2" , type : "PSU" , id : 1 , patch_number : 10248523 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 2 , patch_number : 11724916 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 3 , patch_number : 12419331 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 4 , patch_number : 12827726 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 5 , patch_number : 13343424 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 6 , patch_number : 13696224 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 7 , patch_number : 13923804 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 8 , patch_number : 14275621 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 9 , patch_number : 14727315 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 10 , patch_number : 16056267 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 11 , patch_number : 16619893 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.2" , type : "PSU" , id : 12 , patch_number : 17082367 , dep_type : 'BASE' , dep_id : 0 } +# - { version : "11.2.0.2" , type : "CPU" , id : 1 , patch_number : xxxxxxxx , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } # NOTHING TO FIX - NO PATCH CREATED + - { version : "11.2.0.2" , type : "CPU" , id : 2 , patch_number : 11724984 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 3 , patch_number : 12419321 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 4 , patch_number : 12828071 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 5 , patch_number : 13343244 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 6 , patch_number : 13632725 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 7 , patch_number : 14038791 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 8 , patch_number : 14390377 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 9 , patch_number : 14841437 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 10 , patch_number : 16294412 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 11 , patch_number : 16742100 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.2" , type : "CPU" , id : 12 , patch_number : 17082375 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } +# 11.2.0.3 + - { version : "11.2.0.3" , type : "BASE" , id : 0 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.11.2.0.3.tar.gz" } + - { version : "11.2.0.3" , type : "PSU" , id : 1 , patch_number : 13343438 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 2 , patch_number : 13696216 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 3 , patch_number : 13923374 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 4 , patch_number : 14275605 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 5 , patch_number : 14727310 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 6 , patch_number : 16056266 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 7 , patch_number : 16619892 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 8 , patch_number : 16902043 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 9 , patch_number : 17540582 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 10 , patch_number : 18031683 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 11 , patch_number : 18522512 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 12 , patch_number : 19121548 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 13 , patch_number : 19769496 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 14 , patch_number : 20299017 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "PSU" , id : 15 , patch_number : 20760997 , dep_type : 'BASE' , dep_id : 0 } + - { version : "11.2.0.3" , type : "CPU" , id : 1 , patch_number : 13466801 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 2 , patch_number : 13632717 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 3 , patch_number : 14038787 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 4 , patch_number : 14390252 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 5 , patch_number : 14841409 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 6 , patch_number : 16294378 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 7 , patch_number : 16742095 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 8 , patch_number : 17082364 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 9 , patch_number : 17478415 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 10 , patch_number : 18139695 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 11 , patch_number : 18681866 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 12 , patch_number : 19271438 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 13 , patch_number : 19854461 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 14 , patch_number : 20299010 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "CPU" , id : 15 , patch_number : 20803576 , dep_type : 'BASE' , dep_id : 0 , apply_method : "napply" } + - { version : "11.2.0.3" , type : "OJVM" , id : 1 , patch_number : 19282015 } + - { version : "11.2.0.3" , type : "OJVM" , id : 2 , patch_number : 19877443 } + - { version : "11.2.0.3" , type : "OJVM" , id : 3 , patch_number : 20406220 } + - { version : "11.2.0.3" , type : "OJVM" , id : 4 , patch_number : 21068553 } + #################### ##### 11.2.0.4 ##### #################### @@ -5,6 +294,7 @@ # Database 11.2.0.4 Proactive Patch Information (Doc ID 2285559.1) list_11204: +# 11.2.0.4 PSU - { type : "PSU" , id : 1 , patch_number : 17478514 } - { type : "PSU" , id : 2 , patch_number : 18031668 } - { type : "PSU" , id : 3 , patch_number : 18522509 } @@ -17,6 +307,7 @@ list_11204: - { type : "PSU" , id : 160419 , patch_number : 22502456 } - { type : "PSU" , id : 160719 , patch_number : 23054359 } - { type : "PSU" , id : 161018 , patch_number : 24006111 } +# - { type : "PSU" , id : 170117 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED - { type : "PSU" , id : 170418 , patch_number : 24732075 } - { type : "PSU" , id : 170718 , patch_number : 25869727 } - { type : "PSU" , id : 170814 , patch_number : 26609445 } @@ -32,9 +323,28 @@ list_11204: - { type : "PSU" , id : 200114 , patch_number : 30298532 } - { type : "PSU" , id : 200414 , patch_number : 30670774 } - { type : "PSU" , id : 200714 , patch_number : 31103343 } - - { type : "PSU" , id : 201020 , patch_number : 31537677 } - - { type : "PSU" , id : 210119 , patch_number : 31983472 } + - { type : "PSU" , id : 201020 , patch_number : 31537677 } # LAST PUBLIC - END OF EXTENDED + - { type : "PSU" , id : 210119 , patch_number : 31983472 } # START TIER 1 - { type : "PSU" , id : 210420 , patch_number : 32328626 } + - { type : "PSU" , id : 210720 , patch_number : 32758711 } + - { type : "PSU" , id : 211019 , patch_number : 33128584 } + - { type : "PSU" , id : 220118 , patch_number : 33477185 } + - { type : "PSU" , id : 220419 , patch_number : 33711103 } + - { type : "PSU" , id : 220719 , patch_number : 34057724 } + - { type : "PSU" , id : 221018 , patch_number : 34386237 } + - { type : "PSU" , id : 230117 , patch_number : 34677698 } + - { type : "PSU" , id : 230418 , patch_number : 34998337 } + - { type : "PSU" , id : 230718 , patch_number : 35269283 } + - { type : "PSU" , id : 231017 , patch_number : 35574075 } +# - { type : "PSU" , id : 240116 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED + - { type : "PSU" , id : 240416 , patch_number : 36222299 } + - { type : "PSU" , id : 240716 , patch_number : 36575425 } +# - { type : "PSU" , id : 241015 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED +# - { type : "PSU" , id : 250121 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED + - { type : "PSU" , id : 250415 , patch_number : 37608089 } +# - { type : "PSU" , id : 250715 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED +# - { type : "PSU" , id : 251021 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED +# 11.2.0.4 OJVM - { type : "OJVM" , id : 1 , patch_number : 19282021 } - { type : "OJVM" , id : 2 , patch_number : 19877440 } - { type : "OJVM" , id : 3 , patch_number : 20406239 } @@ -59,9 +369,28 @@ list_11204: - { type : "OJVM" , id : 200114 , patch_number : 30503372 } - { type : "OJVM" , id : 200414 , patch_number : 30805543 } - { type : "OJVM" , id : 200714 , patch_number : 31219953 } - - { type : "OJVM" , id : 201020 , patch_number : 31668908 } -# - { type : "OJVM" , id : 210119 , patch_number : } - - { type : "OJVM" , id : 210420 , patch_number : 32671980 } + - { type : "OJVM" , id : 201020 , patch_number : 31668908 } # LAST PUBLIC - END OF EXTENDED +# - { type : "OJVM" , id : 210119 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED + - { type : "OJVM" , id : 210420 , patch_number : 32671980 } # START TIER 1 + - { type : "OJVM" , id : 210720 , patch_number : 32876451 } + - { type : "OJVM" , id : 211019 , patch_number : 33192642 } + - { type : "OJVM" , id : 220118 , patch_number : 33561250 } + - { type : "OJVM" , id : 220419 , patch_number : 33829826 } + - { type : "OJVM" , id : 220719 , patch_number : 34085652 } + - { type : "OJVM" , id : 221018 , patch_number : 34412266 } + - { type : "OJVM" , id : 230117 , patch_number : 34763334 } + - { type : "OJVM" , id : 230418 , patch_number : 35039831 } + - { type : "OJVM" , id : 230718 , patch_number : 35349843 } + - { type : "OJVM" , id : 231017 , patch_number : 35685663 } + - { type : "OJVM" , id : 240116 , patch_number : 35926733 } + - { type : "OJVM" , id : 240416 , patch_number : 36222352 } + - { type : "OJVM" , id : 240716 , patch_number : 36533106 } + - { type : "OJVM" , id : 241015 , patch_number : 36878781 } + - { type : "OJVM" , id : 250121 , patch_number : 37226818 } + - { type : "OJVM" , id : 250415 , patch_number : 37547668 } + - { type : "OJVM" , id : 250715 , patch_number : 37954278 } + - { type : "OJVM" , id : 251021 , patch_number : 38291847 } +# 11.2.0.4 BP - { type : "BP" , id : 1 , patch_number : 17628025 , patch_folder : 17628006 } - { type : "BP" , id : 2 , patch_number : 17838803 , patch_folder : 17741631 } - { type : "BP" , id : 3 , patch_number : 17904156 , patch_folder : 17943261 } @@ -87,6 +416,7 @@ list_11204: - { type : "BP" , id : 160419 , patch_number : 22899777 , patch_folder : 22738760 } - { type : "BP" , id : 160719 , patch_number : 23274515 , patch_folder : 23061511 } - { type : "BP" , id : 161018 , patch_number : 24479801 , patch_folder : 24340671 } +# - { type : "BP" , id : 170117 , patch_number : xxxxxxxx , patch_folder : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED - { type : "BP" , id : 170418 , patch_number : 25440411 , patch_folder : 24828123 } - { type : "BP" , id : 170718 , patch_number : 26031163 , patch_folder : 25869844 } - { type : "BP" , id : 170814 , patch_number : 26610265 , patch_folder : 26609769 } @@ -102,15 +432,36 @@ list_11204: - { type : "BP" , id : 200114 , patch_number : 30501894 , patch_folder : 30310975 } - { type : "BP" , id : 200414 , patch_number : 30805507 , patch_folder : 30691206 } - { type : "BP" , id : 200714 , patch_number : 31220011 , patch_folder : 31103314 } - - { type : "BP" , id : 201020 , patch_number : 31718644 , patch_folder : 31537652 } - - { type : "BP" , id : 210119 , patch_number : 32131241 , patch_folder : 31983477 } + - { type : "BP" , id : 201020 , patch_number : 31718644 , patch_folder : 31537652 } # LAST PUBLIC - END OF EXTENDED + - { type : "BP" , id : 210119 , patch_number : 32131241 , patch_folder : 31983477 } # START TIER 1 - { type : "BP" , id : 210420 , patch_number : 32537095 , patch_folder : 32328629 } + - { type : "BP" , id : 210720 , patch_number : 32917411 , patch_folder : 32758732 } + - { type : "BP" , id : 211019 , patch_number : 33248386 , patch_folder : 33128587 } + - { type : "BP" , id : 220118 , patch_number : 33575241 , patch_folder : 33477193 } + - { type : "BP" , id : 220419 , patch_number : 33880541 , patch_folder : 33711121 } + - { type : "BP" , id : 220719 , patch_number : 34204546 , patch_folder : 34057719 } + - { type : "BP" , id : 221018 , patch_number : 34536785 , patch_folder : 34383800 } + - { type : "BP" , id : 230117 , patch_number : 34774400 , patch_folder : 34677707 } + - { type : "BP" , id : 230418 , patch_number : 35058326 , patch_folder : 34998345 } + - { type : "BP" , id : 230718 , patch_number : 35369924 , patch_folder : 35269278 } + - { type : "BP" , id : 231017 , patch_number : 35685705 , patch_folder : 35574089 } +# - { type : "BP" , id : 240116 , patch_number : xxxxxxxx , patch_folder : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED + - { type : "BP" , id : 240416 , patch_number : 36234434 , patch_folder : 36222308 } + - { type : "BP" , id : 240716 , patch_number : 36663546 , patch_folder : 36521957 } +# - { type : "BP" , id : 241015 , patch_number : xxxxxxxx , patch_folder : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED +# - { type : "BP" , id : 250121 , patch_number : xxxxxxxx , patch_folder : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED + - { type : "BP" , id : 250415 , patch_number : 37712353 , patch_folder : 37608128 } +# - { type : "BP" , id : 250715 , patch_number : xxxxxxxx , patch_folder : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED +# - { type : "BP" , id : 251021 , patch_number : xxxxxxxx , patch_folder : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED #################### ##### 12.1.0.1 ##### #################### +# No more updates on this one. + list_12101: +# 12.1.0.1 PSU - { type : "PSU" , id : 1 , patch_number : 17027533 } - { type : "PSU" , id : 2 , patch_number : 17552800 } - { type : "PSU" , id : 3 , patch_number : 18031528 } @@ -123,6 +474,7 @@ list_12101: - { type : "PSU" , id : 160119 , patch_number : 21951844 } - { type : "PSU" , id : 160419 , patch_number : 22291141 } - { type : "PSU" , id : 160719 , patch_number : 23054354 } +# 12.1.0.1 OJVM - { type : "OJVM" , id : 1 , patch_number : 19282024 } - { type : "OJVM" , id : 2 , patch_number : 19877342 } - { type : "OJVM" , id : 3 , patch_number : 20406245 } @@ -132,6 +484,8 @@ list_12101: - { type : "OJVM" , id : 160419 , patch_number : 22674703 } - { type : "OJVM" , id : 160719 , patch_number : 23177541 } +# No more updates on this one. + #################### ##### 12.1.0.2 ##### #################### @@ -139,6 +493,7 @@ list_12101: # Database 12.1.0.2 Proactive Patch Information (Doc ID 2285558.1) list_12102: +# 12.1.0.2 PSU - { type : "PSU" , id : 1 , patch_number : 19303936 } - { type : "PSU" , id : 2 , patch_number : 19769480 } - { type : "PSU" , id : 3 , patch_number : 20299023 } @@ -151,7 +506,7 @@ list_12102: - { type : "PSU" , id : 170117 , patch_number : 24732082 } - { type : "PSU" , id : 170418 , patch_number : 25171037 } - { type : "PSU" , id : 170718 , patch_number : 25755742 } - - { type : "PSU" , id : 170814 , patch_number : 26609783 } + - { type : "PSU" , id : 170814 , patch_number : 26609783 } # EXTRA PSU - { type : "PSU" , id : 171017 , patch_number : 26713565 } - { type : "PSU" , id : 180116 , patch_number : 26925311 } - { type : "PSU" , id : 180417 , patch_number : 27338041 } @@ -167,6 +522,25 @@ list_12102: - { type : "PSU" , id : 201020 , patch_number : 31550110 } - { type : "PSU" , id : 210119 , patch_number : 31985579 } - { type : "PSU" , id : 210420 , patch_number : 32328635 } + - { type : "PSU" , id : 210720 , patch_number : 32768233 } + - { type : "PSU" , id : 211019 , patch_number : 33128590 } + - { type : "PSU" , id : 220118 , patch_number : 33477199 } + - { type : "PSU" , id : 220419 , patch_number : 33711081 } + - { type : "PSU" , id : 220719 , patch_number : 34057742 } # LAST PUBLIC - END OF EXTENDED + - { type : "PSU" , id : 221018 , patch_number : 34386266 } + - { type : "PSU" , id : 230117 , patch_number : 34677720 } # START TIER 1 + - { type : "PSU" , id : 230418 , patch_number : 34998358 } + - { type : "PSU" , id : 230718 , patch_number : 35269262 } + - { type : "PSU" , id : 231017 , patch_number : 35564645 } + - { type : "PSU" , id : 240416 , patch_number : 36222283 } + - { type : "PSU" , id : 240716 , patch_number : 36519012 } + - { type : "PSU" , id : 241015 , patch_number : 36834621 } +# - { type : "PSU" , id : 250121 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED + - { type : "PSU" , id : 250415 , patch_number : 37608146 } + - { type : "PSU" , id : 250715 , patch_number : 37929489 } + - { type : "PSU" , id : 250715 , patch_number : 37929489 } +# - { type : "PSU" , id : 251021 , patch_number : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED +# 12.1.0.2 OJVM - { type : "OJVM" , id : 1 , patch_number : 19282028 } - { type : "OJVM" , id : 2 , patch_number : 19877336 } - { type : "OJVM" , id : 3 , patch_number : 20415564 } @@ -194,6 +568,25 @@ list_12102: - { type : "OJVM" , id : 201020 , patch_number : 31668915 } - { type : "OJVM" , id : 210119 , patch_number : 32119956 } - { type : "OJVM" , id : 210420 , patch_number : 32473164 } + - { type : "OJVM" , id : 210720 , patch_number : 32876425 } + - { type : "OJVM" , id : 211019 , patch_number : 33192628 } + - { type : "OJVM" , id : 220118 , patch_number : 33561268 } + - { type : "OJVM" , id : 220419 , patch_number : 33808385 } + - { type : "OJVM" , id : 220719 , patch_number : 34086863 } # LAST PUBLIC - END OF EXTENDED + - { type : "OJVM" , id : 221018 , patch_number : 34412250 } + - { type : "OJVM" , id : 230117 , patch_number : 34763317 } # START TIER 1 + - { type : "OJVM" , id : 230418 , patch_number : 35077439 } + - { type : "OJVM" , id : 230718 , patch_number : 35354391 } + - { type : "OJVM" , id : 231017 , patch_number : 35685666 } + - { type : "OJVM" , id : 240116 , patch_number : 35926723 } + - { type : "OJVM" , id : 240416 , patch_number : 36222331 } + - { type : "OJVM" , id : 240716 , patch_number : 36533098 } + - { type : "OJVM" , id : 241015 , patch_number : 36878764 } + - { type : "OJVM" , id : 250121 , patch_number : 37226811 } + - { type : "OJVM" , id : 250415 , patch_number : 37547662 } + - { type : "OJVM" , id : 250715 , patch_number : 37954906 } + - { type : "OJVM" , id : 251021 , patch_number : 38265478 } +# 12.1.0.2 BP - { type : "BP" , id : 1 , patch_number : 19404326 , patch_folder : 19189240 } - { type : "BP" , id : 2 , patch_number : 19774304 , patch_folder : 19649591 } - { type : "BP" , id : 3 , patch_number : 20026159 , patch_folder : 19878106 } @@ -230,7 +623,23 @@ list_12102: - { type : "BP" , id : 201020 , patch_number : 31718813 , patch_folder : 31511219 } - { type : "BP" , id : 210119 , patch_number : 32131231 , patch_folder : 31965033 } - { type : "BP" , id : 210420 , patch_number : 32518631 , patch_folder : 32328632 } - + - { type : "BP" , id : 210720 , patch_number : 32917362 , patch_folder : 32768230 } + - { type : "BP" , id : 211019 , patch_number : 33248411 , patch_folder : 33114885 } + - { type : "BP" , id : 220118 , patch_number : 33575286 , patch_folder : 33465249 } + - { type : "BP" , id : 220419 , patch_number : 33880550 , patch_folder : 33711072 } + - { type : "BP" , id : 220719 , patch_number : 34204559 , patch_folder : 34057733 } # LAST PUBLIC - END OF EXTENDED + - { type : "BP" , id : 221018 , patch_number : 34536908 , patch_folder : 34386250 } + - { type : "BP" , id : 230117 , patch_number : 34774411 , patch_folder : 34677708 } # START TIER 1 + - { type : "BP" , id : 230418 , patch_number : 35058289 , patch_folder : 34998350 } + - { type : "BP" , id : 230718 , patch_number : 35369903 , patch_folder : 35269270 } + - { type : "BP" , id : 231017 , patch_number : 35685744 , patch_folder : 35564676 } + - { type : "BP" , id : 240416 , patch_number : 36360782 , patch_folder : 36222291 } + - { type : "BP" , id : 240716 , patch_number : 36663406 , patch_folder : 36519004 } + - { type : "BP" , id : 241015 , patch_number : 36961411 , patch_folder : 36834630 } + - { type : "BP" , id : 250121 , patch_number : 37372537 , patch_folder : 37226852 } + - { type : "BP" , id : 250415 , patch_number : 37712366 , patch_folder : 37608165 } + - { type : "BP" , id : 250715 , patch_number : 38112664 , patch_folder : 37929446 } +# - { type : "BP" , id : 251021 , patch_number : xxxxxxxx , patch_folder : xxxxxxxx } # NOTHING TO FIX - NO PATCH CREATED #################### ##### 12.2.0.1 ##### @@ -239,6 +648,7 @@ list_12102: # Database 12.2.0.1 Proactive Patch Information (Doc ID 2285557.1) list_12201: +# 12.2.0.1 RU - { type : "RU" , id : 170718 , patch_number : 26123830 } - { type : "RU" , id : 170814 , patch_number : 26609817 } - { type : "RU" , id : 171017 , patch_number : 26710464 } @@ -256,6 +666,25 @@ list_12201: - { type : "RU" , id : 201020 , patch_number : 31741641 } - { type : "RU" , id : 210119 , patch_number : 32228578 } - { type : "RU" , id : 210420 , patch_number : 32507738 } + - { type : "RU" , id : 210720 , patch_number : 32916808 } + - { type : "RU" , id : 211019 , patch_number : 33261817 } + - { type : "RU" , id : 220118 , patch_number : 33587128 , base_ojvm: true } # LAST PATCH + - { type : "RU" , id : 220419 , patch_number : 33878460 } # PASSWORD PROTECTED + - { type : "RU" , id : 220719 , patch_number : 34219726 } # PASSWORD PROTECTED + - { type : "RU" , id : 221018 , patch_number : 34518562 } # PASSWORD PROTECTED + - { type : "RU" , id : 230117 , patch_number : 34850184 } # PASSWORD PROTECTED + - { type : "RU" , id : 230418 , patch_number : 35115783 } # PASSWORD PROTECTED + - { type : "RU" , id : 230718 , patch_number : 35407080 } # PASSWORD PROTECTED + - { type : "RU" , id : 231017 , patch_number : 35746058 } + - { type : "RU" , id : 240116 , patch_number : 35966787 } # START TIER 1 + - { type : "RU" , id : 240416 , patch_number : 36325581 } + - { type : "RU" , id : 240716 , patch_number : 36650048 } + - { type : "RU" , id : 241015 , patch_number : 36941400 } + - { type : "RU" , id : 250121 , patch_number : 37317999 } + - { type : "RU" , id : 250415 , patch_number : 37742706 } + - { type : "RU" , id : 250715 , patch_number : 38102087 } + - { type : "RU" , id : 251021 , patch_number : 38428389 } +# 12.2.0.1 RUR - { type : "RUR" , id : 171017 , patch_number : 26518812 , base_ru : JUL2017 } - { type : "RUR" , id : 180116 , patch_number : 27013506 , base_ru : JUL2017 } - { type : "RUR" , id : 180116 , patch_number : 27013510 , base_ru : OCT2017 } @@ -281,6 +710,7 @@ list_12201: - { type : "RUR" , id : 200714 , patch_number : 31199988 , base_ru : APR2020 } - { type : "RUR" , id : 201020 , patch_number : 31667168 , base_ru : APR2020 } - { type : "RUR" , id : 201020 , patch_number : 31666944 , base_ru : JUL2020 } +# 12.2.0.1 OJVM - { type : "OJVM" , id : 170718 , patch_number : 25811364 } - { type : "OJVM" , id : 171017 , patch_number : 26635944 } - { type : "OJVM" , id : 180116 , patch_number : 27001739 } @@ -297,6 +727,24 @@ list_12201: - { type : "OJVM" , id : 201020 , patch_number : 31668898 } - { type : "OJVM" , id : 210119 , patch_number : 32119931 } - { type : "OJVM" , id : 210420 , patch_number : 32473172 } + - { type : "OJVM" , id : 210720 , patch_number : 32876409 } + - { type : "OJVM" , id : 211019 , patch_number : 33192662 } + - { type : "OJVM" , id : 220118 , patch_number : 33561275 } # LAST PATCH + - { type : "OJVM" , id : 220419 , patch_number : 33829783 } + - { type : "OJVM" , id : 220719 , patch_number : 34086867 } + - { type : "OJVM" , id : 221018 , patch_number : 34412174 } + - { type : "OJVM" , id : 230117 , patch_number : 34763276 } # PASSWORD PROTECTED + - { type : "OJVM" , id : 230418 , patch_number : 35058256 } # PASSWORD PROTECTED + - { type : "OJVM" , id : 230718 , patch_number : 35348984 } + - { type : "OJVM" , id : 231017 , patch_number : 35685669 } + - { type : "OJVM" , id : 240116 , patch_number : 35926712 } + - { type : "OJVM" , id : 240416 , patch_number : 36222324 } # START TIER 1 + - { type : "OJVM" , id : 240716 , patch_number : 36533083 } + - { type : "OJVM" , id : 241015 , patch_number : 36878737 } + - { type : "OJVM" , id : 250121 , patch_number : 37226803 } + - { type : "OJVM" , id : 250415 , patch_number : 37547642 } + - { type : "OJVM" , id : 250715 , patch_number : 37954266 } + - { type : "OJVM" , id : 251021 , patch_number : 38265430 } #################### ##### 18.0.0.0 ##### @@ -304,43 +752,92 @@ list_12201: # Database 18 Proactive Patch Information (Doc ID 2369376.1) +# No more updates on this one. + list_18000: - - { type : "RU" , id : 2 , patch_number : 27676517 } - - { type : "RU" , id : 3 , patch_number : 28090523 } - - { type : "RU" , id : 4 , patch_number : 28655784 } - - { type : "RU" , id : 5 , patch_number : 28822489 } - - { type : "RU" , id : 6 , patch_number : 29301631 } - - { type : "RU" , id : 7 , patch_number : 29757256 } - - { type : "RU" , id : 8 , patch_number : 30112122 } - - { type : "RU" , id : 9 , patch_number : 30480385 } - - { type : "RU" , id : 10 , patch_number : 30872794 } - - { type : "RU" , id : 11 , patch_number : 31308624 } - - { type : "RU" , id : 12 , patch_number : 31730250 } - - { type : "RU" , id : 13 , patch_number : 32204699 } - - { type : "RU" , id : 14 , patch_number : 32524155 } - - { type : "RUR" , id : 1 , patch_number : 28346593 , base_ru : '18.2' } - - { type : "RUR" , id : 2 , patch_number : 28601267 , base_ru : '18.2' } - - { type : "RUR" , id : 1 , patch_number : 28507480 , base_ru : '18.3' } - - { type : "RUR" , id : 2 , patch_number : 28790643 , base_ru : '18.3' } - - { type : "RUR" , id : 1 , patch_number : 28822587 , base_ru : '18.4' } - - { type : "RUR" , id : 2 , patch_number : 29230809 , base_ru : '18.4' } - - { type : "RUR" , id : 1 , patch_number : 29230887 , base_ru : '18.5' } - - { type : "RUR" , id : 2 , patch_number : 29708437 , base_ru : '18.5' } - - { type : "RUR" , id : 1 , patch_number : 29708235 , base_ru : '18.6' } - - { type : "RUR" , id : 2 , patch_number : 30087881 , base_ru : '18.6' } - - { type : "RUR" , id : 1 , patch_number : 30080518 , base_ru : '18.7' } - - { type : "RUR" , id : 2 , patch_number : 30446239 , base_ru : '18.7' } - - { type : "RUR" , id : 1 , patch_number : 30445895 , base_ru : '18.8' } - - { type : "RUR" , id : 2 , patch_number : 30830887 , base_ru : '18.8' } - - { type : "RUR" , id : 1 , patch_number : 30798089 , base_ru : '18.9' } - - { type : "RUR" , id : 2 , patch_number : 31212186 , base_ru : '18.9' } - - { type : "RUR" , id : 1 , patch_number : 31211410 , base_ru : '18.10' } - - { type : "RUR" , id : 2 , patch_number : 31667173 , base_ru : '18.10' } - - { type : "RUR" , id : 1 , patch_number : 31666917 , base_ru : '18.11' } - - { type : "RUR" , id : 2 , patch_number : 32066686 , base_ru : '18.11' } - - { type : "RUR" , id : 1 , patch_number : 32072459 , base_ru : '18.12' } - - { type : "RUR" , id : 2 , patch_number : 32421478 , base_ru : '18.12' } - - { type : "RUR" , id : 1 , patch_number : 32451079 , base_ru : '18.13' } +# 18c RU +# - { type : "RU" , id : 2 , patch_number : 27676517 , base_snap : "18.1.0" } +# - { type : "RU" , id : 3 , patch_number : 28090523 , base_snap : "18.1.0" } + - { type : "RU" , id : 4 , patch_number : 28655784 } + - { type : "RU" , id : 5 , patch_number : 28822489 } + - { type : "RU" , id : 6 , patch_number : 29301631 } + - { type : "RU" , id : 7 , patch_number : 29757256 } + - { type : "RU" , id : 8 , patch_number : 30112122 } + - { type : "RU" , id : 9 , patch_number : 30480385 } + - { type : "RU" , id : 10 , patch_number : 30872794 } + - { type : "RU" , id : 11 , patch_number : 31308624 } + - { type : "RU" , id : 12 , patch_number : 31730250 } + - { type : "RU" , id : 13 , patch_number : 32204699 } + - { type : "RU" , id : 14 , patch_number : 32524155 } + - { type : "RU" , id : 15 , patch_number : 32907484 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 16 , patch_number : 33339024 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 17 , patch_number : 33583960 , base_ojvm: true } # LAST PATCH + - { type : "RU" , id : 18 , patch_number : 33878468 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 19 , patch_number : 34219743 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 20 , patch_number : 34518577 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 21 , patch_number : 34854019 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 22 , patch_number : 35114260 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 23 , patch_number : 35411347 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 24 , patch_number : 35744266 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 25 , patch_number : 35962880 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 26 , patch_number : 36339040 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 27 , patch_number : 36682577 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 28 , patch_number : 36941408 } # NOT AVAILABLE TO DOWNLOAD + - { type : "RU" , id : 29 , patch_number : 37318028 } # NOT AVAILABLE TO DOWNLOAD +# 18c GI + - { type : "GI" , id : 2 , patch_number : 27681568 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 3 , patch_number : 28096386 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 4 , patch_number : 28659165 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 5 , patch_number : 28828717 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 6 , patch_number : 29301682 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 7 , patch_number : 29708703 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 8 , patch_number : 30116795 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 9 , patch_number : 30480702 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 10 , patch_number : 30899645 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 11 , patch_number : 31305362 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 12 , patch_number : 31748523 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 13 , patch_number : 32226219 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 14 , patch_number : 32524152 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 15 , patch_number : 32905273 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 16 , patch_number : 33334777 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 17 , patch_number : 33582710 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 18 , patch_number : 33878362 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 19 , patch_number : 34219576 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 20 , patch_number : 34517244 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 21 , patch_number : 34853460 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 22 , patch_number : 35114007 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 23 , patch_number : 35405749 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 24 , patch_number : 35743376 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 25 , patch_number : 35962393 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 26 , patch_number : 36338157 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 27 , patch_number : 36681295 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 28 , patch_number : 36940355 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD + - { type : "GI" , id : 29 , patch_number : 37313863 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } # NOT AVAILABLE TO DOWNLOAD +# 18c RUR +# - { type : "RUR" , id : 1 , patch_number : 28346593 , base_ru : '18.2' } +# - { type : "RUR" , id : 2 , patch_number : 28601267 , base_ru : '18.2' } + - { type : "RUR" , id : 1 , patch_number : 28507480 , base_ru : '18.3' } + - { type : "RUR" , id : 2 , patch_number : 28790643 , base_ru : '18.3' } + - { type : "RUR" , id : 1 , patch_number : 28822587 , base_ru : '18.4' } + - { type : "RUR" , id : 2 , patch_number : 29230809 , base_ru : '18.4' } + - { type : "RUR" , id : 1 , patch_number : 29230887 , base_ru : '18.5' } + - { type : "RUR" , id : 2 , patch_number : 29708437 , base_ru : '18.5' } + - { type : "RUR" , id : 1 , patch_number : 29708235 , base_ru : '18.6' } + - { type : "RUR" , id : 2 , patch_number : 30087881 , base_ru : '18.6' } + - { type : "RUR" , id : 1 , patch_number : 30080518 , base_ru : '18.7' } + - { type : "RUR" , id : 2 , patch_number : 30446239 , base_ru : '18.7' } + - { type : "RUR" , id : 1 , patch_number : 30445895 , base_ru : '18.8' } + - { type : "RUR" , id : 2 , patch_number : 30830887 , base_ru : '18.8' } + - { type : "RUR" , id : 1 , patch_number : 30798089 , base_ru : '18.9' } + - { type : "RUR" , id : 2 , patch_number : 31212186 , base_ru : '18.9' } + - { type : "RUR" , id : 1 , patch_number : 31211410 , base_ru : '18.10' } + - { type : "RUR" , id : 2 , patch_number : 31667173 , base_ru : '18.10' } + - { type : "RUR" , id : 1 , patch_number : 31666917 , base_ru : '18.11' } + - { type : "RUR" , id : 2 , patch_number : 32066686 , base_ru : '18.11' } + - { type : "RUR" , id : 1 , patch_number : 32072459 , base_ru : '18.12' } + - { type : "RUR" , id : 2 , patch_number : 32421478 , base_ru : '18.12' } + - { type : "RUR" , id : 1 , patch_number : 32451079 , base_ru : '18.13' } +# 18c OJVM - { type : "OJVM" , id : 180417 , patch_number : 27636900 } - { type : "OJVM" , id : 180717 , patch_number : 27923415 } - { type : "OJVM" , id : 181016 , patch_number : 28502229 } @@ -353,7 +850,24 @@ list_18000: - { type : "OJVM" , id : 200714 , patch_number : 31219909 } - { type : "OJVM" , id : 201020 , patch_number : 31668892 } - { type : "OJVM" , id : 210119 , patch_number : 32119939 } - - { type : "OJVM" , id : 210420 , patch_number : 32552752 } + - { type : "OJVM" , id : 210420 , patch_number : 32552752 } # LAST PATCH + - { type : "OJVM" , id : 210720 , patch_number : 32876373 } # PASSWORD PROTECTED + - { type : "OJVM" , id : 211019 , patch_number : 33192684 } # NOT AVAILABLE TO DOWNLOAD + - { type : "OJVM" , id : 220118 , patch_number : 33549631 } + - { type : "OJVM" , id : 220419 , patch_number : 33829896 } # NOT AVAILABLE TO DOWNLOAD + - { type : "OJVM" , id : 220719 , patch_number : 34086894 } # NOT AVAILABLE TO DOWNLOAD # 18.19 + - { type : "OJVM" , id : 221018 , patch_number : 34411878 } # NOT AVAILABLE TO DOWNLOAD # 18.20 + - { type : "OJVM" , id : 230117 , patch_number : 34763258 } # NOT AVAILABLE TO DOWNLOAD # 18.21 + - { type : "OJVM" , id : 230418 , patch_number : 35058238 } # NOT AVAILABLE TO DOWNLOAD # 18.22 + - { type : "OJVM" , id : 230718 , patch_number : 35354394 } # NOT AVAILABLE TO DOWNLOAD # 18.23 + - { type : "OJVM" , id : 231017 , patch_number : 35685672 } # NOT AVAILABLE TO DOWNLOAD # 18.24 + - { type : "OJVM" , id : 240116 , patch_number : 35926632 } # NOT AVAILABLE TO DOWNLOAD # 18.25 + - { type : "OJVM" , id : 240416 , patch_number : 36222358 } # NOT AVAILABLE TO DOWNLOAD # 18.26 + - { type : "OJVM" , id : 240716 , patch_number : 36533062 } # NOT AVAILABLE TO DOWNLOAD # 18.27 + - { type : "OJVM" , id : 241015 , patch_number : 36878718 } # NOT AVAILABLE TO DOWNLOAD # 18.28 + - { type : "OJVM" , id : 250121 , patch_number : 37226745 } # NOT AVAILABLE TO DOWNLOAD # 18.29 + +# No more updates on this one. #################### ##### 19.0.0.0 ##### @@ -362,30 +876,164 @@ list_18000: # Oracle Database 19c Proactive Patch Information (Doc ID 2521164.1) list_19000: - - { type : "RU" , id : 3 , patch_number : 29517242 , base_snap : "19.2.0" } - - { type : "RU" , id : 4 , patch_number : 29834717 } - - { type : "RU" , id : 5 , patch_number : 30125133 } - - { type : "RU" , id : 6 , patch_number : 30557433 } - - { type : "RU" , id : 7 , patch_number : 30869156 } - - { type : "RU" , id : 8 , patch_number : 31281355 } - - { type : "RU" , id : 9 , patch_number : 31771877 } - - { type : "RU" , id : 10 , patch_number : 32218454 } - - { type : "RU" , id : 11 , patch_number : 32545013 } - - { type : "RUR" , id : 1 , patch_number : 29799057 , base_ru : '19.3' } - - { type : "RUR" , id : 2 , patch_number : 30087906 , base_ru : '19.3' } - - { type : "RUR" , id : 1 , patch_number : 30080447 , base_ru : '19.4' } - - { type : "RUR" , id : 2 , patch_number : 30446228 , base_ru : '19.4' } - - { type : "RUR" , id : 1 , patch_number : 30446054 , base_ru : '19.5' } - - { type : "RUR" , id : 2 , patch_number : 30830913 , base_ru : '19.5' } - - { type : "RUR" , id : 1 , patch_number : 30797938 , base_ru : '19.6' } - - { type : "RUR" , id : 2 , patch_number : 31212138 , base_ru : '19.6' } - - { type : "RUR" , id : 1 , patch_number : 31204483 , base_ru : '19.7' } - - { type : "RUR" , id : 2 , patch_number : 31667176 , base_ru : '19.7' } - - { type : "RUR" , id : 1 , patch_number : 31666885 , base_ru : '19.8' } - - { type : "RUR" , id : 2 , patch_number : 32066676 , base_ru : '19.8' } - - { type : "RUR" , id : 1 , patch_number : 32072711 , base_ru : '19.9' } - - { type : "RUR" , id : 2 , patch_number : 32421507 , base_ru : '19.9' } - - { type : "RUR" , id : 1 , patch_number : 32441092 , base_ru : '19.10' } +# 19c RU +# - { type : "RU" , id : 3 , patch_number : 29517242 , base_snap : "19.2.0" } + - { type : "RU" , id : 4 , patch_number : 29834717 } + - { type : "RU" , id : 5 , patch_number : 30125133 } + - { type : "RU" , id : 6 , patch_number : 30557433 } + - { type : "RU" , id : 7 , patch_number : 30869156 } + - { type : "RU" , id : 8 , patch_number : 31281355 } + - { type : "RU" , id : 9 , patch_number : 31771877 } + - { type : "RU" , id : 10 , patch_number : 32218454 } + - { type : "RU" , id : 11 , patch_number : 32545013 } + - { type : "RU" , id : 12 , patch_number : 32904851 } + - { type : "RU" , id : 13 , patch_number : 33192793 } + - { type : "RU" , id : 14 , patch_number : 33515361 } + - { type : "RU" , id : 15 , patch_number : 33806152 } + - { type : "RU" , id : 16 , patch_number : 34133642 } + - { type : "RU" , id : 17 , patch_number : 34419443 } + - { type : "RU" , id : 18 , patch_number : 34765931 , aru : 25078403 , file_suf : '_v0' } + - { type : "RU" , id : 18.1 , patch_number : 34765931 , aru : 25098466 } + - { type : "RU" , id : 19 , patch_number : 35042068 } + - { type : "RU" , id : 20 , patch_number : 35320081 } + - { type : "RU" , id : 21 , patch_number : 35643107 } + - { type : "RU" , id : 22 , patch_number : 35943157 } + - { type : "RU" , id : 23 , patch_number : 36233263 } + - { type : "RU" , id : 24 , patch_number : 36582781 } + - { type : "RU" , id : 25 , patch_number : 36912597 } + - { type : "RU" , id : 26 , patch_number : 37260974 } + - { type : "RU" , id : 27 , patch_number : 37642901 } + - { type : "RU" , id : 28 , patch_number : 37960098 } + - { type : "RU" , id : 29 , patch_number : 38291812 } +# 19c GI + - { type : "GI" , id : 3 , patch_number : 29517302 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 4 , patch_number : 29708769 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 5 , patch_number : 30116789 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 6 , patch_number : 30501910 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 7 , patch_number : 30899722 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 8 , patch_number : 31305339 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 9 , patch_number : 31750108 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 10 , patch_number : 32226239 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 11 , patch_number : 32545008 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 12 , patch_number : 32895426 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 13 , patch_number : 33182768 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 14 , patch_number : 33509923 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 15 , patch_number : 33803476 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 16 , patch_number : 34130714 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 17 , patch_number : 34416665 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 18 , patch_number : 34762026 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 19 , patch_number : 35037840 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 20 , patch_number : 35319490 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 21 , patch_number : 35642822 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 22 , patch_number : 35940989 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 23 , patch_number : 36233126 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 24 , patch_number : 36582629 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 25 , patch_number : 36916690 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 26 , patch_number : 37257886 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 27 , patch_number : 37641958 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 28 , patch_number : 37957391 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 29 , patch_number : 38298204 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } +# 19c RUR + - { type : "RUR" , id : 1 , patch_number : 29799057 , base_ru : '19.3' } + - { type : "RUR" , id : 2 , patch_number : 30087906 , base_ru : '19.3' } + - { type : "RUR" , id : 1 , patch_number : 30080447 , base_ru : '19.4' } + - { type : "RUR" , id : 2 , patch_number : 30446228 , base_ru : '19.4' } + - { type : "RUR" , id : 1 , patch_number : 30446054 , base_ru : '19.5' } + - { type : "RUR" , id : 2 , patch_number : 30830913 , base_ru : '19.5' } + - { type : "RUR" , id : 1 , patch_number : 30797938 , base_ru : '19.6' } + - { type : "RUR" , id : 2 , patch_number : 31212138 , base_ru : '19.6' } + - { type : "RUR" , id : 1 , patch_number : 31204483 , base_ru : '19.7' } + - { type : "RUR" , id : 2 , patch_number : 31667176 , base_ru : '19.7' } + - { type : "RUR" , id : 1 , patch_number : 31666885 , base_ru : '19.8' } + - { type : "RUR" , id : 2 , patch_number : 32066676 , base_ru : '19.8' } + - { type : "RUR" , id : 1 , patch_number : 32072711 , base_ru : '19.9' } + - { type : "RUR" , id : 2 , patch_number : 32421507 , base_ru : '19.9' } + - { type : "RUR" , id : 1 , patch_number : 32441092 , base_ru : '19.10' } + - { type : "RUR" , id : 2 , patch_number : 32819074 , base_ru : '19.10' } + - { type : "RUR" , id : 3 , patch_number : 32923627 , base_ru : '19.10' } + - { type : "RUR" , id : 1 , patch_number : 32844504 , base_ru : '19.11' } + - { type : "RUR" , id : 2 , patch_number : 33153989 , base_ru : '19.11' } + - { type : "RUR" , id : 1 , patch_number : 33210889 , base_ru : '19.12' } + - { type : "RUR" , id : 2 , patch_number : 33494256 , base_ru : '19.12' } + - { type : "RUR" , id : 1 , patch_number : 33516456 , base_ru : '19.13' } + - { type : "RUR" , id : 2 , patch_number : 33783771 , base_ru : '19.13' } + - { type : "RUR" , id : 1 , patch_number : 33806138 , base_ru : '19.14' } + - { type : "RUR" , id : 2 , patch_number : 34110559 , base_ru : '19.14' } + - { type : "RUR" , id : 1 , patch_number : 34119532 , base_ru : '19.15' } + - { type : "RUR" , id : 2 , patch_number : 34429835 , base_ru : '19.15' } + - { type : "RUR" , id : 1 , patch_number : 34444812 , base_ru : '19.16' } + - { type : "RUR" , id : 2 , patch_number : 34771828 , base_ru : '19.16' } +# 19c MRP + - { type : "MRP" , id : 221115 , patch_number : 34737974 , base_ru : '19.17' , dep_type : 'RU' , dep_id : 17 , apply_method : "opatchauto" } + - { type : "MRP" , id : 221220 , patch_number : 34819700 , base_ru : '19.17' , dep_type : 'RU' , dep_id : 17 , apply_method : "opatchauto" } + - { type : "MRP" , id : 230117 , patch_number : 34935010 , base_ru : '19.17' , dep_type : 'RU' , dep_id : 17 , apply_method : "opatchauto" } + - { type : "MRP" , id : 230221 , patch_number : 35011213 , base_ru : '19.17' , dep_type : 'RU' , dep_id : 17 , apply_method : "napply" } + - { type : "MRP" , id : 230321 , patch_number : 35154667 , base_ru : '19.17' , dep_type : 'RU' , dep_id : 17 , apply_method : "napply" } + - { type : "MRP" , id : 230418 , patch_number : 35237165 , base_ru : '19.17' , dep_type : 'RU' , dep_id : 17 , apply_method : "napply" } + - { type : "MRP" , id : 230221 , patch_number : 35011316 , base_ru : '19.18' , dep_type : 'RU' , dep_id : 18 , apply_method : "napply" } + - { type : "MRP" , id : 230321 , patch_number : 35155358 , base_ru : '19.18' , dep_type : 'RU' , dep_id : 18 , apply_method : "napply" } + - { type : "MRP" , id : 230418 , patch_number : 35237121 , base_ru : '19.18' , dep_type : 'RU' , dep_id : 18 , apply_method : "napply" } + - { type : "MRP" , id : 230516 , patch_number : 35333818 , base_ru : '19.18' , dep_type : 'RU' , dep_id : 18 , apply_method : "napply" } + - { type : "MRP" , id : 230620 , patch_number : 35449858 , base_ru : '19.18' , dep_type : 'RU' , dep_id : 18 , apply_method : "napply" } + - { type : "MRP" , id : 230718 , patch_number : 35573556 , base_ru : '19.18' , dep_type : 'RU' , dep_id : 18 , apply_method : "napply" } + - { type : "MRP" , id : 230516 , patch_number : 35333937 , base_ru : '19.19' , dep_type : 'RU' , dep_id : 19 , apply_method : "napply" } + - { type : "MRP" , id : 230620 , patch_number : 35449803 , base_ru : '19.19' , dep_type : 'RU' , dep_id : 19 , apply_method : "napply" } + - { type : "MRP" , id : 230718 , patch_number : 35573506 , base_ru : '19.19' , dep_type : 'RU' , dep_id : 19 , apply_method : "napply" } + - { type : "MRP" , id : 230815 , patch_number : 35656804 , base_ru : '19.19' , dep_type : 'RU' , dep_id : 19 , apply_method : "napply" } + - { type : "MRP" , id : 230919 , patch_number : 35755595 , base_ru : '19.19' , dep_type : 'RU' , dep_id : 19 , apply_method : "napply" } + - { type : "MRP" , id : 231017 , patch_number : 35869728 , base_ru : '19.19' , dep_type : 'RU' , dep_id : 19 , apply_method : "napply" } + - { type : "MRP" , id : 230815 , patch_number : 35656870 , base_ru : '19.20' , dep_type : 'RU' , dep_id : 20 , apply_method : "napply" } + - { type : "MRP" , id : 230919 , patch_number : 35755640 , base_ru : '19.20' , dep_type : 'RU' , dep_id : 20 , apply_method : "napply" } + - { type : "MRP" , id : 231017 , patch_number : 35870130 , base_ru : '19.20' , dep_type : 'RU' , dep_id : 20 , apply_method : "napply" } + - { type : "MRP" , id : 231121 , patch_number : 35972850 , base_ru : '19.20' , dep_type : 'RU' , dep_id : 20 , apply_method : "napply" } + - { type : "MRP" , id : 231219 , patch_number : 36062341 , base_ru : '19.20' , dep_type : 'RU' , dep_id : 20 , apply_method : "napply" } + - { type : "MRP" , id : 240116 , patch_number : 36155960 , base_ru : '19.20' , dep_type : 'RU' , dep_id : 20 , apply_method : "napply" } + - { type : "MRP" , id : 231121 , patch_number : 35972882 , base_ru : '19.21' , dep_type : 'RU' , dep_id : 21 , apply_method : "napply" } + - { type : "MRP" , id : 231219 , patch_number : 36062320 , base_ru : '19.21' , dep_type : 'RU' , dep_id : 21 , apply_method : "napply" } + - { type : "MRP" , id : 240116 , patch_number : 36155925 , base_ru : '19.21' , dep_type : 'RU' , dep_id : 21 , apply_method : "napply" } + - { type : "MRP" , id : 240220 , patch_number : 36235312 , base_ru : '19.21' , dep_type : 'RU' , dep_id : 21 , apply_method : "napply" } + - { type : "MRP" , id : 240319 , patch_number : 36356936 , base_ru : '19.21' , dep_type : 'RU' , dep_id : 21 , apply_method : "napply" } + - { type : "MRP" , id : 240416 , patch_number : 36484230 , base_ru : '19.21' , dep_type : 'RU' , dep_id : 21 , apply_method : "napply" } + - { type : "MRP" , id : 240220 , patch_number : 36235402 , base_ru : '19.22' , dep_type : 'RU' , dep_id : 22 , apply_method : "napply" } + - { type : "MRP" , id : 240319 , patch_number : 36356978 , base_ru : '19.22' , dep_type : 'RU' , dep_id : 22 , apply_method : "napply" } + - { type : "MRP" , id : 240416 , patch_number : 36484234 , base_ru : '19.22' , dep_type : 'RU' , dep_id : 22 , apply_method : "napply" } + - { type : "MRP" , id : 240521 , patch_number : 36576193 , base_ru : '19.22' , dep_type : 'RU' , dep_id : 22 , apply_method : "napply" } + - { type : "MRP" , id : 240618 , patch_number : 36701122 , base_ru : '19.22' , dep_type : 'RU' , dep_id : 22 , apply_method : "napply" } + - { type : "MRP" , id : 240716 , patch_number : 36778719 , base_ru : '19.22' , dep_type : 'RU' , dep_id : 22 , apply_method : "napply" } + - { type : "MRP" , id : 240521 , patch_number : 36576266 , base_ru : '19.23' , dep_type : 'RU' , dep_id : 23 , apply_method : "napply" } + - { type : "MRP" , id : 240618 , patch_number : 36701173 , base_ru : '19.23' , dep_type : 'RU' , dep_id : 23 , apply_method : "napply" } + - { type : "MRP" , id : 240716 , patch_number : 36779386 , base_ru : '19.23' , dep_type : 'RU' , dep_id : 23 , apply_method : "napply" } + - { type : "MRP" , id : 240820 , patch_number : 36907797 , base_ru : '19.23' , dep_type : 'RU' , dep_id : 23 , apply_method : "napply" } + - { type : "MRP" , id : 240917 , patch_number : 37000127 , base_ru : '19.23' , dep_type : 'RU' , dep_id : 23 , apply_method : "napply" } + - { type : "MRP" , id : 241015 , patch_number : 37106548 , base_ru : '19.23' , dep_type : 'RU' , dep_id : 23 , apply_method : "napply" } + - { type : "MRP" , id : 240820 , patch_number : 36907847 , base_ru : '19.24' , dep_type : 'RU' , dep_id : 24 , apply_method : "napply" } + - { type : "MRP" , id : 240917 , patch_number : 37000101 , base_ru : '19.24' , dep_type : 'RU' , dep_id : 24 , apply_method : "napply" } + - { type : "MRP" , id : 241015 , patch_number : 37106585 , base_ru : '19.24' , dep_type : 'RU' , dep_id : 24 , apply_method : "napply" } + - { type : "MRP" , id : 241119 , patch_number : 37243934 , base_ru : '19.24' , dep_type : 'RU' , dep_id : 24 , apply_method : "napply" } + - { type : "MRP" , id : 241217 , patch_number : 37331707 , base_ru : '19.24' , dep_type : 'RU' , dep_id : 24 , apply_method : "napply" } + - { type : "MRP" , id : 250121 , patch_number : 37446443 , base_ru : '19.24' , dep_type : 'RU' , dep_id : 24 , apply_method : "napply" } + - { type : "MRP" , id : 241119 , patch_number : 37244031 , base_ru : '19.25' , dep_type : 'RU' , dep_id : 25 , apply_method : "napply" } + - { type : "MRP" , id : 241217 , patch_number : 37331661 , base_ru : '19.25' , dep_type : 'RU' , dep_id : 25 , apply_method : "napply" } + - { type : "MRP" , id : 250121 , patch_number : 37446465 , base_ru : '19.25' , dep_type : 'RU' , dep_id : 25 , apply_method : "napply" } + - { type : "MRP" , id : 250218 , patch_number : 37546427 , base_ru : '19.25' , dep_type : 'RU' , dep_id : 25 , apply_method : "napply" } + - { type : "MRP" , id : 250318 , patch_number : 37663443 , base_ru : '19.25' , dep_type : 'RU' , dep_id : 25 , apply_method : "napply" } + - { type : "MRP" , id : 250415 , patch_number : 37769916 , base_ru : '19.25' , dep_type : 'RU' , dep_id : 25 , apply_method : "napply" } + - { type : "MRP" , id : 250218 , patch_number : 37546431 , base_ru : '19.26' , dep_type : 'RU' , dep_id : 26 , apply_method : "napply" } + - { type : "MRP" , id : 250318 , patch_number : 37663483 , base_ru : '19.26' , dep_type : 'RU' , dep_id : 26 , apply_method : "napply" } + - { type : "MRP" , id : 250415 , patch_number : 37769923 , base_ru : '19.26' , dep_type : 'RU' , dep_id : 26 , apply_method : "napply" } + - { type : "MRP" , id : 250520 , patch_number : 37921349 , base_ru : '19.26' , dep_type : 'RU' , dep_id : 26 , apply_method : "napply" } + - { type : "MRP" , id : 250617 , patch_number : 38018831 , base_ru : '19.26' , dep_type : 'RU' , dep_id : 26 , apply_method : "napply" } + - { type : "MRP" , id : 250715 , patch_number : 38122842 , base_ru : '19.26' , dep_type : 'RU' , dep_id : 26 , apply_method : "napply" } + - { type : "MRP" , id : 250520 , patch_number : 37921396 , base_ru : '19.27' , dep_type : 'RU' , dep_id : 27 , apply_method : "napply" } + - { type : "MRP" , id : 250617 , patch_number : 38018833 , base_ru : '19.27' , dep_type : 'RU' , dep_id : 27 , apply_method : "napply" } + - { type : "MRP" , id : 250715 , patch_number : 38122859 , base_ru : '19.27' , dep_type : 'RU' , dep_id : 27 , apply_method : "napply" } + - { type : "MRP" , id : 250819 , patch_number : 38276684 , base_ru : '19.27' , dep_type : 'RU' , dep_id : 27 , apply_method : "napply" } + - { type : "MRP" , id : 250916 , patch_number : 38397020 , base_ru : '19.27' , dep_type : 'RU' , dep_id : 27 , apply_method : "napply" } + - { type : "MRP" , id : 251021 , patch_number : 38510189 , base_ru : '19.27' , dep_type : 'RU' , dep_id : 27 , apply_method : "napply" } + - { type : "MRP" , id : 250819 , patch_number : 38277071 , base_ru : '19.28' , dep_type : 'RU' , dep_id : 28 , apply_method : "napply" } + - { type : "MRP" , id : 250916 , patch_number : 38396041 , base_ru : '19.28' , dep_type : 'RU' , dep_id : 28 , apply_method : "napply" } + - { type : "MRP" , id : 251021 , patch_number : 38509376 , base_ru : '19.28' , dep_type : 'RU' , dep_id : 28 , apply_method : "napply" } +# 19c OJVM - { type : "OJVM" , id : 190416 , patch_number : 29548437 } - { type : "OJVM" , id : 190716 , patch_number : 29774421 } - { type : "OJVM" , id : 191015 , patch_number : 30128191 } @@ -395,3 +1043,129 @@ list_19000: - { type : "OJVM" , id : 201020 , patch_number : 31668882 } - { type : "OJVM" , id : 210119 , patch_number : 32067171 } - { type : "OJVM" , id : 210420 , patch_number : 32399816 } + - { type : "OJVM" , id : 210720 , patch_number : 32876380 } + - { type : "OJVM" , id : 211019 , patch_number : 33192694 } + - { type : "OJVM" , id : 220118 , patch_number : 33561310 } + - { type : "OJVM" , id : 220419 , patch_number : 33808367 } + - { type : "OJVM" , id : 220719 , patch_number : 34086870 } + - { type : "OJVM" , id : 221018 , patch_number : 34411846 } + - { type : "OJVM" , id : 230117 , patch_number : 34786990 } + - { type : "OJVM" , id : 230418 , patch_number : 35050341 } + - { type : "OJVM" , id : 230718 , patch_number : 35354406 } + - { type : "OJVM" , id : 231017 , patch_number : 35648110 } + - { type : "OJVM" , id : 240116 , patch_number : 35926646 } + - { type : "OJVM" , id : 240416 , patch_number : 36199232 } + - { type : "OJVM" , id : 240716 , patch_number : 36414915 } + - { type : "OJVM" , id : 241015 , patch_number : 36878697 } + - { type : "OJVM" , id : 250121 , patch_number : 37102264 } + - { type : "OJVM" , id : 250415 , patch_number : 37499406 } + - { type : "OJVM" , id : 250715 , patch_number : 37847857 } + - { type : "OJVM" , id : 251021 , patch_number : 38194382 } +# 19c DPBP + - { type : "DPBP" , id : 10 , patch_number : 32583144 , dep_type : 'RU' , dep_id : 10 } + - { type : "DPBP" , id : 11 , patch_number : 32958059 , dep_type : 'RU' , dep_id : 11 } + - { type : "DPBP" , id : 12 , patch_number : 33590062 , dep_type : 'RU' , dep_id : 12 } + - { type : "DPBP" , id : 13 , patch_number : 33952087 , dep_type : 'RU' , dep_id : 13 } + - { type : "DPBP" , id : 14 , patch_number : 34423086 , dep_type : 'RU' , dep_id : 14 } + - { type : "DPBP" , id : 15 , patch_number : 34547013 , dep_type : 'RU' , dep_id : 15 } + - { type : "DPBP" , id : 16 , patch_number : 34620690 , dep_type : 'RU' , dep_id : 16 } + - { type : "DPBP" , id : 17 , patch_number : 34734035 , dep_type : 'RU' , dep_id : 17 } + - { type : "DPBP" , id : 18 , patch_number : 34972375 , dep_type : 'RU' , dep_id : 18 } + - { type : "DPBP" , id : 19 , patch_number : 35261302 , dep_type : 'RU' , dep_id : 19 } + - { type : "DPBP" , id : 20 , patch_number : 35512813 , dep_type : 'RU' , dep_id : 20 } + - { type : "DPBP" , id : 21 , patch_number : 35787077 , dep_type : 'RU' , dep_id : 21 } + - { type : "DPBP" , id : 22 , patch_number : 36092868 , dep_type : 'RU' , dep_id : 22 } + - { type : "DPBP" , id : 23 , patch_number : 36420641 , dep_type : 'RU' , dep_id : 23 } + - { type : "DPBP" , id : 24 , patch_number : 36682332 , dep_type : 'RU' , dep_id : 24 } + - { type : "DPBP" , id : 25 , patch_number : 37056207 , dep_type : 'RU' , dep_id : 25 } + - { type : "DPBP" , id : 26 , patch_number : 37470729 , dep_type : 'RU' , dep_id : 26 } + - { type : "DPBP" , id : 27 , patch_number : 37777295 , dep_type : 'RU' , dep_id : 27 } + - { type : "DPBP" , id : 28 , patch_number : 38170982 , dep_type : 'RU' , dep_id : 28 } + - { type : "DPBP" , id : 29 , patch_number : 38535360 , dep_type : 'RU' , dep_id : 29 } + +#################### +##### 21.0.0.0 ##### +#################### + +list_21000: +# - { type : "RU" , id : 3 , patch_number : 00000000 , base_snap : "21.2.0" } + - { type : "RU" , id : 4 , patch_number : 33239276 } + - { type : "RU" , id : 5 , patch_number : 33516412 } + - { type : "RU" , id : 6 , patch_number : 33843745 } + - { type : "RU" , id : 7 , patch_number : 34160444 } + - { type : "RU" , id : 8 , patch_number : 34527084 } + - { type : "RU" , id : 9 , patch_number : 34839741 } + - { type : "RU" , id : 10 , patch_number : 35134934 } + - { type : "RU" , id : 11 , patch_number : 35428978 } + - { type : "RU" , id : 12 , patch_number : 35740258 } + - { type : "RU" , id : 13 , patch_number : 36041222 } + - { type : "RU" , id : 14 , patch_number : 36352352 } + - { type : "RU" , id : 15 , patch_number : 36696242 } + - { type : "RU" , id : 16 , patch_number : 36991631 } + - { type : "RU" , id : 17 , patch_number : 37350281 } + - { type : "RU" , id : 18 , patch_number : 37655430 } + - { type : "RU" , id : 19 , patch_number : 38068980 } + - { type : "RU" , id : 20 , patch_number : 38371122 } + - { type : "GI" , id : 4 , patch_number : 33250101 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 5 , patch_number : 33531909 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 6 , patch_number : 33859395 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 7 , patch_number : 34155589 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 8 , patch_number : 34526142 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 9 , patch_number : 34838415 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 10 , patch_number : 35132566 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 11 , patch_number : 35427907 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 12 , patch_number : 35738010 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 13 , patch_number : 36031790 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 14 , patch_number : 36352207 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 15 , patch_number : 36696109 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 16 , patch_number : 36990664 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 17 , patch_number : 37349593 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 18 , patch_number : 37642955 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 19 , patch_number : 38068887 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 20 , patch_number : 38370812 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + +#################### +##### 23.0.0.0 ##### +#################### + +list_23000: +# - { type : "BETA" , id : 1 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.Beta1.tar.gz" } +# - { type : "BETA" , id : 2 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.Beta2.tar.gz" } +# - { type : "BETA" , id : 3 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.Beta3.tar.gz" } +# - { type : "BETA" , id : 4 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.Beta4.tar.gz" } + - { type : "RU" , id : 4 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.RU_4_0.tar.gz" } + - { type : "RU" , id : 4.1 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.RU_4_1.tar.gz" } + - { type : "RU" , id : 5 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.RUGI_5_0.tar.gz" } +# - { type : "RU" , id : 5 , patch_number : 36741532 , dep_type : 'RU' , dep_id : 4 } + - { type : "BASE" , id : 5 , patch_number : 00000000 , apply_method : "tar" , apply_file : "/u01.BASE_5_0.tar.gz" } +# - { type : "RU" , id : 6 , patch_number : 37037086 } +# - { type : "RU" , id : 7 , patch_number : 37366180 } +# - { type : "RU" , id : 8 , patch_number : 37701421 } +# - { type : "RU" , id : 9 , patch_number : 38048302 } +# - { type : "RU" , id : 26 , patch_number : 38404116 } + - { type : "RU" , id : 6 , patch_number : 37037908 , apply_method : "gold_image" } + - { type : "RU" , id : 7 , patch_number : 37370465 , apply_method : "gold_image" } + - { type : "RU" , id : 8 , patch_number : 37703495 , apply_method : "gold_image" } + - { type : "RU" , id : 9 , patch_number : 38053646 , apply_method : "gold_image" } + - { type : "RU" , id : 26 , patch_number : 38411960 , apply_method : "gold_image" } +# - { type : "GI" , id : 5 , patch_number : 36739878 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 6 , patch_number : 37031054 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 7 , patch_number : 37353687 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 8 , patch_number : 37689703 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 9 , patch_number : 38041895 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "GI" , id : 26 , patch_number : 38402446 , apply_method : 'skip' , file_suf : '_xmls' , upload_only : true } + - { type : "FREE" , id : 2 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-database-free-23c-23.2-1.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/23c/dbhomeFree" , expdp_comp : false } + - { type : "FREE" , id : 3 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-database-free-23c-23.3-1.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/23c/dbhomeFree" , expdp_comp : false } + - { type : "FREE" , id : 4 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-database-free-23ai-23.4-1.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/23ai/dbhomeFree" , expdp_comp : false } + - { type : "FREE" , id : 5 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-database-free-23ai-23.5-2.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/23ai/dbhomeFree" , expdp_comp : false } + - { type : "FREE" , id : 6 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-database-free-23ai-23.6-1.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/23ai/dbhomeFree" , expdp_comp : false } + - { type : "FREE" , id : 7 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-database-free-23ai-23.7-1.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/23ai/dbhomeFree" , expdp_comp : false } + - { type : "FREE" , id : 8 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-database-free-23ai-23.8-1.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/23ai/dbhomeFree" , expdp_comp : false } + - { type : "FREE" , id : 9 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-database-free-23ai-23.9-1.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/23ai/dbhomeFree" , expdp_comp : false } + - { type : "FREE" , id : 26 , patch_number : 00000000 , apply_method : "download_rpm" , apply_file : "oracle-ai-database-free-26ai-23.26.0-1.el8.x86_64.rpm" , oracle_sid : "FREE" , oracle_home : "/opt/oracle/product/26ai/dbhomeFree" , expdp_comp : false } +# 23ai DPBP + - { type : "DPBP" , id : 6 , patch_number : 37169536 , dep_type : 'RU' , dep_id : 6 } + - { type : "DPBP" , id : 7 , patch_number : 37491421 , dep_type : 'RU' , dep_id : 7 } + - { type : "DPBP" , id : 8 , patch_number : 37805452 , dep_type : 'RU' , dep_id : 8 } + - { type : "DPBP" , id : 9 , patch_number : 38171540 , dep_type : 'RU' , dep_id : 9 } + - { type : "DPBP" , id : 26 , patch_number : 38504058 , dep_type : 'RU' , dep_id : 26 } \ No newline at end of file diff --git a/list_versions.yml b/list_versions.yml index 490b5bc..3c5e609 100644 --- a/list_versions.yml +++ b/list_versions.yml @@ -5,11 +5,53 @@ # Base Snap: Snapshot on machine that will be used as a base to rollback before every patch apply (must be unique name for each VM). # OPatch File: Filename for OPatch Update. # IP Address: For local SSH connection. +# Out of box ID: What is the ID of the base snap. Null means the base snap is not to be used. list_versions: - - { id : "11.2.0.4" , patch_list : "list_11204" , main_file : "patch_main_11g.yml" , vmachine : "Oracle Linux 6.8" , base_snap : "11.2.0.4 Ready" , opatch_file : "p6880880_112000_Linux-x86-64.zip" , ip : "192.168.56.101" } - - { id : "12.1.0.1" , patch_list : "list_12101" , main_file : "patch_main.yml" , vmachine : "Oracle Linux 6.8" , base_snap : "12.1.0.1 Ready" , opatch_file : "p6880880_200000_Linux-x86-64.zip" , ip : "192.168.56.101" } - - { id : "12.1.0.2" , patch_list : "list_12102" , main_file : "patch_main.yml" , vmachine : "Oracle Linux 6.8" , base_snap : "12.1.0.2 Ready" , opatch_file : "p6880880_200000_Linux-x86-64.zip" , ip : "192.168.56.101" } - - { id : "12.2.0.1" , patch_list : "list_12201" , main_file : "patch_main.yml" , vmachine : "Oracle Linux 6.8" , base_snap : "12.2.0.1 Ready" , opatch_file : "p6880880_200000_Linux-x86-64.zip" , ip : "192.168.56.101" } - - { id : "18.0.0.0" , patch_list : "list_18000" , main_file : "patch_main.yml" , vmachine : "Oracle Linux 6.8" , base_snap : "18.0.0.0 Ready" , opatch_file : "p6880880_200000_Linux-x86-64.zip" , ip : "192.168.56.101" } - - { id : "19.0.0.0" , patch_list : "list_19000" , main_file : "patch_main.yml" , vmachine : "Oracle Linux 7.6" , base_snap : "19.0.0.0 Ready" , opatch_file : "p6880880_200000_Linux-x86-64.zip" , ip : "192.168.56.102" } + - { id : "10.2.0.1" , patch_list : "list_1020X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_102000_Linux-x86-64.zip" } + - { id : "10.2.0.2" , patch_list : "list_1020X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_102000_Linux-x86-64.zip" } + - { id : "10.2.0.3" , patch_list : "list_1020X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_102000_Linux-x86-64.zip" } + - { id : "10.2.0.4" , patch_list : "list_1020X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_102000_Linux-x86-64.zip" } + - { id : "10.2.0.5" , patch_list : "list_1020X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_102000_Linux-x86-64.zip" } + - { id : "11.1.0.6" , patch_list : "list_1110X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_111000_Linux-x86-64.zip" } + - { id : "11.1.0.7" , patch_list : "list_1110X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_111000_Linux-x86-64.zip" } + - { id : "11.2.0.1" , patch_list : "list_1120X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_112000_Linux-x86-64.zip" } + - { id : "11.2.0.2" , patch_list : "list_1120X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_112000_Linux-x86-64.zip" } + - { id : "11.2.0.3" , patch_list : "list_1120X" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_112000_Linux-x86-64.zip" } + - { id : "11.2.0.4" , patch_list : "list_11204" , main_file : "patch_main_11g.yml" , opatch_file : "p6880880_112000_Linux-x86-64.zip" } + - { id : "12.1.0.1" , patch_list : "list_12101" , main_file : "patch_main.yml" , opatch_file : "p6880880_210000_Linux-x86-64.zip" } + - { id : "12.1.0.2" , patch_list : "list_12102" , main_file : "patch_main.yml" , opatch_file : "p6880880_210000_Linux-x86-64.zip" } + - { id : "12.2.0.1" , patch_list : "list_12201" , main_file : "patch_main.yml" , opatch_file : "p6880880_210000_Linux-x86-64.zip" } + - { id : "18.0.0.0" , patch_list : "list_18000" , main_file : "patch_main.yml" , opatch_file : "p6880880_210000_Linux-x86-64.zip" } + - { id : "19.0.0.0" , patch_list : "list_19000" , main_file : "patch_main.yml" , opatch_file : "p6880880_210000_Linux-x86-64.zip" } + - { id : "21.0.0.0" , patch_list : "list_21000" , main_file : "patch_main.yml" , opatch_file : "p6880880_210000_Linux-x86-64.zip" } + - { id : "23.0.0.0" , patch_list : "list_23000" , main_file : "patch_main.yml" , opatch_file : "p6880880_230000_Linux-x86-64.zip" } + +list_info_vbox: + - { id : "11.2.0.4" , vmachine : "Oracle Linux 6.8" , base_snap : "11.2.0.4 Ready" , ip : "xxx" } + - { id : "12.1.0.1" , vmachine : "Oracle Linux 6.8" , base_snap : "12.1.0.1 Ready" , ip : "xxx" } + - { id : "12.1.0.2" , vmachine : "Oracle Linux 6.8" , base_snap : "12.1.0.2 Ready" , ip : "xxx" } + - { id : "12.2.0.1" , vmachine : "Oracle Linux 6.8" , base_snap : "12.2.0.1 Ready" , ip : "xxx" } + - { id : "18.0.0.0" , vmachine : "Oracle Linux 6.8" , base_snap : "18.0.0.0 Ready" , ip : "xxx" } + - { id : "19.0.0.0" , vmachine : "Oracle Linux 7.6" , base_snap : "19.0.0.0 Ready" , ip : "xxx" } + - { id : "21.0.0.0" , vmachine : "Oracle Linux 8" , base_snap : "21.0.0.0 Ready" , ip : "xxx" } + +list_info_oci: + - { id : "10.2.0.1" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "10.2.0.2" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "10.2.0.3" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "10.2.0.4" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "10.2.0.5" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "11.1.0.6" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "11.1.0.7" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "11.2.0.1" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "11.2.0.2" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "11.2.0.3" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : null } + - { id : "11.2.0.4" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : 0 } + - { id : "12.1.0.1" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : 0 } + - { id : "12.1.0.2" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : 0 } + - { id : "12.2.0.1" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : 0 } + - { id : "18.0.0.0" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : 3 } + - { id : "19.0.0.0" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : 3 } + - { id : "21.0.0.0" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : 3 } + - { id : "23.0.0.0" , oci_instance_id : "ocid1.instance.oc1.phx.xxx" , base_snap : "base" , out_of_box_id : 5 } diff --git a/loader.yml b/loader.yml index 8fd5d3e..42d112f 100644 --- a/loader.yml +++ b/loader.yml @@ -17,7 +17,6 @@ #************************************************************************ # Available at: https://github.com/dbarj/oracle_patch_loop/ # Created on: May/2019 by Rodrigo Jorge -# Version 1.02 #************************************************************************ - hosts: localhost @@ -35,8 +34,38 @@ tasks: + - include: tasks/main_loader.yml db_version="10.2.0.1" + when: param_version is undefined or param_version == "10.2.0.1" or param_version == "10.2" + + - include: tasks/main_loader.yml db_version="10.2.0.2" + when: param_version is undefined or param_version == "10.2.0.2" or param_version == "10.2" + + - include: tasks/main_loader.yml db_version="10.2.0.3" + when: param_version is undefined or param_version == "10.2.0.3" or param_version == "10.2" + + - include: tasks/main_loader.yml db_version="10.2.0.4" + when: param_version is undefined or param_version == "10.2.0.4" or param_version == "10.2" + + - include: tasks/main_loader.yml db_version="10.2.0.5" + when: param_version is undefined or param_version == "10.2.0.5" or param_version == "10.2" + + - include: tasks/main_loader.yml db_version="11.1.0.6" + when: param_version is undefined or param_version == "11.1.0.6" or param_version == "11.1" + + - include: tasks/main_loader.yml db_version="11.1.0.7" + when: param_version is undefined or param_version == "11.1.0.7" or param_version == "11.1" + + - include: tasks/main_loader.yml db_version="11.2.0.1" + when: param_version is undefined or param_version == "11.2.0.1" or param_version == "11.2" + + - include: tasks/main_loader.yml db_version="11.2.0.2" + when: param_version is undefined or param_version == "11.2.0.2" or param_version == "11.2" + + - include: tasks/main_loader.yml db_version="11.2.0.3" + when: param_version is undefined or param_version == "11.2.0.3" or param_version == "11.2" + - include: tasks/main_loader.yml db_version="11.2.0.4" - when: param_version is undefined or param_version == "11.2.0.4" + when: param_version is undefined or param_version == "11.2.0.4" or param_version == "11.2" - include: tasks/main_loader.yml db_version="12.1.0.1" when: param_version is undefined or param_version == "12.1.0.1" diff --git a/loader_adb.yml b/loader_adb.yml new file mode 100644 index 0000000..05f03ca --- /dev/null +++ b/loader_adb.yml @@ -0,0 +1,90 @@ +#************************************************************************ +# +# Oracle Patch Loop Applier +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#************************************************************************ +# Available at: https://github.com/dbarj/oracle_patch_loop/ +# Created on: May/2019 by Rodrigo Jorge +#************************************************************************ + +- hosts: localhost + gather_facts: true + become: false + any_errors_fatal: true + + vars_files: + - config_main.yml + - config_oci.yml + - list_versions.yml + - list_patches.yml + + pre_tasks: + - import_tasks: tasks/setup_env.yml + + tasks: + + - include: tasks/main_loader_adb.yml db_version="10.2.0.1" + when: param_version is undefined or param_version == "10.2.0.1" or param_version == "10.2" + + - include: tasks/main_loader_adb.yml db_version="10.2.0.2" + when: param_version is undefined or param_version == "10.2.0.2" or param_version == "10.2" + + - include: tasks/main_loader_adb.yml db_version="10.2.0.3" + when: param_version is undefined or param_version == "10.2.0.3" or param_version == "10.2" + + - include: tasks/main_loader_adb.yml db_version="10.2.0.4" + when: param_version is undefined or param_version == "10.2.0.4" or param_version == "10.2" + + - include: tasks/main_loader_adb.yml db_version="10.2.0.5" + when: param_version is undefined or param_version == "10.2.0.5" or param_version == "10.2" + + - include: tasks/main_loader_adb.yml db_version="11.1.0.6" + when: param_version is undefined or param_version == "11.1.0.6" or param_version == "11.1" + + - include: tasks/main_loader_adb.yml db_version="11.1.0.7" + when: param_version is undefined or param_version == "11.1.0.7" or param_version == "11.1" + + - include: tasks/main_loader_adb.yml db_version="11.2.0.1" + when: param_version is undefined or param_version == "11.2.0.1" or param_version == "11.2" + + - include: tasks/main_loader_adb.yml db_version="11.2.0.2" + when: param_version is undefined or param_version == "11.2.0.2" or param_version == "11.2" + + - include: tasks/main_loader_adb.yml db_version="11.2.0.3" + when: param_version is undefined or param_version == "11.2.0.3" or param_version == "11.2" + + - include: tasks/main_loader_adb.yml db_version="11.2.0.4" + when: param_version is undefined or param_version == "11.2.0.4" or param_version == "11.2" + + - include: tasks/main_loader_adb.yml db_version="12.1.0.1" + when: param_version is undefined or param_version == "12.1.0.1" + + - include: tasks/main_loader_adb.yml db_version="12.1.0.2" + when: param_version is undefined or param_version == "12.1.0.2" + + - include: tasks/main_loader_adb.yml db_version="12.2.0.1" + when: param_version is undefined or param_version == "12.2.0.1" + + - include: tasks/main_loader_adb.yml db_version="18.0.0.0" + when: param_version is undefined or param_version == "18.0.0.0" + + - include: tasks/main_loader_adb.yml db_version="19.0.0.0" + when: param_version is undefined or param_version == "19.0.0.0" + + - include: tasks/main_loader_adb.yml db_version="21.0.0.0" + when: param_version is undefined or param_version == "21.0.0.0" + + - include: tasks/main_loader_adb.yml db_version="23.0.0.0" + when: param_version is undefined or param_version == "23.0.0.0" diff --git a/loader_manual.yml b/loader_manual.yml new file mode 100644 index 0000000..4b43f3e --- /dev/null +++ b/loader_manual.yml @@ -0,0 +1,37 @@ +#************************************************************************ +# +# Oracle Patch Loop Applier +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#************************************************************************ +# Available at: https://github.com/dbarj/oracle_patch_loop/ +# Created on: May/2019 by Rodrigo Jorge +#************************************************************************ + +- hosts: localhost + gather_facts: true + become: false + any_errors_fatal: true + + vars_files: + - config_main.yml + - config_oci.yml + - list_versions.yml + - list_patches.yml + + pre_tasks: + - import_tasks: tasks/setup_env.yml + + tasks: + - include: tasks/main_loader_manual.yml diff --git a/main.yml b/main.yml index d02b71e..209e2ff 100644 --- a/main.yml +++ b/main.yml @@ -17,7 +17,6 @@ #************************************************************************ # Available at: https://github.com/dbarj/oracle_patch_loop/ # Created on: May/2019 by Rodrigo Jorge -# Version 1.05 #************************************************************************ - hosts: localhost @@ -26,18 +25,54 @@ any_errors_fatal: true vars_files: - - config_vars.yml + - config_main.yml - list_versions.yml - list_patches.yml - - list_exceptions.yml - - pre_tasks: - - import_tasks: tasks/setup_env.yml + - list_exceptions.yml tasks: + - include_vars: config_vbox.yml + when: not oci_mode + + - include_vars: config_oci.yml + when: oci_mode + + - import_tasks: tasks/config_checks.yml + - import_tasks: tasks/setup_env.yml + + - include: tasks/main_PSU_BP.yml db_version="10.2.0.1" + when: param_version is undefined or param_version == "10.2.0.1" or param_version == "10.2" + + - include: tasks/main_PSU_BP.yml db_version="10.2.0.2" + when: param_version is undefined or param_version == "10.2.0.2" or param_version == "10.2" + + - include: tasks/main_PSU_BP.yml db_version="10.2.0.3" + when: param_version is undefined or param_version == "10.2.0.3" or param_version == "10.2" + + - include: tasks/main_PSU_BP.yml db_version="10.2.0.4" + when: param_version is undefined or param_version == "10.2.0.4" or param_version == "10.2" + + - include: tasks/main_PSU_BP.yml db_version="10.2.0.5" + when: param_version is undefined or param_version == "10.2.0.5" or param_version == "10.2" + + - include: tasks/main_PSU_BP.yml db_version="11.1.0.6" + when: param_version is undefined or param_version == "11.1.0.6" or param_version == "11.1" + + - include: tasks/main_PSU_BP.yml db_version="11.1.0.7" + when: param_version is undefined or param_version == "11.1.0.7" or param_version == "11.1" + + - include: tasks/main_PSU_BP.yml db_version="11.2.0.1" + when: param_version is undefined or param_version == "11.2.0.1" or param_version == "11.2" + + - include: tasks/main_PSU_BP.yml db_version="11.2.0.2" + when: param_version is undefined or param_version == "11.2.0.2" or param_version == "11.2" + + - include: tasks/main_PSU_BP.yml db_version="11.2.0.3" + when: param_version is undefined or param_version == "11.2.0.3" or param_version == "11.2" + - include: tasks/main_PSU_BP.yml db_version="11.2.0.4" - when: param_version is undefined or param_version == "11.2.0.4" + when: param_version is undefined or param_version == "11.2.0.4" or param_version == "11.2" - include: tasks/main_PSU_BP.yml db_version="12.1.0.1" when: param_version is undefined or param_version == "12.1.0.1" @@ -53,3 +88,9 @@ - include: tasks/main_RU_RUR.yml db_version="19.0.0.0" when: param_version is undefined or param_version == "19.0.0.0" + + - include: tasks/main_RU_RUR.yml db_version="21.0.0.0" + when: param_version is undefined or param_version == "21.0.0.0" + + - include: tasks/main_RU_RUR.yml db_version="23.0.0.0" + when: param_version is undefined or param_version == "23.0.0.0" diff --git a/patch_sql/applySQLPatch.sql b/patch_sql/applySQLPatch.sql deleted file mode 100755 index 100ee17..0000000 --- a/patch_sql/applySQLPatch.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Param 1 will be "exa" for BP or "psu" for PSU -@?/rdbms/admin/catbundle.sql &1 apply -exit; diff --git a/patch_sql/applySQLPatchOJVM.sql b/patch_sql/applySQLPatchOJVM.sql old mode 100755 new mode 100644 diff --git a/patch_sql/shutdown.sql b/patch_sql/shutdown.sql old mode 100755 new mode 100644 diff --git a/patch_sql/startup.sql b/patch_sql/startup.sql old mode 100755 new mode 100644 diff --git a/patch_sql/startupCDB.sql b/patch_sql/startupCDB.sql index cc9343e..fb71438 100644 --- a/patch_sql/startupCDB.sql +++ b/patch_sql/startupCDB.sql @@ -1,3 +1,4 @@ +whenever sqlerror exit sql.sqlcode startup; alter pluggable database all open; exit; diff --git a/patch_sql/startupCDBOJVM.sql b/patch_sql/startupCDBOJVM.sql index 796289c..cf963d5 100644 --- a/patch_sql/startupCDBOJVM.sql +++ b/patch_sql/startupCDBOJVM.sql @@ -1,3 +1,4 @@ +whenever sqlerror exit sql.sqlcode startup upgrade; alter pluggable database all open upgrade; exit; diff --git a/roles/oci_compute_instance_actions/meta/main.yml b/roles/oci_compute_instance_actions/meta/main.yml new file mode 100644 index 0000000..b42ca0c --- /dev/null +++ b/roles/oci_compute_instance_actions/meta/main.yml @@ -0,0 +1,2 @@ +collections: + - oracle.oci \ No newline at end of file diff --git a/roles/oci_compute_instance_actions/tasks/main.yml b/roles/oci_compute_instance_actions/tasks/main.yml new file mode 100644 index 0000000..25cd54f --- /dev/null +++ b/roles/oci_compute_instance_actions/tasks/main.yml @@ -0,0 +1,61 @@ +- name: Perform action "{{ compute_action }}" on instance + oci_compute_instance_actions: + instance_id: "{{ oci_instance_id }}" + action: "{{ compute_action }}" + register: oci_action + +- block: + + - name: Get the VNIC attachment details of instance + oci_compute_vnic_attachment_facts: + compartment_id: "{{ oci_compartment_id }}" + instance_id: "{{ oci_instance_id }}" + register: result + + - name: Get details of the VNIC + oci_network_vnic_facts: + id: "{{ result.vnic_attachments[0].vnic_id }}" + register: result + + - set_fact: + vm_ip_address: "{{result.vnic.private_ip}}" + + - name: Print the private ip of the newly launched instance + debug: + msg: "Private IP of launched instance {{ vm_ip_address }}" + + - name: Wait (up to 2 minutes) for port 22 to become open + wait_for: + port: 22 + host: '{{ vm_ip_address }}' + state: started + delay: 10 + timeout: 120 + vars: + ansible_connection: local + when: oci_action.changed + + - name: Wait (up to 10 seconds) for port 22 to become open + wait_for: + port: 22 + host: '{{ vm_ip_address }}' + state: started + timeout: 10 + vars: + ansible_connection: local + when: not oci_action.changed + + - name: Ensure shared disk "{{ VM_mount }}" is mounted + shell: | + set -eo pipefail + if mount | grep -q -F ' {{ VM_mount }} ' + then + echo ok + else + mount {{ VM_mount }} + fi + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + + when: compute_action == "start" \ No newline at end of file diff --git a/roles/oci_object_storage_object/meta/main.yml b/roles/oci_object_storage_object/meta/main.yml new file mode 100644 index 0000000..b42ca0c --- /dev/null +++ b/roles/oci_object_storage_object/meta/main.yml @@ -0,0 +1,2 @@ +collections: + - oracle.oci \ No newline at end of file diff --git a/roles/oci_object_storage_object/tasks/main.yml b/roles/oci_object_storage_object/tasks/main.yml new file mode 100644 index 0000000..9717d1e --- /dev/null +++ b/roles/oci_object_storage_object/tasks/main.yml @@ -0,0 +1,26 @@ +- name: Upload file to object storage + oci_object_storage_object: + namespace_name: "{{ oci_namespace }}" + bucket_name: "{{ oci_upload_bucket }}" + object_name: "{{ oci_object_name }}" + src: "{{ oci_upload_file }}" + state: present + register: tmp_oci_action_result + when: object_action == "create" + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: oci_action="{{tmp_oci_action_result}}" + when: tmp_oci_action_result is not skipped + +- name: Remove file from object storage + oci_object_storage_object: + namespace_name: "{{ oci_namespace }}" + bucket_name: "{{ oci_upload_bucket }}" + object_name: "{{ oci_object_name }}" + state: absent + register: tmp_oci_action_result + when: object_action == "remove" + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: oci_action="{{tmp_oci_action_result}}" + when: tmp_oci_action_result is not skipped diff --git a/roles/oci_object_storage_object_facts/meta/main.yml b/roles/oci_object_storage_object_facts/meta/main.yml new file mode 100644 index 0000000..b42ca0c --- /dev/null +++ b/roles/oci_object_storage_object_facts/meta/main.yml @@ -0,0 +1,2 @@ +collections: + - oracle.oci \ No newline at end of file diff --git a/roles/oci_object_storage_object_facts/tasks/main.yml b/roles/oci_object_storage_object_facts/tasks/main.yml new file mode 100644 index 0000000..56a1008 --- /dev/null +++ b/roles/oci_object_storage_object_facts/tasks/main.yml @@ -0,0 +1,24 @@ +- name: Download file from object storage + oci_object_storage_object_facts: + namespace_name: "{{ oci_namespace }}" + bucket_name: "{{ oci_download_bucket }}" + object_name: "{{ oci_download_file }}" + auth_type: instance_principal + dest: "{{ oci_dest_file }}" + register: tmp_oci_action_result + when: object_action == "download" + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: oci_action="{{tmp_oci_action_result}}" + when: tmp_oci_action_result is not skipped + +- name: List files from object storage + oci_object_storage_object_facts: + namespace_name: "{{ oci_namespace }}" + bucket_name: "{{ oci_list_bucket }}" + register: tmp_oci_action_result + when: object_action == "list" + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: oci_action="{{tmp_oci_action_result}}" + when: tmp_oci_action_result is not skipped diff --git a/set_version.yml b/set_version.yml new file mode 100644 index 0000000..494598e --- /dev/null +++ b/set_version.yml @@ -0,0 +1,59 @@ +#************************************************************************ +# +# Oracle Patch Loop Applier +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#************************************************************************ +# Available at: https://github.com/dbarj/oracle_patch_loop/ +# Created on: May/2019 by Rodrigo Jorge +#************************************************************************ + +- hosts: localhost + gather_facts: true + become: false + any_errors_fatal: true + + vars_files: + - config_main.yml + - list_versions.yml + - list_patches.yml + - list_exceptions.yml + + tasks: + + - name: Variables not provided + fail: + msg: "Variables param_version / param_type / param_patch must be defined." + when: param_version is undefined or param_type is undefined or param_patch is undefined + + - include_vars: config_vbox.yml + when: not oci_mode + + - include_vars: config_oci.yml + when: oci_mode + + - import_tasks: tasks/setup_env.yml + + - name : Replace settings + set_fact: + skip_dump_exists: false + only_deploy_patch: true + + - include: tasks/main_PSU_BP.yml db_version="{{ param_version }}" +# when: param_version == "11.2.0.2" or param_version == "11.2.0.3" or param_version == "11.2.0.4" or param_version == "12.1.0.1" or param_version == "12.1.0.2" + when: ( param_version | regex_replace('^([^\.]+).*','\\1') | int ) <= 11 or param_version == "12.1.0.1" or param_version == "12.1.0.2" + + - include: tasks/main_RU_RUR.yml db_version="{{ param_version }}" +# when: not(param_version == "11.2.0.2" or param_version == "11.2.0.3" or param_version == "11.2.0.4" or param_version == "12.1.0.1" or param_version == "12.1.0.2") + when: ( param_version | regex_replace('^([^\.]+).*','\\1') | int ) > 12 and param_version != "12.1.0.1" and param_version != "12.1.0.2" \ No newline at end of file diff --git a/tasks/clean_ojvm_dumps.yml b/tasks/clean_ojvm_dumps.yml new file mode 100644 index 0000000..16e131a --- /dev/null +++ b/tasks/clean_ojvm_dumps.yml @@ -0,0 +1,22 @@ +## This code will clean all OJVM dump files from past executions that have a old RU or PSU base. + +- name: "Remove old OJVM expdp dumps for previous RU or PSU if exists." + shell: | + set -eo pipefail + set -x + + v_ojvm_path="{{ output_folder }}/expdp" + v_ojvm_pref="tables_{{ db_version }}_OJVM" + v_ojvm_name="${v_ojvm_pref}.txt" + v_ojvm_base_file="${v_ojvm_path}/${v_ojvm_name}" + + [ ! -f "${v_ojvm_base_file}" ] && touch "${v_ojvm_base_file}" + + v_ojvm_val=$(cat "${v_ojvm_base_file}") + + if [ "${v_ojvm_val}" != "{{ base_id }}" ] + then + find "{{ output_folder }}" -name "*_{{ db_version }}_OJVM_*" -delete + # rm -f ${v_ojvm_path}/${v_ojvm_pref}_* + echo "{{ base_id }}" > "${v_ojvm_base_file}" + fi diff --git a/tasks/config_checks.yml b/tasks/config_checks.yml new file mode 100644 index 0000000..26f031f --- /dev/null +++ b/tasks/config_checks.yml @@ -0,0 +1,39 @@ +- block: + # download_patch == true + + - name: Variable downloader_tool not provided + fail: + msg: "Variable downloader_tool must be defined when download_patch is true." + when: downloader_tool is undefined or (downloader_tool|length == 0) + + - name: Variable downloader_user not provided + fail: + msg: "Variable downloader_user must be defined when download_patch is true." + when: downloader_user is undefined or (downloader_user|length == 0) + + - name: Variable downloader_pass not provided + fail: + msg: "Variable downloader_pass must be defined when download_patch is true." + when: downloader_pass is undefined or (downloader_pass|length == 0) + + - name: "Check if {{ downloader_tool }} exists" + stat: + path: "{{ downloader_tool }}" + register: downloader_tool_result + + - name: Tool does not exist + fail: + msg: "{{ downloader_tool }} must exist when download_patch is true." + when: downloader_tool_result.stat.exists == false + + when: download_patch == true + +- name: Check patch_location_type variable + fail: + msg: 'patch_location_type must be "folder" or "bucket".' + when: patch_location_type != "folder" and patch_location_type != "bucket" + +- name: Check oci_adb_use_wallet variable + fail: + msg: 'oci_adb_use_wallet must be "true" or "false".' + when: oci_adb_use_wallet != true and oci_adb_use_wallet != false \ No newline at end of file diff --git a/tasks/datapatch.yml b/tasks/datapatch.yml index d7fc8f3..d2aa434 100644 --- a/tasks/datapatch.yml +++ b/tasks/datapatch.yml @@ -1,7 +1,8 @@ - name: Run Datapatch shell: | export ORACLE_HOME ORACLE_SID - ./datapatch -verbose >> /tmp/datapatch.log 2>&1 + [ ! -d ~/datapatch_logs ] && mkdir ~/datapatch_logs + ./datapatch -verbose 2>&1 | tee ~/datapatch_logs/datapatch.{{ file_suffix }}_{{ datapatch_try }}.log environment: ORACLE_HOME: "{{ dbhome_locl }}" ORACLE_SID: "{{ mysid }}" diff --git a/tasks/download_patch.yml b/tasks/download_patch.yml new file mode 100644 index 0000000..1672eb8 --- /dev/null +++ b/tasks/download_patch.yml @@ -0,0 +1,50 @@ +- block: + + - name: "Get password for {{ downloader_user }}" + pause: + prompt: "Enter password for {{ downloader_user }}: " + echo: false + register: input + + - name: Set Password + set_fact: + downloader_pass: "{{ input.user_input }}" + + when: downloader_pass is undefined + +- name: "Calling {{ downloader_tool }}" + shell: | + [ ! -d "{{ db_version }}/{{ patch.type }}" ] && mkdir -p "{{ db_version }}/{{ patch.type }}" + cd "{{ db_version }}/{{ patch.type }}" + $ORACLE_HOME/jdk/bin/java -jar {{ downloader_tool }} \ + patch={{ patch.patch_number }}{{ patch.file_suf | default('') }} \ + platform=226P \ + download=all \ + silent=yes \ + regexp='.*_{{ db_version | replace('.','') }}0_.*' \ + MOSUser={{ downloader_user }} \ + MOSPass='{{ downloader_pass }}' + args: + chdir: "{{ patch_location_path }}" + +# If block storage: +- block: + + - name: Get patch file name to upload to OS + find: + paths: "{{ patch_location_path }}" + patterns: "p{{ patch.patch_number }}_{{ db_version | regex_replace('\\.','') }}0_Linux-x86-64{{ patch.file_suf | default('') }}.zip" + file_type: "file" + register: get_name + + - name: + include_role: + name: oci_object_storage_object + vars: + oci_upload_file: "{{ get_name.files[0].path }}" + oci_object_name: "{{ db_version }}/{{ patch.type }}/{{ get_name.files[0].path | basename }}" + oci_upload_bucket: "{{ patch_location_bucket }}" + object_action: "create" + when: get_name.files[0] is defined + + when: patch_location_type == "bucket" \ No newline at end of file diff --git a/tasks/find_patch.yml b/tasks/find_patch.yml new file mode 100644 index 0000000..0a7099b --- /dev/null +++ b/tasks/find_patch.yml @@ -0,0 +1,98 @@ +# If bucket +- block: + + - name: List files in OCI Bucket + include_role: + name: oci_object_storage_object_facts + vars: + object_action: "list" + oci_list_bucket: "{{ patch_location_bucket }}" + + # For debugging + # - name: Check if patch is in the bucket + # debug: msg="{{ oci_action.objects | map(attribute='name') | select('search', my_query) | list }}" + # vars: + # my_query: "p{{ patch.patch_number }}" + + - name: Download file from OCI Bucket (Version filter included) + shell: | + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + oci os object get --bucket-name {{ patch_location_bucket }} --name {{ oci_download_file }} --file {{ patch_location_path }}/{{ oci_download_file | basename }} + vars: + my_query: "p{{ patch.patch_number }}_{{ db_version | regex_replace('\\.','') }}" + oci_download_file: "{{ oci_action.objects | map(attribute='name') | select('search',(patch.file_suf | default('')) ~ '.zip') | select('search', my_query) | list | first }}" + when: + - oci_action.objects | map(attribute='name') | select('search', my_query) | list | length > 0 + - patch.type != "MRP" and patch.type != "DPBP" + + - name: Download file from OCI Bucket (Version filter excluded) + shell: | + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + oci os object get --bucket-name {{ patch_location_bucket }} --name {{ oci_download_file }} --file {{ patch_location_path }}/{{ oci_download_file | basename }} + vars: + my_query: "p{{ patch.patch_number }}" + oci_download_file: "{{ oci_action.objects | map(attribute='name') | select('search',(patch.file_suf | default('')) ~ '.zip') | select('search', my_query) | list | first }}" + when: + - oci_action.objects | map(attribute='name') | select('search', my_query) | list | length > 0 + - patch.type == "MRP" or patch.type == "DPBP" + + when: patch_location_type == "bucket" + +- name: Finding Patch File + find: + paths: "{{ patch_location_path }}" + patterns: "p{{ patch.patch_number }}_{{ db_version | regex_replace('\\.','') }}_Linux-x86-64{{ patch.file_suf | default('') }}.zip" + recurse: "yes" + file_type: "file" + register: tmp_find_result + when: ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) <= 10 + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: find_result="{{tmp_find_result}}" + when: tmp_find_result is not skipped + +- name: Finding Patch File + find: + paths: "{{ patch_location_path }}" + patterns: "p{{ patch.patch_number }}_{{ db_version | regex_replace('\\.','') }}0_Linux-x86-64{{ patch.file_suf | default('') }}.zip" + recurse: "yes" + file_type: "file" + register: tmp_find_result + when: patch.type != "MRP" and patch.type != "DPBP" and ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) > 10 + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: find_result="{{tmp_find_result}}" + when: tmp_find_result is not skipped + +- name: Finding Patch File + find: + paths: "{{ patch_location_path }}" + patterns: "p{{ patch.patch_number }}_*DBRU_Linux-x86-64{{ patch.file_suf | default('') }}.zip" + recurse: "yes" + file_type: "file" + register: tmp_find_result + when: patch.type == "MRP" + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: find_result="{{tmp_find_result}}" + when: tmp_find_result is not skipped + +- name: Finding Patch File + find: + paths: "{{ patch_location_path }}" + patterns: "p{{ patch.patch_number }}_*DBRU_Generic{{ patch.file_suf | default('') }}.zip" + recurse: "yes" + file_type: "file" + register: tmp_find_result + when: patch.type == "DPBP" + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: find_result="{{tmp_find_result}}" + when: tmp_find_result is not skipped + +- name : Define patch_file_path + set_fact: + patch_file_path: "{{ find_result.files[0].path }}" + when: find_result.files[0] is defined diff --git a/tasks/free_rpm_download.yml b/tasks/free_rpm_download.yml new file mode 100644 index 0000000..1305818 --- /dev/null +++ b/tasks/free_rpm_download.yml @@ -0,0 +1,136 @@ +# If bucket +- block: + + - name: List files in OCI Bucket + include_role: + name: oci_object_storage_object_facts + vars: + object_action: "list" + oci_list_bucket: "{{ patch_location_bucket }}" + + - name: Download RPM file from OCI Bucket + shell: | + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + oci os object get --bucket-name {{ patch_location_bucket }} --name {{ oci_download_file }} --file {{ shared_folder }}/{{ oci_download_file | basename }} + vars: + my_query: "{{ patch.apply_file }}" + oci_download_file: "{{ oci_action.objects | map(attribute='name') | select('search', my_query) | list | first }}" + when: oci_action.objects | map(attribute='name') | select('search', my_query) | list | length > 0 + + when: patch_location_type == "bucket" + +- name: Finding RPM File + find: + paths: "{{ shared_folder }}" + patterns: "{{ patch.apply_file }}" + recurse: "no" + file_type: "file" + register: find_result + +# If RPM was not found +- name: Could not find RPM file + fail: + msg: "Could not find RPM file." + when: find_result.files[0] is undefined + +## FREE RPM ## + +- name: Deploy new ORACLE_HOME + shell: | + set -eo pipefail + # Recreate oracle home + rm -rf /u01/app/oracle/product/database/dbhome_1 + mkdir /u01/app/oracle/product/database/dbhome_1 + # Unzip RPM + cd /u01/install + (rm -rf tmp; mkdir tmp; cd tmp; rpm2cpio {{ shared_folder }}/{{ patch.apply_file }} | cpio -i -d) + # Move RPM contents + mv ./tmp/opt/oracle/product/*/*/* $ORACLE_HOME + rmdir -p ./tmp/opt/oracle/product/*/*/ || true + # Clean leftover files + [ -d ./tmp/opt/ ] && exit 1 + rm -rf tmp + # Recreate oradata/fra + rm -rf /u01/app/{oradata,fra}; mkdir /u01/app/{oradata,fra} + # Remove old entries from inventory + sed -i '/^ /tmp/oratab.new; cat /tmp/oratab.new > /etc/oratab; rm -f /tmp/oratab.new + # Attach new home + $ORACLE_HOME/oui/bin/attachHome.sh -silent -ignoreSysPrereqs -force INVENTORY_LOCATION=/u01/app/oraInstall + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + register: shell_output + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + +- name: Call root.sh + shell: | + set -eo pipefail + $ORACLE_HOME/root.sh + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + +- name: Create new database + shell: | + set -eo pipefail + set +e + # Create database + $ORACLE_HOME/bin/dbca -silent -createDatabase \ + -gdbName orcl \ + -templateName FREE_Database.dbc \ + -characterSet AL32UTF8 \ + -createAsContainerDatabase true \ + -numberOfPDBs 1 \ + -pdbAdminPassword "Rodrigo.123" \ + -pdbName PDB01 \ + -useLocalUndoForPDBs true \ + -databaseConfigType SINGLE \ + -databaseType MULTIPURPOSE \ + -datafileDestination /u01/app/oradata \ + -dvConfiguration false \ + -emConfiguration NONE \ + -enableArchive false \ + -memoryMgmtType AUTO_SGA \ + -totalMemory 4000 \ + -nationalCharacterSet AL16UTF16 \ + -olsConfiguration false \ + -recoveryAreaDestination /u01/app/fra \ + -sampleSchema false \ + -sid FREE \ + -storageType FS \ + -useOMF false \ + -sysPassword "Rodrigo.123" \ + -systemPassword "Rodrigo.123" + v_ret=$? + # ret = 6 is "Successfully Setup Software with warning(s)." + if [ ${v_ret} -ne 0 -a ${v_ret} -ne 6 ] + then + exit 1 + fi + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + register: shell_output + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + +- name: DBCA Output + debug: msg="{{ shell_output.stdout_lines }}" + when: shell_output.stdout_lines is defined + +- name : "Remove RPM {{ find_result.files[0].path }} from shared folder" + file: + state: absent + path: "{{ find_result.files[0].path }}" + +# Stop the database +- include: run_sql.yml + vars: + sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database" } \ No newline at end of file diff --git a/tasks/impdp_file.yml b/tasks/impdp_file.yml index f8a46e5..bb0fd85 100644 --- a/tasks/impdp_file.yml +++ b/tasks/impdp_file.yml @@ -3,45 +3,46 @@ - name : Define file names set_fact: - dump_file_prefix: "tables_{{ db_version }}_{{ patch.base_ru | default('')}}{{ patch.type }}_{{ patch.id }}" + # file_suffix: "{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}" + dump_file_prefix: "tables_{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}" -- name: "Check if {{ dump_folder }}/{{ dump_file_prefix }}.dmp exists" +- name: "Check if {{ output_folder }}/expdp/{{ dump_file_prefix }}.dmp exists" stat: - path: "{{ dump_folder }}/{{ dump_file_prefix }}.dmp" - register: dump_stat_result + path: "{{ output_folder }}/expdp/{{ dump_file_prefix }}.dmp" + register: load_file_stat_result - fail: msg: "Could not find dump file." - when: dump_stat_result.stat.exists == false + when: load_file_stat_result.stat.exists == false - name: "Copy {{ dump_file_prefix }}.dmp to shared_folder" copy: - src: "{{ dump_folder }}/{{ dump_file_prefix }}.dmp" + src: "{{ output_folder }}/expdp/{{ dump_file_prefix }}.dmp" dest: "{{ shared_folder }}" - name: Import Database Tables shell: | - {{ dbhome_locl }}/bin/impdp userid={{ dump_user_int }}/{{ dump_pass }} directory=expdir dumpfile={{ dump_file_prefix }}.dmp logfile={{ dump_file_prefix }}.log table_exists_action=append remap_schema={{ dump_user }}:{{ dump_user_int }} + {{ dbhome_locl }}/bin/impdp userid={{ dump_user_int }}/{{ dump_pass }} directory={{ dump_dir_name }} dumpfile={{ dump_file_prefix }}.dmp logfile={{ dump_file_prefix }}.log table_exists_action=append remap_schema={{ dump_user }}:{{ dump_user_int }} environment: ORACLE_HOME: "{{ dbhome_locl }}" ORACLE_SID: "{{ mysid }}" - register: sqloutput become: true become_user: oracle delegate_to: "{{ vm_ip_address }}" - when: db_version == "11.2.0.4" and dump_user != dump_user_int +# when: (db_version == "11.2.0.2" or db_version == "11.2.0.3" or db_version == "11.2.0.4") and dump_user != dump_user_int + when: ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) <= 11 and dump_user != dump_user_int - name: Import Database Tables shell: | - {{ dbhome_locl }}/bin/impdp userid={{ dump_user_int }}/{{ dump_pass }} directory=expdir dumpfile={{ dump_file_prefix }}.dmp logfile={{ dump_file_prefix }}.log table_exists_action=append + {{ dbhome_locl }}/bin/impdp userid={{ dump_user_int }}/{{ dump_pass }} directory={{ dump_dir_name }} dumpfile={{ dump_file_prefix }}.dmp logfile={{ dump_file_prefix }}.log table_exists_action=append environment: ORACLE_HOME: "{{ dbhome_locl }}" ORACLE_SID: "{{ mysid }}" - register: sqloutput become: true become_user: oracle delegate_to: "{{ vm_ip_address }}" - when: db_version != "11.2.0.4" +# when: db_version != "11.2.0.2" and db_version != "11.2.0.3" and db_version != "11.2.0.4" + when: ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) > 11 - name : "Remove file {{ dump_file_prefix }}.dmp" file: @@ -51,6 +52,4 @@ - name : "Remove file {{ dump_file_prefix }}.log" file: state: absent - path: "{{ shared_folder }}/{{ dump_file_prefix }}.log" - -# Skip all is true when dump file is already generated and skip_dump_exists is true at config. \ No newline at end of file + path: "{{ shared_folder }}/{{ dump_file_prefix }}.log" \ No newline at end of file diff --git a/tasks/impdp_file_adb.yml b/tasks/impdp_file_adb.yml new file mode 100644 index 0000000..b2bf63d --- /dev/null +++ b/tasks/impdp_file_adb.yml @@ -0,0 +1,34 @@ +- name: "Processing {{ db_version }} {{ patch.type }} {{ patch.id }}" + debug: msg="Processing {{ db_version }} {{ patch.type }} {{ patch.id }}" + +# This task will populate loaded_stat_result +- include: run_script.yml + vars: + script_param: { file : "check_dump_file_loaded.yml" , folder : "user_scripts/odbfcl/adb_load_expdp" , type : "yml", task_action : "Check if file was already loaded" } + +- block: + + # User custom pre-scripts + - include: run_script.yml + loop: "{{ user_impdp_pre | flatten(levels=1) }}" + loop_control: + loop_var: script_param + when: user_impdp_pre is defined + + # The impdp loader are the same steps executed after the expdp + - include: run_script.yml + loop: "{{ user_expdp_post | flatten(levels=1) }}" + loop_control: + loop_var: script_param + when: user_expdp_post is defined + + # User custom post-scripts + - include: run_script.yml + loop: "{{ user_impdp_post | flatten(levels=1) }}" + loop_control: + loop_var: script_param + when: user_impdp_post is defined and load_file_stat_result.stat.exists + # Won't execute user_impdp_post when no dumpfile to avoid marking file as processed. + + when: not loaded_stat_result.stat.exists + # Skip all is true when dump file is already generated and skip_dump_exists is true at config. diff --git a/tasks/local_sqlplus.yml b/tasks/local_sqlplus.yml new file mode 100644 index 0000000..ee7e86f --- /dev/null +++ b/tasks/local_sqlplus.yml @@ -0,0 +1,23 @@ +# Will execute the provided SQL using sqlplus in the local server (not remote). + +# sql_param.file : File to process. +# sql_param.cred : user/pass@tns or any other credential input. +# sql_param.folder : Folder on VM shared folder where file is. (Default: "user_scripts") +# sql_param.params : Eventual parameters that may be provided to SQL script. +# sql_param.termout : Boolean - print the SQL output. (Default: true) +# sql_param.task_action : Task name to print. + +- name: "{{ sql_param.task_action }}" + shell: | + set -e + sqlplus -L -S "{{ sql_param.cred }}" @{{ VM_folder }}/{{ sql_param.folder | default('user_scripts') }}/{{ sql_param.file }} {{ sql_param.params | default('') }} + register: sqloutput + +- name: SQL Output + debug: msg="{{ sqloutput.stdout_lines }}" + when: (sql_param.termout | default(true)) == true + +- name: SQLPlus Error! + fail: + msg: "Found SP2 string in SQLPlus output." + when: '"SP2-" in sqloutput.stdout' \ No newline at end of file diff --git a/tasks/lvm_list.yml b/tasks/lvm_list.yml new file mode 100644 index 0000000..a75b468 --- /dev/null +++ b/tasks/lvm_list.yml @@ -0,0 +1,10 @@ +## This code will list all the logical volumes on the VM. + +- name: "Get LVM list." + shell: | + export PATH=$PATH:/sbin:/usr/sbin + lvs --noheadings -o lv_name | sed 's/ *//g' + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + register: lvs_output \ No newline at end of file diff --git a/tasks/lvm_reload.yml b/tasks/lvm_reload.yml new file mode 100644 index 0000000..39cc6a5 --- /dev/null +++ b/tasks/lvm_reload.yml @@ -0,0 +1,76 @@ +- name: "Load base snapshot {{ vm_snapshot }}" + shell: | + set -e -x + export PATH=$PATH:/sbin:/usr/sbin + v_snapshot="{{ vm_snapshot }}" + v_disk="/dev/mapper/vg_u01-lv_u01" + if ! $(lvs -a | grep -q "lv_u01_${v_snapshot}") + then + echo "LV lv_u01_${v_snapshot} not found." + exit 1 + fi + # Term all oracle sessions + pkill -U oracle || true + sleep 5 + # Kill all oracle sessions + pkill -9 -U oracle || true + sleep 5 + # Try to umount the disk + umount -l -f /u01 || true + sleep 5 + # Try to deactivate the disk + lvchange -a n ${v_disk} -f && v_ret=$? || v_ret=$? + # If not deactivating, try again in 1 minute.. + if [ $v_ret -ne 0 ] + then + sleep 60 + umount -l -f /u01 || true + sleep 5 + lvchange -a n ${v_disk} -f + fi + if grep -q 'release 5.' /etc/oracle-release + then + # There is no merge option on OL5, so we replace the current one with the last backup. + lvchange -a y ${v_disk} + dd if=${v_disk}_${v_snapshot} of=${v_disk} bs=8M iflag=direct oflag=direct + else + # Restore target snapshot + lvconvert --merge -i 1 -v ${v_disk}_${v_snapshot} + lvchange -a n ${v_disk} + lvchange -a y ${v_disk} + # Wait until snapshot is ready + while : + do + if ! lvs -a | grep lv_u01_${v_snapshot} + then + break + fi + dmsetup status ${v_disk} + sleep 1 + done + v_size=$(lvs --noheadings -o seg_size ${v_disk}) + lvcreate --size ${v_size} --snapshot --name lv_u01_${v_snapshot} ${v_disk} + fi + mount /u01 || true + mount | grep -q -F " /u01 " + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + +- name: "Clean oracle Shared Segments" + shell: | + # Clean Shared Segments (ORA-12547 TNS: Lost Contact) + ipcs -m | grep oracle | awk ' { print $2 } ' | xargs -I {} ipcrm -m {} + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + +- name: "Free /dev/shm" + shell: | + set -e -x + # Free up space on /dev/shm + umount /dev/shm + mount /dev/shm + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" \ No newline at end of file diff --git a/tasks/lvm_savestate.yml b/tasks/lvm_savestate.yml new file mode 100644 index 0000000..1a70280 --- /dev/null +++ b/tasks/lvm_savestate.yml @@ -0,0 +1,60 @@ +## This code will take a snapshot named "vm_snapshot" for the VM. It will later be used as a base release for OJVMs. + +# Drop old machine image if exists +- name: "Drop old LVM snapshots for previous RU or PSU if exists." + shell: | + export PATH=$PATH:/sbin:/usr/sbin + v_snapshot="{{ save_snapshot }}" + v_disk_vg='/dev/mapper/vg_u01' + v_db_version_short="{{ db_version_short }}" + for lv_name in `lvs --noheadings -o lv_name | grep -E 'PSU|RU' | grep "${v_db_version_short}" | grep -v ${v_snapshot}` + do + lvremove -f ${v_disk_vg}-${lv_name} + done + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + +# Save latest machine image if not already +- name: "Create new LVM snapshot \"{{ save_snapshot }}\" if not exists." + shell: | + set -e -x + export PATH=$PATH:/sbin:/usr/sbin + v_snapshot="{{ save_snapshot }}" + v_disk='/dev/mapper/vg_u01-lv_u01' + if ! $(lvs -a | grep -q "lv_u01_${v_snapshot}") + then + v_size=$(lvs --noheadings -o seg_size ${v_disk}) + if grep -q 'release 5.' /etc/oracle-release + then + # Term all oracle sessions + pkill -U oracle || true + sleep 5 + # Kill all oracle sessions + pkill -9 -U oracle || true + sleep 5 + # Try to umount the disk + umount -l -f /u01 || true + sleep 5 + # Try to deactivate the disk + lvchange -a n ${v_disk} -f && v_ret=$? || v_ret=$? + # If not deactivating, try again in 1 minute.. + if [ $v_ret -ne 0 ] + then + sleep 60 + umount -l -f /u01 || true + sleep 5 + lvchange -a n ${v_disk} -f + fi + lvchange -a y ${v_disk} + lvcreate --size ${v_size} --name lv_u01_${v_snapshot} vg_u01 + dd if=${v_disk} of=${v_disk}_${v_snapshot} bs=8M iflag=direct oflag=direct + mount /u01 || true + mount | grep -q -F " /u01 " + else + lvcreate --size ${v_size} --snapshot --name lv_u01_${v_snapshot} ${v_disk} + fi + fi + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" \ No newline at end of file diff --git a/tasks/main_PSU_BP.yml b/tasks/main_PSU_BP.yml index cf1f9ec..dd9cdc4 100644 --- a/tasks/main_PSU_BP.yml +++ b/tasks/main_PSU_BP.yml @@ -2,142 +2,157 @@ - name : Define version set_fact: - vm_machine: "{{ item.vmachine }}" - vm_ip_address: "{{ item.ip }}" - patch_base: "{{ item.base_snap }}" - patch_file: "{{ item.main_file }}" - patch_list: "{{ item.patch_list }}" - opatch_file: "{{ item.opatch_file }}" + patch_file: "{{ item.main_file }}" + patch_list: "{{ item.patch_list }}" + opatch_file: "{{ item.opatch_file }}" + db_version_short: "{{ db_version | replace('.','') }}" with_items: "{{ list_versions }}" when: item.id == db_version -# vm_reload is called before every patch is applied to rollback the VM to the snapshot image. -- name : Define snapshot base version to rollback when vm_reload is called. +- name : Define VBox params set_fact: - vm_snapshot: "{{ patch_base }}" - -- include: vm_reload.yml -- include: setup_opatch.yml -- include: setup_database.yml - -### PSU -- block: + vm_machine: "{{ item.vmachine }}" + vm_ip_address: "{{ item.ip }}" + patch_base: "{{ item.base_snap }}" + with_items: "{{ list_info_vbox }}" + when: item.id == db_version and not oci_mode - # Execute for base release - - include: "{{ patch_file }}" - vars: - patch : { type : PSU , id : 0, patch_number : 0 } - when: - - 0 == (param_patch | int) or param_patch == -1 - - 0 >= (param_patch_from | int) or param_patch_from == -1 - - 0 <= (param_patch_to | int) or param_patch_to == -1 +- name : Define Cloud params + set_fact: + oci_instance_id: "{{ item.oci_instance_id }}" + patch_base: "{{ item.base_snap }}" + out_of_box_id: "{{ item.out_of_box_id | default(-1) }}" + with_items: "{{ list_info_oci }}" + when: item.id == db_version and oci_mode - # Execute for every PSU - - include: "{{ patch_file }}" - loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" - loop_control: - loop_var: patch - label: "{{ patch.id }}" - when: - - patch.type == "PSU" - - patch.id == (param_patch | int) or param_patch == -1 - - patch.id >= (param_patch_from | int) or param_patch_from == -1 - - patch.id <= (param_patch_to | int) or param_patch_to == -1 +# Before, with default(-1,true) above, it was also changing when out_of_box_id was 0 +- name : Fix out_of_box_id + set_fact: + out_of_box_id: -1 + when: out_of_box_id == '' - when: param_type is undefined or param_type == "PSU" +# This parameter will control if database start command was ever called. +- name : Define database_started variable to false. + set_fact: + database_started: false -### Save latest applied PSU as Base Snapshot for OJVM. Why? OJVM can't be appied over base release. They requires a DB PSU. +### For PSU or OJVM - block: + # Define base_OJVM_line. This is used by patch_task_post to save the snapshot. - name: Get latest PSU ID set_fact: - latest_psu_id: "{{ lookup('vars', patch_list) | json_query(filter_qry) | max }}" + latest_PSU_id: "{{ ( ( lookup('vars', patch_list) | json_query(filter_qry_1) ) + [0] ) | max }}" + base_OJVM_id: "{{ ( ( lookup('vars', patch_list) | json_query(filter_qry_2) ) + [0] ) | max }}" vars: - filter_qry: "[?type=='PSU'].id" + filter_qry_1: "[? type == 'PSU' && (version == null || version == '{{ db_version }}') ].id" + filter_qry_2: "[? type == 'PSU' && base_ojvm != null && (version == null || version == '{{ db_version }}') ].id" - - name : Generate Snapshot Name + - name : Set base OJVM ID set_fact: - vm_snapshot: "{{ db_version }} PSU {{ latest_psu_id }}" - latest_psu_line: "{{ db_version }}.PSU.{{ latest_psu_id }}" + base_OJVM_id: "{{ latest_PSU_id }}" + when: (base_OJVM_id | int) == 0 - - name: "Latest PSU" - debug: msg="Latest PSU ID - {{ latest_psu_line }}" + - name : Generate base_OJVM_line + set_fact: + base_OJVM_line: "{{ db_version }}|PSU|{{ base_OJVM_id }}" - # Save lastest PSU as a new snapshot - Also changes vm_snapshot variable to it (for OJVM). - - include: vm_savestate.yml - when: latest_psu_line == latest_processed + - name: "Base OJVM" + debug: msg="Base OJVM ID - {{ base_OJVM_line }}" - when: param_type is undefined or param_type == "PSU" + when: param_type is undefined or param_type == "PSU" or param_type == "OJVM" -### OJVM define base Snapshot -# Will define it if not already done by the PSU above task. i.e: param_type is defined and "OJVM" +### PSU - block: - - name: Get latest PSU ID + - name : Define snapshot base version to rollback when reload is called. set_fact: - latest_psu_id: "{{ lookup('vars', patch_list) | json_query(filter_qry) | max }}" - vars: - filter_qry: "[?type=='PSU'].id" + vm_snapshot: "{{ patch_base }}" - - name : Generate Snapshot Name - set_fact: - vm_snapshot: "{{ db_version }} PSU {{ latest_psu_id }}" + # Execute for base release + - include: "{{ patch_file }}" + vars: + patch : { type : BASE , id : "{{ out_of_box_id }}" , patch_number : 0 } + when: + - (out_of_box_id | float) != -1 + - (out_of_box_id | float) == (param_patch | float) or param_patch == -1 + - (out_of_box_id | float) >= (param_patch_from | float) or param_patch_from == -1 + - (out_of_box_id | float) <= (param_patch_to | float) or param_patch_to == -1 - - name: "Base Snapshot will be {{ vm_snapshot }}" - debug: msg="Base Snapshot will be {{ vm_snapshot }}" + # Execute for every PSU + - include: "{{ patch_file }}" + loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" + loop_control: + loop_var: patch + label: "{{ patch.id }}" + when: + - (param_type is undefined and (patch.type == "PSU" or patch.type == "CPU" or patch.type == "BASE")) or (param_type is defined and patch.type == param_type) + - patch.id == (param_patch | float) or param_patch == -1 + - patch.id >= (param_patch_from | float) or param_patch_from == -1 + - patch.id <= (param_patch_to | float) or param_patch_to == -1 + - (patch.version | default(db_version)) == db_version - when: param_type is defined and param_type == "OJVM" + when: param_type is undefined or param_type == "PSU" or param_type == "CPU" or param_type == "BASE" -### OJVM +### BP - block: - # Execute for every OJVM + - name : Define snapshot base version to rollback when reload is called. + set_fact: + vm_snapshot: "{{ patch_base }}" + + # Execute for every BP - include: "{{ patch_file }}" loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" loop_control: loop_var: patch label: "{{ patch.id }}" when: - - patch.type == "OJVM" - - patch.id == (param_patch | int) or param_patch == -1 - - patch.id >= (param_patch_from | int) or param_patch_from == -1 - - patch.id <= (param_patch_to | int) or param_patch_to == -1 + - patch.type == "BP" + - patch.id == (param_patch | float) or param_patch == -1 + - patch.id >= (param_patch_from | float) or param_patch_from == -1 + - patch.id <= (param_patch_to | float) or param_patch_to == -1 - when: param_type is undefined or param_type == "OJVM" + when: param_type is undefined or param_type == "BP" -### BP +### OJVM - block: - - name : Define snapshot base version to rollback when vm_reload is called. + ### Clean OJVM dumps if base_OJVM_id is different from the last. + - include: clean_ojvm_dumps.yml base_id="PSU_{{ base_OJVM_id }}" + + - name : Change Base Snapshot Name - VBox Mode set_fact: - vm_snapshot: "{{ patch_base }}" + vm_snapshot: "{{ db_version }} PSU {{ base_OJVM_id }}" + when: not oci_mode - - name : Check if there is any BP + - name : Change Base Snapshot Name - LVM Mode set_fact: - total_bps: "{{ lookup('vars', patch_list) | json_query(filter_qry) | count }}" - vars: - filter_qry: "[?type=='BP'].id" + vm_snapshot: "{{ db_version_short }}_PSU_{{ base_OJVM_id }}" + when: oci_mode - # Execute for base release if there is at least 1 BP for that version - - include: "{{ patch_file }}" - vars: - patch : { type : BP , id : 0, patch_number : 0 } - when: - - total_bps != "0" - - 0 == (param_patch | int) or param_patch == -1 - - 0 >= (param_patch_from | int) or param_patch_from == -1 - - 0 <= (param_patch_to | int) or param_patch_to == -1 + - name: "Base Snapshot will be {{ vm_snapshot }}" + debug: msg="Base Snapshot will be {{ vm_snapshot }}" - # Execute for every BP + # Execute for every OJVM - include: "{{ patch_file }}" - loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" + loop: "{{ lookup('vars', patch_list) | flatten(levels=1) | sort(attribute='id') | reverse | list }}" loop_control: loop_var: patch label: "{{ patch.id }}" when: - - patch.type == "BP" - - patch.id == (param_patch | int) or param_patch == -1 - - patch.id >= (param_patch_from | int) or param_patch_from == -1 - - patch.id <= (param_patch_to | int) or param_patch_to == -1 + - patch.type == "OJVM" + - patch.id == (param_patch | float) or param_patch == -1 + - patch.id >= (param_patch_from | float) or param_patch_from == -1 + - patch.id <= (param_patch_to | float) or param_patch_to == -1 + - (patch.version | default(db_version)) == db_version - when: param_type is undefined or param_type == "BP" + when: param_type is undefined or param_type == "OJVM" + +# Stop OCI VM +- name: Call role to stop OCI VM + include_role: + name: oci_compute_instance_actions + vars: + compute_action: stop + when: oci_mode and not only_deploy_patch and database_started \ No newline at end of file diff --git a/tasks/main_RU_RUR.yml b/tasks/main_RU_RUR.yml index 2016715..953ba34 100644 --- a/tasks/main_RU_RUR.yml +++ b/tasks/main_RU_RUR.yml @@ -1,36 +1,83 @@ -### Will Run RU + OJVM + RUR for given version +### Will Run RU + OJVM + RUR + MRP + DPBP for given version - name : Define version + set_fact: + patch_file: "{{ item.main_file }}" + patch_list: "{{ item.patch_list }}" + opatch_file: "{{ item.opatch_file }}" + db_version_short: "{{ db_version | replace('.','') }}" + with_items: "{{ list_versions }}" + when: item.id == db_version + +- name : Define VBox params set_fact: vm_machine: "{{ item.vmachine }}" vm_ip_address: "{{ item.ip }}" patch_base: "{{ item.base_snap }}" - patch_file: "{{ item.main_file }}" - patch_list: "{{ item.patch_list }}" - opatch_file: "{{ item.opatch_file }}" - with_items: "{{ list_versions }}" - when: item.id == db_version + with_items: "{{ list_info_vbox }}" + when: item.id == db_version and not oci_mode -# vm_reload is called before every patch is applied to rollback the VM to the snapshot image. -- name : Define snapshot base version to rollback when vm_reload is called. +- name : Define Cloud params set_fact: - vm_snapshot: "{{ patch_base }}" + oci_instance_id: "{{ item.oci_instance_id }}" + patch_base: "{{ item.base_snap }}" + out_of_box_id: "{{ item.out_of_box_id | default(-1) }}" + with_items: "{{ list_info_oci }}" + when: item.id == db_version and oci_mode -- include: vm_reload.yml -- include: setup_opatch.yml -- include: setup_database.yml +# Before, with default(-1,true) above, it was also changing when out_of_box_id was 0 +- name : Fix out_of_box_id + set_fact: + out_of_box_id: -1 + when: out_of_box_id == '' + +# This parameter will control if database start command was ever called. +- name : Define database_started variable to false. + set_fact: + database_started: false + +### For RU or OJVM +- block: + + # Define base_OJVM_line. This is used by patch_task_post to save the snapshot. + - name: Get latest RU ID + set_fact: + latest_RU_id: "{{ ( ( lookup('vars', patch_list) | json_query(filter_qry_1) ) + [0] ) | max }}" + base_OJVM_id: "{{ ( ( lookup('vars', patch_list) | json_query(filter_qry_2) ) + [0] ) | max }}" + vars: + filter_qry_1: "[? type == 'RU' && (version == null || version == '{{ db_version }}') ].id" + filter_qry_2: "[? type == 'RU' && base_ojvm != null && (version == null || version == '{{ db_version }}') ].id" + + - name : Set base OJVM ID + set_fact: + base_OJVM_id: "{{ latest_RU_id }}" + when: (base_OJVM_id | int) == 0 + + - name : Generate base_OJVM_line + set_fact: + base_OJVM_line: "{{ db_version }}|RU|{{ base_OJVM_id }}" + + - name: "Base OJVM" + debug: msg="Base OJVM ID - {{ base_OJVM_line }}" + + when: param_type is undefined or param_type == "RU" or param_type == "OJVM" ### RU - block: + - name : Define snapshot base version to rollback when reload is called. + set_fact: + vm_snapshot: "{{ patch_base }}" + # Execute for base release - include: "{{ patch_file }}" vars: - patch : { type : RU , id : 0, patch_number : 0 } + patch : { type : BASE , id : "{{ out_of_box_id }}" , patch_number : 0 } when: - - 0 == (param_patch | int) or param_patch == -1 - - 0 >= (param_patch_from | int) or param_patch_from == -1 - - 0 <= (param_patch_to | int) or param_patch_to == -1 + - (out_of_box_id | float) != -1 + - (out_of_box_id | float) == (param_patch | float) or param_patch == -1 + - (out_of_box_id | float) >= (param_patch_from | float) or param_patch_from == -1 + - (out_of_box_id | float) <= (param_patch_to | float) or param_patch_to == -1 # Execute for every RU - include: "{{ patch_file }}" @@ -40,88 +87,70 @@ label: "{{ patch.id }}" when: - patch.type == "RU" - - patch.id == (param_patch | int) or param_patch == -1 - - patch.id >= (param_patch_from | int) or param_patch_from == -1 - - patch.id <= (param_patch_to | int) or param_patch_to == -1 + - patch.id == (param_patch | float) or param_patch == -1 + - patch.id >= (param_patch_from | float) or param_patch_from == -1 + - patch.id <= (param_patch_to | float) or param_patch_to == -1 - when: param_type is undefined or param_type == "RU" + when: param_type is undefined or param_type == "RU" or param_type == "BASE" -### Save latest applied RU as Base Snapshot for OJVM. Why? OJVM can't be appied over base release. They requires a DB RU. +### RUR & MRP & DPBP & OTHERS - block: - - name: Get latest RU ID - set_fact: - latest_RU_id: "{{ lookup('vars', patch_list) | json_query(filter_qry) | max }}" - vars: - filter_qry: "[?type=='RU'].id" - - - name : Generate Snapshot Name + - name : Define snapshot base version to rollback when reload is called. set_fact: - vm_snapshot: "{{ db_version }} RU {{ latest_RU_id }}" - latest_RU_line: "{{ db_version }}.RU.{{ latest_RU_id }}" - - - name: "Latest RU" - debug: msg="Latest RU ID - {{ latest_RU_line }}" + vm_snapshot: "{{ patch_base }}" - # Save lastest RU as a new snapshot - Also changes vm_snapshot variable to it (for OJVM). - - include: vm_savestate.yml - when: latest_RU_line == latest_processed + # Execute for every patch + - include: "{{ patch_file }}" + loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" + loop_control: + loop_var: patch + label: "{{ patch.id }}" + when: + - (param_type is undefined and (patch.type != "RU" and patch.type != "OJVM")) or (param_type is defined and patch.type == param_type) + - patch.id == (param_patch | float) or param_patch == -1 + - patch.id >= (param_patch_from | float) or param_patch_from == -1 + - patch.id <= (param_patch_to | float) or param_patch_to == -1 - when: param_type is undefined or param_type == "RU" + when: param_type is undefined or (param_type != "RU" and param_type != "OJVM") -### OJVM define base Snapshot -# Will define it if not already done by the RU above task. i.e: param_type is defined and "OJVM" +### OJVM - block: - - name: Get latest RU ID + ### Clean OJVM dumps if base_OJVM_id is different from the last. + - include: clean_ojvm_dumps.yml base_id="RU_{{ base_OJVM_id }}" + + - name : Change Base Snapshot Name - VBox Mode set_fact: - latest_RU_id: "{{ lookup('vars', patch_list) | json_query(filter_qry) | max }}" - vars: - filter_qry: "[?type=='RU'].id" + vm_snapshot: "{{ db_version }} RU {{ base_OJVM_id }}" + when: not oci_mode - - name : Generate Snapshot Name + - name : Change Base Snapshot Name - LVM Mode set_fact: - vm_snapshot: "{{ db_version }} RU {{ latest_RU_id }}" + vm_snapshot: "{{ db_version_short }}_RU_{{ base_OJVM_id }}" + when: oci_mode - name: "Base Snapshot will be {{ vm_snapshot }}" debug: msg="Base Snapshot will be {{ vm_snapshot }}" - when: param_type is defined and param_type == "OJVM" - -### OJVM -- block: - # Execute for every OJVM - include: "{{ patch_file }}" - loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" + loop: "{{ lookup('vars', patch_list) | flatten(levels=1) | sort(attribute='id') | reverse | list }}" loop_control: loop_var: patch label: "{{ patch.id }}" when: - patch.type == "OJVM" - - patch.id == (param_patch | int) or param_patch == -1 - - patch.id >= (param_patch_from | int) or param_patch_from == -1 - - patch.id <= (param_patch_to | int) or param_patch_to == -1 + - patch.id == (param_patch | float) or param_patch == -1 + - patch.id >= (param_patch_from | float) or param_patch_from == -1 + - patch.id <= (param_patch_to | float) or param_patch_to == -1 when: param_type is undefined or param_type == "OJVM" -### RUR -- block: - - - name : Define snapshot base version to rollback when vm_reload is called. - set_fact: - vm_snapshot: "{{ patch_base }}" - - # Execute for every RUR - - include: "{{ patch_file }}" - loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" - loop_control: - loop_var: patch - label: "{{ patch.id }}" - when: - - patch.type == "RUR" - - patch.id == (param_patch | int) or param_patch == -1 - - patch.id >= (param_patch_from | int) or param_patch_from == -1 - - patch.id <= (param_patch_to | int) or param_patch_to == -1 - - when: param_type is undefined or param_type == "RUR" +# Stop OCI VM +- name: Call role to stop OCI VM + include_role: + name: oci_compute_instance_actions + vars: + compute_action: stop + when: oci_mode and not only_deploy_patch and database_started \ No newline at end of file diff --git a/tasks/main_loader.yml b/tasks/main_loader.yml index e04a003..6e951a0 100644 --- a/tasks/main_loader.yml +++ b/tasks/main_loader.yml @@ -1,13 +1,19 @@ ### Will import all dumps to a given database. - name : Define version + set_fact: + patch_base: "{{ item.base_snap }}" + patch_list: "{{ item.patch_list }}" + db_version_short: "{{ db_version | replace('.','') }}" + with_items: "{{ list_versions }}" + when: item.id == db_version + +- name : Define VBox params set_fact: vm_machine: "{{ item.vmachine }}" - patch_base: "{{ item.base_snap }}" - patch_list: "{{ item.patch_list }}" vm_snapshot: "{{ item.base_snap }}" vm_ip_address: "{{ item.ip }}" - with_items: "{{ list_versions }}" + with_items: "{{ list_info_vbox }}" when: item.id == db_version # vm_reload is called before every patch is applied to rollback the VM to the snapshot image. diff --git a/tasks/main_loader_adb.yml b/tasks/main_loader_adb.yml new file mode 100644 index 0000000..c5c0dc2 --- /dev/null +++ b/tasks/main_loader_adb.yml @@ -0,0 +1,51 @@ +### Will import all dumps to a given database. + +- name : Define version + set_fact: + patch_list: "{{ item.patch_list }}" + db_version_short: "{{ db_version | replace('.','') }}" + with_items: "{{ list_versions }}" + when: item.id == db_version + +- name : Define Cloud params + set_fact: + out_of_box_id: "{{ item.out_of_box_id | default(-1) }}" + with_items: "{{ list_info_oci }}" + when: item.id == db_version + +# Before, with default(-1,true) above, it was also changing when out_of_box_id was 0 +- name : Fix out_of_box_id + set_fact: + out_of_box_id: -1 + when: out_of_box_id == '' + +#- fail: +# msg: "Stop here." + +############################### + +# Execute for base release if there is at least 1 RU for that version +- include: "impdp_file_adb.yml" + vars: + patch : { type : BASE , id : "{{ out_of_box_id }}" , patch_number : 0 } + when: + - (out_of_box_id | float) != -1 + - (out_of_box_id | float) == (param_patch | float) or param_patch == -1 + - (out_of_box_id | float) >= (param_patch_from | float) or param_patch_from == -1 + - (out_of_box_id | float) <= (param_patch_to | float) or param_patch_to == -1 + - param_type is undefined or param_type == "BASE" + +############################### + +# Execute for every PSU / BP / OJVM / RU / RUR / MRP +- include: "impdp_file_adb.yml" + loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" + loop_control: + loop_var: patch + label: "{{ patch.id }}" + when: + - patch.id == (param_patch | float) or param_patch == -1 + - patch.id >= (param_patch_from | float) or param_patch_from == -1 + - patch.id <= (param_patch_to | float) or param_patch_to == -1 + - (patch.version | default(db_version)) == db_version + - param_type is undefined or param_type == patch.type \ No newline at end of file diff --git a/tasks/main_loader_manual.yml b/tasks/main_loader_manual.yml new file mode 100644 index 0000000..ab77c86 --- /dev/null +++ b/tasks/main_loader_manual.yml @@ -0,0 +1,185 @@ +### Will import all dumps to a given database. + +- name: Variables not provided + fail: + msg: "Variables input_version / input_series / input_patch / input_file must be defined." + when: input_version is undefined or (input_version|length == 0) or + input_series is undefined or (input_series|length == 0) or + input_patch is undefined or (input_patch|length == 0) or + input_file is undefined or (input_file|length == 0) + +- name : Define db_version + set_fact: + db_version: "{{ input_version }}" + param_type: "{{ input_series }}" + param_patch: "{{ input_patch }}" + output_folder: "{{ stage_folder }}/temp_load/{{ oci_adb_db_id }}" + input_file_name: "{{ input_file | basename }}" + +- name: Delete content & directory + file: + state: absent + path: "{{ output_folder }}" + +- name: Creates output folder + file: + path: "{{ output_folder }}" + state: directory + +- name: List files in OCI Bucket + include_role: + name: oci_object_storage_object_facts + vars: + object_action: "list" + oci_list_bucket: "{{ input_bucket }}" + when: not (input_bucket is undefined or (input_bucket|length == 0)) + +# Not working for whatever reason... + +# - name: Download file from OCI Bucket +# include_role: +# name: oci_object_storage_object_facts +# vars: +# oci_download_file: "{{ input_file_name }}" +# oci_download_bucket: "{{ input_bucket }}" +# oci_dest_file: "{{ output_folder }}/{{ input_file_name }}" +# object_action: "download" + +- name: Download file from OCI Bucket + shell: | + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + oci os object get --bucket-name {{ input_bucket }} --name {{ input_file }} --file {{ output_folder }}/{{ input_file_name }} + when: not (input_bucket is undefined or (input_bucket|length == 0)) + +- name: Move file to folder + command: mv "{{ input_file }}" "{{ output_folder }}/{{ input_file_name }}" + when: input_bucket is undefined or (input_bucket|length == 0) + +- name: "Check if {{ output_folder }}/{{ input_file_name }} exists" + stat: + path: "{{ output_folder }}/{{ input_file_name }}" + register: ifile_stat_result + +- fail: + msg: "Could not find {{ output_folder }}/{{ input_file_name }} file." + when: ifile_stat_result.stat.exists == false + +- name: Creates directory + file: + path: "{{ item }}" + state: directory + loop: + - "{{ output_folder }}" + - "{{ output_folder }}/bugsfixed" + - "{{ output_folder }}/binsum" + - "{{ output_folder }}/txtcollect" + - "{{ output_folder }}/symbols" + - "{{ output_folder }}/expdp" + +- name: "Extract {{ output_folder }}/{{ input_file_name }} into {{ output_folder }}" + unarchive: + src: "{{ output_folder }}/{{ input_file_name }}" + dest: "{{ output_folder }}" + +##################################################################### +### Place the files in the correct directories. Also rename them. ### +##################################################################### + +## Dump +- name: Find dump file + find: + paths: "{{ output_folder }}" + patterns: "tables_*.dmp" + recurse: "no" + file_type: "file" + register: find_result + +- name: "Move it to {{ output_folder }}/expdp" + command: mv "{{ find_result.files[0].path }}" "{{ output_folder }}/expdp/tables_{{ db_version }}_{{ param_type }}_{{ param_patch }}.dmp" + when: find_result.files[0] is defined + +## Bugs +- name: Find bugs file + find: + paths: "{{ output_folder }}" + patterns: "bugs_*.txt" + recurse: "no" + file_type: "file" + register: find_result + +- name: "Move it to {{ output_folder }}/bugsfixed" + command: mv "{{ find_result.files[0].path }}" "{{ output_folder }}/bugsfixed/bugs_{{ db_version }}_{{ param_type }}_{{ param_patch }}.txt" + when: find_result.files[0] is defined + +## Symbols +- name: Find symbols file + find: + paths: "{{ output_folder }}" + patterns: "symbols_*.csv" + recurse: "no" + file_type: "file" + register: find_result + +- name: "Move it to {{ output_folder }}/symbols" + command: mv "{{ find_result.files[0].path }}" "{{ output_folder }}/symbols/symbols_{{ db_version }}_{{ param_type }}_{{ param_patch }}.csv" + when: find_result.files[0] is defined + +## Collection +- name: Find txt collection file + find: + paths: "{{ output_folder }}" + patterns: "txtcol_*.tar.gz" + recurse: "no" + file_type: "file" + register: find_result + +- name: "Move it to {{ output_folder }}/txtcollect" + command: mv "{{ find_result.files[0].path }}" "{{ output_folder }}/txtcollect/txtcol_{{ db_version }}_{{ param_type }}_{{ param_patch }}.tar.gz" + when: find_result.files[0] is defined + +## Chksum +- name: Find chksum file + find: + paths: "{{ output_folder }}" + patterns: "sha256sum_*.chk" + recurse: "no" + file_type: "file" + register: find_result + +- name: "Move it to {{ output_folder }}/binsum" + command: mv "{{ find_result.files[0].path }}" "{{ output_folder }}/binsum/sha256sum_{{ db_version }}_{{ param_type }}_{{ param_patch }}.chk" + when: find_result.files[0] is defined + +##################################################################### +##################################################################### + +- name : Define version + set_fact: + patch_list: "{{ item.patch_list }}" + db_version_short: "{{ db_version | replace('.','') }}" + with_items: "{{ list_versions }}" + when: item.id == db_version + +- name : Define Cloud params + set_fact: + out_of_box_id: "{{ item.out_of_box_id | default(-1) }}" + with_items: "{{ list_info_oci }}" + when: item.id == db_version + +# Before, with default(-1,true) above, it was also changing when out_of_box_id was 0 +- name : Fix out_of_box_id + set_fact: + out_of_box_id: -1 + when: out_of_box_id == '' + +- include: "impdp_file_adb.yml patch={{ item }}" + with_items: + - { type : "{{ input_series }}" , id : "{{ input_patch }}" } + +- name: Delete content & directory + file: + state: absent + path: "{{ output_folder }}" + +### \ No newline at end of file diff --git a/tasks/main_loader_uploads.yml.old b/tasks/main_loader_uploads.yml.old new file mode 100644 index 0000000..3626afb --- /dev/null +++ b/tasks/main_loader_uploads.yml.old @@ -0,0 +1,203 @@ +### Start +- name : Print d_uploads_id + debug: var=d_uploads_id + +- name : Define variables + set_fact: + #d_uploads_id: 42 + db_file_version: '' + db_file_type: '' + db_file_patch: '' + db_file_proc: '' + run_process: true + output_folder: '{{ stage_folder }}/temp_zip' + +- name : Define db_file_name + set_fact: + db_file_name: '{{output_folder}}/{{ d_uploads_id }}.zip' + +### Exit if check does not pass +- block: + + - name: Error + debug: + msg: 'd_uploads_id must be numeric.' + + - name : Exit + set_fact: + run_process: false + + when: d_uploads_id is not regex("^[0-9]+$") + +- block: + + ### Get data from database + - name: "Get data from D_UPLOADS table" + shell: | + set -eo pipefail + sqlplus -L -S {{ oci_adb_main_tns }} <<'EOF' + whenever sqlerror exit sql.sqlcode rollback + set pages 0 head off feed off echo off trim off trims on ver off term on serverout on + DECLARE + L_UPLOAD D_UPLOADS%ROWTYPE; + V_ID NUMBER := '{{ d_uploads_id }}'; + BEGIN + + -- Check if row can be processed. + SELECT * + INTO L_UPLOAD + FROM D_UPLOADS + WHERE ID = V_ID + AND STATUS = 3 + FOR UPDATE; + + -- Mark row as being processed. + UPDATE D_UPLOADS + SET + PROCESS_STARTED_ON = SYSTIMESTAMP + WHERE ID = L_UPLOAD.ID; + + COMMIT; + + -- Get info to process. + DBMS_OUTPUT.PUT_LINE(L_UPLOAD.ORAVERSION); + DBMS_OUTPUT.PUT_LINE(L_UPLOAD.ORASERIES); + DBMS_OUTPUT.PUT_LINE(L_UPLOAD.ORAPATCH); + EXCEPTION + WHEN NO_DATA_FOUND THEN + NULL; + END; + / + EOF + register: sql_output + + - name : Define variables from DB output + set_fact: + db_file_version: '{{ sql_output.stdout_lines[0] | trim }}' + db_file_type: '{{ sql_output.stdout_lines[1] | trim }}' + db_file_patch: '{{ sql_output.stdout_lines[2] | trim }}' + when: sql_output.stdout_lines[0] is defined + + - block: + + - name: Skipping + debug: + msg: "Skipping {{ d_uploads_id }}." + + - name : Exit + set_fact: + run_process: false + + when: db_file_version|length == 0 + + - name: Delete content & directory + file: + state: absent + path: "{{ output_folder }}" + + - name: Creates output folder + file: + path: "{{ output_folder }}" + state: directory + + - name: "Download BLOB" + shell: | + set -eo pipefail + cd "{{ output_folder }}" + sqlplus -L -S {{ oci_adb_main_tns }} <<'EOF' + whenever sqlerror exit sql.sqlcode rollback + set verify off feedback off heading off + set trimout on trimspool on pagesize 0 linesize 5000 long 100000000 longchunksize 32767 + set termout off + spool "{{ db_file_name }}.base64" + with function base64encode(p_blob in blob) return clob is + l_clob clob; + l_step pls_integer := 12000; -- make sure you set a multiple of 3 not higher than 24573 + begin + if dbms_lob.getlength(p_blob) = 0 then + return null; + end if; + for i in 0 .. trunc((dbms_lob.getlength(p_blob) - 1 )/l_step) loop + l_clob := l_clob || utl_raw.cast_to_varchar2(utl_encode.base64_encode(dbms_lob.substr(p_blob, l_step, i * l_step + 1))); + end loop; + return l_clob; + end; + select base64encode(blob_content) from d_uploads where id={{ d_uploads_id }}; + / + spool off + exit + EOF + base64 -d "{{ db_file_name }}.base64" > "{{ db_file_name }}" + rm -f "{{ db_file_name }}.base64" + register: sql_output + + ### Print call. + - name: "Calling loader_manual.yml" + debug: + msg: | + ansible-playbook ./loader_manual.yml \ + --extra-vars "input_version={{ db_file_version }} input_series={{ db_file_type }} input_patch={{ db_file_patch }} input_file={{ db_file_name }}" \ + >> /u01/patch_automation/auto_logs/run.log 2>> /u01/patch_automation/auto_logs/run.err + + ### Run manual loader for this file. + - name: "Run playbook loader_manual.yml" + shell: | + ansible-playbook ./loader_manual.yml \ + --extra-vars "input_version={{ db_file_version }} input_series={{ db_file_type }} input_patch={{ db_file_patch }} input_file={{ db_file_name }}" \ + >> /u01/patch_automation/auto_logs/run.{{ d_uploads_id }}.$(date '+%Y%m%d_%H%M%S').log 2>> /u01/patch_automation/auto_logs/run.{{ d_uploads_id }}.$(date '+%Y%m%d_%H%M%S').err + register: command_result + ignore_errors: yes + + ### Mark row as processed. + - name: "Update row for this label" + shell: | + set -eo pipefail + sqlplus -L -S {{ oci_adb_main_tns }} <<'EOF' + whenever sqlerror exit sql.sqlcode + + select * from d_uploads where id={{ d_uploads_id }} for update; + + -- Mark row as processed. + update d_uploads set process_finished_on=systimestamp where id={{ d_uploads_id }}; + + -- If delete was executed during the process, mark for re-execution. + update d_uploads set delete_finished_on=null where id={{ d_uploads_id }} and delete_finished_on is not null; + + commit; + + exit + EOF + register: sql_output + when: command_result.rc == 0 + + ### Mark row as processed. + - name: "Update row for this label" + shell: | + set -eo pipefail + sqlplus -L -S {{ oci_adb_main_tns }} <<'EOF' + whenever sqlerror exit sql.sqlcode + + select * from d_uploads where id={{ d_uploads_id }} for update; + + -- Mark row as processed. + update d_uploads set process_finished_on=systimestamp, failed_on=systimestamp where id={{ d_uploads_id }}; + + -- If delete was executed during the process, mark for re-execution. + update d_uploads set delete_finished_on=null where id={{ d_uploads_id }} and delete_finished_on is not null; + + commit; + + exit + EOF + register: sql_output + when: command_result.rc != 0 + + - name: Delete content & directory + file: + state: absent + path: "{{ output_folder }}" + when: command_result.rc == 0 + + when: run_process + +### \ No newline at end of file diff --git a/tasks/patch_main.yml b/tasks/patch_main.yml index 5a3e40f..18bb1bf 100644 --- a/tasks/patch_main.yml +++ b/tasks/patch_main.yml @@ -3,88 +3,246 @@ - block: - # Stop the database - - include: run_sql.yml - vars: - sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database" } - - - name: Run OPatch - shell: | - export ORACLE_HOME ORACLE_SID - ./opatch apply -silent {{ VM_folder }}/{{ patch.patch_number }} - environment: - ORACLE_HOME: "{{ dbhome_locl }}" - ORACLE_SID: "{{ mysid }}" - args: - chdir: "{{ dbhome_locl }}/OPatch" - register: shell_output - become: true - become_user: oracle - when: patch.id != 0 - delegate_to: "{{ vm_ip_address }}" - - - name: Opatch Output - debug: msg="{{ shell_output.stdout_lines }}" - when: shell_output.stdout_lines is defined + # If needs to perform patch actions + - block: - # Start the database - - include: run_sql.yml - vars: - sql_param : { file : "startupCDB.sql" , folder : "patch_sql" , task_action : "Start Database" } - when: patch.type != "OJVM" + # Stop the database + - include: run_sql.yml + vars: + sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database for OPatch" } + when: not oci_mode or patch.dep_type is defined + # When patch has a dependency, if the dependency is loaded running the full patch process instead of loading from lvm, the DB will be left online. + + ## APPLY ## + + - name: Run OPatch/opatch + shell: | + set -eo pipefail + export ORACLE_HOME ORACLE_SID + [ ! -d ~/opatch_logs ] && mkdir ~/opatch_logs + ./opatch apply -silent {{ VM_folder }}/{{ patch.patch_number }} OPatch.SKIP_VERIFY_SPACE=true 2>&1 | tee ~/opatch_logs/{{ patch.patch_number }}.log + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + args: + chdir: "{{ dbhome_locl }}/OPatch" + register: tmp_shell_output + become: true + become_user: oracle + when: patch.apply_method is not defined or patch.apply_method == "opatch" + delegate_to: "{{ vm_ip_address }}" + + # Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" + - set_fact: shell_output="{{tmp_shell_output}}" + when: tmp_shell_output is not skipped + + ## NAPPLY ## + + - name: Run OPatch/opatch NAPPLY + shell: | + set -eo pipefail + export ORACLE_HOME ORACLE_SID + [ ! -d ~/opatch_logs ] && mkdir ~/opatch_logs + ./opatch napply -silent {{ VM_folder }}/{{ patch.patch_number }} OPatch.SKIP_VERIFY_SPACE=true 2>&1 | tee ~/opatch_logs/{{ patch.patch_number }}.log + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + args: + chdir: "{{ dbhome_locl }}/OPatch" + register: tmp_shell_output + become: true + become_user: oracle + when: patch.apply_method is defined and patch.apply_method == "napply" + delegate_to: "{{ vm_ip_address }}" + + # Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" + - set_fact: shell_output="{{tmp_shell_output}}" + when: tmp_shell_output is not skipped + + ## OPATCHAUTO ## + + - name: Run OPatch/opatchauto + shell: | + set -eo pipefail + export ORACLE_HOME ORACLE_SID + ./opatchauto apply -binary {{ VM_folder }}/{{ patch.patch_number }} -oh $ORACLE_HOME -target_type oracle_database + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + args: + chdir: "{{ dbhome_locl }}/OPatch" + register: tmp_shell_output + become: true + become_user: oracle + when: patch.apply_method is defined and patch.apply_method == "opatchauto" + delegate_to: "{{ vm_ip_address }}" + + # Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" + - set_fact: shell_output="{{tmp_shell_output}}" + when: tmp_shell_output is not skipped + + ## RUGI ## + + - name: Deploy new ORACLE_HOME + shell: | + set -eo pipefail + # Save database files + rm -f /tmp/${ORACLE_SID}.tar.gz + cd $ORACLE_HOME/dbs + tar -cvzf /tmp/${ORACLE_SID}.tar.gz {hc_${ORACLE_SID}.dat,spfile${ORACLE_SID}.ora,orapw${ORACLE_SID}} + # Remove old home + rm -rf $ORACLE_HOME + # Create new home + mkdir $ORACLE_HOME + cd /u01/install + unzip -q -d $ORACLE_HOME {{ shared_folder }}/{{ db_patch | basename }} + # Recover saved files + cd $ORACLE_HOME/dbs + tar -xvf /tmp/${ORACLE_SID}.tar.gz + rm -f /tmp/${ORACLE_SID}.tar.gz + # Remove old home from inventory + sed -i '/dbhome_1/d' /u01/app/oraInstall/ContentsXML/inventory.xml + # Install new home + set +e + $ORACLE_HOME/runInstaller -silent -responseFile /u01/install/db_install.rsp + v_ret=$? + # ret = 6 is "Successfully Setup Software with warning(s)." + if [ ${v_ret} -ne 0 -a ${v_ret} -ne 6 ] + then + exit 1 + fi + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + register: tmp_shell_output + become: true + become_user: oracle + when: patch.apply_method is defined and patch.apply_method == "gold_image" + delegate_to: "{{ vm_ip_address }}" + + # Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" + - set_fact: shell_output="{{tmp_shell_output}}" + when: tmp_shell_output is not skipped + + - name: Call root.sh + shell: | + set -eo pipefail + $ORACLE_HOME/root.sh + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + become: true + become_user: root + when: patch.apply_method is defined and patch.apply_method == "gold_image" + delegate_to: "{{ vm_ip_address }}" + + - name: Patch Output + debug: msg="{{ shell_output.stdout_lines }}" + when: shell_output.stdout_lines is defined + + # Start the database + - include: run_sql.yml + vars: + sql_param : { file : "startupCDB.sql" , folder : "patch_sql" , task_action : "Start Database for sqlpatch" } + when: patch.type != "OJVM" - # Start the database (in OJVM, it must be in upgrade mode) - - include: run_sql.yml - vars: - sql_param : { file : "startupCDBOJVM.sql" , folder : "patch_sql" , task_action : "Start Database" } - when: patch.type == "OJVM" + # Start the database (in OJVM, it must be in upgrade mode) + - include: run_sql.yml + vars: + sql_param : { file : "startupCDBOJVM.sql" , folder : "patch_sql" , task_action : "Start Database for OJVM sqlpatch" } + when: patch.type == "OJVM" + + # Run Datapatch + - name: Set datapatch try variable + set_fact: datapatch_try=0 - # Run Datapatch - - name: Set datapatch try variable - set_fact: datapatch_try=0 + - name: Run Datapatch + include: datapatch.yml - - name: Run Datapatch - include: datapatch.yml - when: patch.id != 0 + # Evaluate if it's needed to reexecute datapatch on 12.1.1 due to bug. - # Evaluate if it's needed to reexecute datapatch on 12.1.1 due to bug. + # Bounce instance on OJVM to remove "upgrade" mode + - block: - # Bounce instance on OJVM to remove "upgrade" mode + - include: run_sql.yml + vars: + sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database" } + + - include: run_sql.yml + vars: + sql_param : { file : "startupCDB.sql" , folder : "patch_sql" , task_action : "Start Database" } + + when: patch.type == "OJVM" + + when: perform_patch_actions and not (patch.upload_only | default(false)) + + # Start the database + - include: run_sql.yml + vars: + sql_param : { file : "startupCDB.sql" , folder : "patch_sql" , task_action : "Start Database for expdp" } + when: not only_deploy_patch and not perform_patch_actions # We only start the DB if not started on prev the block and needed for the next. + + # When only_deploy_patch is false (most common case) - block: - - include: run_sql.yml - vars: - sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database" } + # User custom pre-scripts + - include: run_script.yml + loop: "{{ user_expdp_pre | flatten(levels=1) }}" + loop_control: + loop_var: script_param + + - name: Set version parameter for expdp + set_fact: + expdp_version: "version={{ target_db_version }}" + when: (db_version.split('.')[0] | int) > target_db_version + + - name: Set compression parameter for expdp + set_fact: + expdp_compression: "compression=all compression_algorithm=high" + when: patch.expdp_comp | default(true) + + - name: Export Database Tables + shell: | + {{ dbhome_locl }}/bin/expdp \ + userid={{ dump_user_int }}/{{ dump_pass }} \ + directory={{ dump_dir_name }} \ + {{ expdp_compression | default('') }} \ + metrics=yes \ + dumpfile={{ load_file_name }} \ + logfile={{ dump_file_prefix }}.log \ + content=data_only \ + schemas={{ dump_user_int }} \ + {{ expdp_version | default('') }} + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + + # User custom post-scripts + - include: run_script.yml + loop: "{{ user_expdp_post | flatten(levels=1) }}" + loop_control: + loop_var: script_param + + when: not only_deploy_patch and not (patch.upload_only | default(false)) + + # When patch.upload_only is defined and true + - block: - - include: run_sql.yml - vars: - sql_param : { file : "startupCDB.sql" , folder : "patch_sql" , task_action : "Start Database" } - - when: patch.type == "OJVM" - - # User custom pre-scripts - - include: run_script.yml - loop: "{{ user_expdp_pre | flatten(levels=1) }}" - loop_control: - loop_var: script_param - - #- name : Export database tables - - name: Export Database Tables - shell: | - {{ dbhome_locl }}/bin/expdp userid={{ dump_user_int }}/{{ dump_pass }} directory=expdir compression=all dumpfile={{ dump_file_prefix }}.dmp logfile={{ dump_file_prefix }}.log content=data_only schemas={{ dump_user_int }} - environment: - ORACLE_HOME: "{{ dbhome_locl }}" - ORACLE_SID: "{{ mysid }}" - register: shell_output - become: true - become_user: oracle - delegate_to: "{{ vm_ip_address }}" - - # User custom post-scripts - - include: run_script.yml - loop: "{{ user_expdp_post | flatten(levels=1) }}" - loop_control: - loop_var: script_param + # User custom pre-scripts + - name: Save patch file + shell: | + cp -av {{ db_patch }} {{ shared_folder }}/{{ load_file_name }} + touch {{ shared_folder }}/{{ dump_file_prefix }}.log + + # User custom post-scripts + - include: run_script.yml + loop: "{{ user_expdp_post | flatten(levels=1) }}" + loop_control: + loop_var: script_param + + when: not only_deploy_patch and (patch.upload_only | default(false)) # Post Actions - include: patch_tasks_post.yml diff --git a/tasks/patch_main_11g.yml b/tasks/patch_main_11g.yml index 318094e..5b45304 100644 --- a/tasks/patch_main_11g.yml +++ b/tasks/patch_main_11g.yml @@ -3,60 +3,107 @@ - block: + # If needs to perform patch actions - block: # Stop the database - include: run_sql.yml vars: - sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database" } - + sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database for OPatch" } + when: not oci_mode or patch.dep_type is defined + # When patch has a dependency, if the dependency is loaded running the full patch process instead of loading from lvm, the DB will be left online. + + ## APPLY ## + - name: Run OPatch shell: | - export ORACLE_HOME ORACLE_SID - ./opatch apply -silent {{ VM_folder }}/{{ patch.patch_number }} -ocmrf {{ VM_folder }}/ocm.rsp + set -eo pipefail + export ORACLE_HOME ORACLE_SID + [ ! -d ~/opatch_logs ] && mkdir ~/opatch_logs + ./opatch apply -silent {{ VM_folder }}/{{ patch.patch_number }} -ocmrf {{ VM_folder }}/ocm.rsp 2>&1 | tee ~/opatch_logs/{{ patch.patch_number }}.log environment: ORACLE_HOME: "{{ dbhome_locl }}" ORACLE_SID: "{{ mysid }}" args: chdir: "{{ dbhome_locl }}/OPatch" - register: shell_output + register: tmp_shell_output become: true become_user: oracle + when: patch.apply_method is not defined or patch.apply_method == "opatch" delegate_to: "{{ vm_ip_address }}" - + + # Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" + - set_fact: shell_output="{{tmp_shell_output}}" + when: tmp_shell_output is not skipped + + ## NAPPLY ## + + - name: Run OPatch/opatch NAPPLY + shell: | + set -eo pipefail + export ORACLE_HOME ORACLE_SID + [ ! -d ~/opatch_logs ] && mkdir ~/opatch_logs + ./opatch napply -silent {{ VM_folder }}/{{ patch.patch_number }} -ocmrf {{ VM_folder }}/ocm.rsp 2>&1 | tee ~/opatch_logs/{{ patch.patch_number }}.log + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + args: + chdir: "{{ dbhome_locl }}/OPatch" + register: tmp_shell_output + become: true + become_user: oracle + when: patch.apply_method is defined and patch.apply_method == "napply" + delegate_to: "{{ vm_ip_address }}" + + # Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" + - set_fact: shell_output="{{tmp_shell_output}}" + when: tmp_shell_output is not skipped + - name: Opatch Output debug: msg="{{ shell_output.stdout_lines }}" when: shell_output.stdout_lines is defined - + - name: Disable Database Vault shell: | + set -eo pipefail {{ dbhome_locl }}/bin/chopt disable dv environment: ORACLE_HOME: "{{ dbhome_locl }}" ORACLE_SID: "{{ mysid }}" - register: shell_output become: true become_user: oracle delegate_to: "{{ vm_ip_address }}" - when: dbvault_enabled == true + when: dbvault_enabled # Start the database - include: run_sql.yml vars: - sql_param : { file : "startup.sql" , folder : "patch_sql" , task_action : "Start Database" } + sql_param : { file : "startup.sql" , folder : "patch_sql" , task_action : "Start Database for sqlpatch" } # Apply patch changes on DB (if PSU) - include: run_sql.yml vars: - sql_param : { file : "applySQLPatch.sql" , folder : "patch_sql" , task_action : "Apply Patch" , params : "psu" } - when: patch.type == "PSU" + sql_param : { file : "catbundle.sql" , folder : "rdbms/admin" , task_action : "Apply PSU Patch" , params : "psu apply" , root_dir : "{{ dbhome_locl }}"} + when: patch.type == "PSU" and patch.cat_script is not defined # Apply patch changes on DB (if BP) - include: run_sql.yml vars: - sql_param : { file : "applySQLPatch.sql" , folder : "patch_sql" , task_action : "Apply Patch" , params : "exa" } - when: patch.type == "BP" - + sql_param : { file : "catbundle.sql" , folder : "rdbms/admin" , task_action : "Apply BP Patch" , params : "exa apply" , root_dir : "{{ dbhome_locl }}"} + when: patch.type == "BP" and patch.cat_script is not defined + + # Apply patch changes on DB (if CPU) + - include: run_sql.yml + vars: + sql_param : { file : "catbundle.sql" , folder : "rdbms/admin" , task_action : "Apply CPU Patch" , params : "cpu apply" , root_dir : "{{ dbhome_locl }}"} + when: patch.type == "CPU" and patch.cat_script is not defined + + # Apply patch changes on DB (if Custom) + - include: run_sql.yml + vars: + sql_param : { file : "{{ patch.cat_script | basename }}" , folder : "{{ patch.cat_script | dirname }}" , task_action : "Run: {{ patch.cat_script }}" , root_dir : "{{ dbhome_locl }}" } + when: patch.cat_script is defined + # When the SQL Patch is for OJVM - block: @@ -80,52 +127,73 @@ # Stop the database - include: run_sql.yml vars: - sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database" } - + sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database to re-enable DB Vault" } + when: dbvault_enabled + - name: Enable Database Vault shell: | {{ dbhome_locl }}/bin/chopt enable dv environment: ORACLE_HOME: "{{ dbhome_locl }}" ORACLE_SID: "{{ mysid }}" - register: shell_output become: true become_user: oracle delegate_to: "{{ vm_ip_address }}" - when: dbvault_enabled == true + when: dbvault_enabled - when: patch.id != 0 + when: perform_patch_actions - # Start the database + # This start is only required if database was never stopped. - include: run_sql.yml vars: sql_param : { file : "startup.sql" , folder : "patch_sql" , task_action : "Start Database" } + when: not perform_patch_actions or (perform_patch_actions and dbvault_enabled) + + # When only_deploy_patch is false (most common case) + - block: + + # User custom pre-scripts + - name: Run user custom pre-scripts + include: run_script.yml + loop: "{{ user_expdp_pre | flatten(levels=1) }}" + loop_control: + loop_var: script_param + + - name: Remove compression parameter from expdp + set_fact: + expdp_compression: "" + when: (db_version.split('.')[0] | int) <= 10 + + - name: Set compression parameter for expdp + set_fact: + expdp_compression: "compression=all" + when: (db_version.split('.')[0] | int) >= 11 + + - name: Export Database Tables + shell: | + {{ dbhome_locl }}/bin/expdp \ + userid={{ dump_user_int }}/{{ dump_pass }} \ + directory={{ dump_dir_name }} \ + {{ expdp_compression | default('') }} \ + dumpfile={{ load_file_name }} \ + logfile={{ dump_file_prefix }}.log \ + content=data_only \ + schemas={{ dump_user_int }} + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + + # User custom post-scripts + - name: Run user custom post-scripts + include: run_script.yml + loop: "{{ user_expdp_post | flatten(levels=1) }}" + loop_control: + loop_var: script_param - # User custom pre-scripts - - name: Run user custom pre-scripts - include: run_script.yml - loop: "{{ user_expdp_pre | flatten(levels=1) }}" - loop_control: - loop_var: script_param - - #- name : Export database tables - - name: Export Database Tables - shell: | - {{ dbhome_locl }}/bin/expdp userid={{ dump_user_int }}/{{ dump_pass }} directory=expdir compression=all dumpfile={{ dump_file_prefix }}.dmp logfile={{ dump_file_prefix }}.log content=data_only schemas={{ dump_user_int }} - environment: - ORACLE_HOME: "{{ dbhome_locl }}" - ORACLE_SID: "{{ mysid }}" - register: shell_output - become: true - become_user: oracle - delegate_to: "{{ vm_ip_address }}" - - # User custom post-scripts - - name: Run user custom post-scripts - include: run_script.yml - loop: "{{ user_expdp_post | flatten(levels=1) }}" - loop_control: - loop_var: script_param + when: not only_deploy_patch # Post Actions - include: patch_tasks_post.yml diff --git a/tasks/patch_tasks_post.yml b/tasks/patch_tasks_post.yml index 756a1ee..ddccfb8 100644 --- a/tasks/patch_tasks_post.yml +++ b/tasks/patch_tasks_post.yml @@ -1,35 +1,79 @@ -- name: "Copy {{ dump_file_prefix }}.dmp to repository" - copy: - src: "{{ shared_folder }}/{{ dump_file_prefix }}.dmp" - dest: "{{ dump_folder }}" +# Skip the dump part if no expdp was executed +- block: -- name: "Copy {{ dump_file_prefix }}.log to repository" - copy: - src: "{{ shared_folder }}/{{ dump_file_prefix }}.log" - dest: "{{ dump_folder }}" + - name: "Copy {{ load_file_name }} to repository" + copy: + src: "{{ shared_folder }}/{{ load_file_name }}" + dest: "{{ output_folder }}/expdp" -- name : "Remove file {{ dump_file_prefix }}.dmp" + - name: "Copy {{ dump_file_prefix }}.log to repository" + copy: + src: "{{ shared_folder }}/{{ dump_file_prefix }}.log" + dest: "{{ output_folder }}/expdp" + + - name : "Remove file {{ load_file_name }}" + file: + state: absent + path: "{{ shared_folder }}/{{ load_file_name }}" + + - name : "Remove file {{ dump_file_prefix }}.log" + file: + state: absent + path: "{{ shared_folder }}/{{ dump_file_prefix }}.log" + + # This task will mark file as loaded + - include: run_script.yml + vars: + script_param: { file : "mark_dump_file_loaded.yml" , folder : "user_scripts/odbfcl/adb_load_expdp" , type : "yml", task_action : "Mark dpfile as loaded." } + + when: not only_deploy_patch + +- name : Remove unzipped patch folder file: state: absent - path: "{{ shared_folder }}/{{ dump_file_prefix }}.dmp" + path: "{{ unzip_patch_folder }}" + when: perform_patch_actions -- name : "Remove file {{ dump_file_prefix }}.log" +- name : Remove zipped patch file: state: absent - path: "{{ shared_folder }}/{{ dump_file_prefix }}.log" + path: "{{ shared_folder }}/{{ db_patch | basename }}" + when: perform_patch_actions and patch.apply_method is defined and patch.apply_method == "gold_image" -- name : Remove unzipped patch folder +# Here I don't check for perform_patch_actions as in some cases (like for LVM image usage) the patch will still be downloaded. +- name: Remove file downloaded from OCI Bucket file: state: absent - path: "{{ unzip_patch_folder }}" - when: patch.id != 0 + path: "{{ db_patch }}" + when: patch_location_type == "bucket" and db_patch != "" - name : Remove PatchSearch.xml file: state: absent path: "{{ shared_folder }}/PatchSearch.xml" - when: patch.id != 0 + when: perform_patch_actions - name : Define latest processed set_fact: - latest_processed: "{{ db_version }}.{{ patch.type }}.{{ patch.id }}" \ No newline at end of file + latest_processed: "{{ db_version }}|{{ patch.type }}|{{ patch.id }}" + +### Save latest applied PSU/RU as Base Snapshot for OJVM. +- block: + + - name : Generate Snapshot Name - VBox Mode + set_fact: + save_snapshot: "{{ db_version }} {{ patch.type }} {{ base_OJVM_id }}" + when: not oci_mode + + - include: vbox_savestate.yml + when: not oci_mode + + - name : Generate Snapshot Name - LVM Mode + set_fact: + save_snapshot: "{{ db_version_short }}_{{ patch.type }}_{{ base_OJVM_id }}" + when: oci_mode + + - include: lvm_savestate.yml + when: oci_mode + + when: base_OJVM_line is defined and ( patch.type == "PSU" or patch.type == "RU" ) and base_OJVM_line == latest_processed \ No newline at end of file diff --git a/tasks/patch_tasks_pre.yml b/tasks/patch_tasks_pre.yml index f7c1be1..5179997 100644 --- a/tasks/patch_tasks_pre.yml +++ b/tasks/patch_tasks_pre.yml @@ -1,114 +1,295 @@ - name: "Processing {{ db_version }} {{ patch.type }} {{ patch.id }} - Patch {{ patch.patch_number }}" debug: msg="Processing {{ db_version }} {{ patch.type }} {{ patch.id }} - Patch {{ patch.patch_number }}" -- name : Define file names +- name : Define dump file name and parameters set_fact: - dump_file_prefix: "tables_{{ db_version }}_{{ patch.base_ru | default('')}}{{ patch.type }}_{{ patch.id }}" - sha256_file: "sha256sum_{{ db_version }}_{{ patch.base_ru | default('')}}{{ patch.type }}_{{ patch.id }}.chk" + file_suffix: "{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}" + dump_file_prefix: "tables_{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}" + mysid: "{{ patch.oracle_sid | default(default_sid) }}" skip_all: false fix_datapatch_retries: 0 + # expdp_version: "" + patch_file_path: "" + db_patch: "" + perform_patch_actions: true # If opatch / datapatch / patch download / etc are needed or not. + restore_from_lvm: false + restore_from_tar: false -- name: "Check if {{ dump_folder }}/{{ dump_file_prefix }}.dmp exists" - stat: - path: "{{ dump_folder }}/{{ dump_file_prefix }}.dmp" - register: dump_stat_result - -# Will skip all the rest if the dump file exists -- name : Define skip_all +- name: Set DMP load file name set_fact: - skip_all: "{{ dump_stat_result.stat.exists }}" - when: skip_dump_exists == true - -- name : Remove dump file if exists - file: - state: absent - path: "{{ shared_folder }}/{{ dump_file_prefix }}.dmp" - when: skip_all == false + load_file_name: "{{ dump_file_prefix }}.dmp" + when: not (patch.upload_only | default(false)) -# Check if patch will need to reexecute datapatch -- name : Check datapatch reexecution +- name: Set ZIP load file name set_fact: - fix_datapatch_retries: "{{ err_list.retries }}" - loop: "{{ list_retry_datapatch | flatten(levels=1) }}" - loop_control: - loop_var: err_list - when: - - err_list.version == db_version - - err_list.type == patch.type - - err_list.id == patch.id - -# When not processing base release. i.e patch.id != 0 + load_file_name: "{{ dump_file_prefix }}.zip" + when: (patch.upload_only | default(false)) + +# Immediatly stop when skip_all becomes true - block: - # Place patch file on the shared folder - - name: Finding Patch File - find: - paths: "{{ source_folder }}" - patterns: "p{{ patch.patch_number }}_{{ db_version | regex_replace('\\.','') }}0_Linux-x86-64.zip" - recurse: "yes" - file_type: "file" - register: find_result + # Skip patch actions + - name: Base Release will skip patch actions + set_fact: + perform_patch_actions: false + when: patch.patch_number == 0 - - fail: - msg: "Could not find patch file. Check if patch folder is correct." - when: find_result.files[0] is undefined + # Ignore dumpfile checks when only_deploy_patch is true + - block: - - name: "Patch File" - debug: msg="{{ find_result.files[0].path }}" + - name: "Check if {{ output_folder }}/expdp/{{ load_file_name }} exists" + stat: + path: "{{ output_folder }}/expdp/{{ load_file_name }}" + register: load_file_stat_result + + # Will skip all the rest if the dump file exists + - name : Define skip_all + set_fact: + skip_all: "{{ load_file_stat_result.stat.exists }}" + when: skip_dump_exists + + - name : Remove dump file if exists + file: + state: absent + path: "{{ shared_folder }}/{{ load_file_name }}" - - name : Define file name + when: not only_deploy_patch + + # Check if patch will need to reexecute datapatch + - name : Check datapatch reexecution set_fact: - db_patch: "{{ find_result.files[0].path }}" - unzip_patch_folder: "{{ shared_folder }}/{{ patch.patch_number }}" + fix_datapatch_retries: "{{ err_list.retries }}" + loop: "{{ list_retry_datapatch | flatten(levels=1) }}" + loop_control: + loop_var: err_list + when: + - err_list.version == db_version + - err_list.type == patch.type + - err_list.id == patch.id + + # When processing something, or perform_patch_actions = true + - block: + + # Place patch file on the shared folder + - name: Finding Patch File + include: find_patch.yml + + # Call downloader when download_patch is defined and could not find the patch (patch_file_path|length == 0) + - block: + + - name: Call downloader + include: download_patch.yml + + # Try again after downloader was called + - name: Finding Patch File Again + include: find_patch.yml + + when: (patch_file_path|length == 0) and download_patch - - name: Remove unzipped patch folder - file: - state: absent - path: "{{ unzip_patch_folder }}" + # If still can't find the patch but ignore flag is set, jump to the next. + - name : Patch is not there, but ignoring... + set_fact: + skip_all: true + when: (patch_file_path|length == 0) and error_on_no_patch == false - - name : Unzip Patch to VM shared folder - unarchive: - src: "{{ db_patch }}" - dest: "{{ shared_folder }}" + - name : Check Patch File + assert: + that: (patch_file_path|length > 0) + fail_msg: "Could not find patch file. Check if patch folder is correct." + success_msg: "Patch File: {{ patch_file_path }}" - # When patch_folder variable is defined (mostly for BPs), extract that folder from unziped patch to apply + - name : Define Patch file name + set_fact: + db_patch: "{{ patch_file_path }}" + unzip_patch_folder: "{{ shared_folder }}/{{ patch.patch_number }}" + + when: perform_patch_actions + + # Trigger database start command for the first time if never started + - block: + + - name: Call role to start OCI VM + include_role: + name: oci_compute_instance_actions + vars: + compute_action: start + when: oci_mode + + - include: vbox_reload.yml + when: not oci_mode + +# Changed to see if peforms better +# - include: lvm_reload.yml +# when: oci_mode + + - include: setup_opatch.yml + - include: setup_database.yml + + - name : Define database_started variable to true. + set_fact: + database_started: true + + when: not database_started + + # This is needed when database is started already and there are multiple home PATHs (23ai) + - name : Override DB Home + set_fact: + dbhome_locl: "{{ patch.oracle_home }}" + when: database_started and patch.oracle_home is defined + + # Check if there is an image of the requested patch. + # If this is the case, we can skip the patch operations (set perform_patch_actions to false). - block: - - name: Process only patch subfolder - command: "mv {{ unzip_patch_folder }}/{{ patch.patch_folder }} {{ shared_folder }}" + - name: Get LVM list + include: lvm_list.yml + + - name: Check output + set_fact: + found_lvm_entry: "{{ lvm_search }}" + vars: + my_query: "lv_u01_{{ db_version_short }}_{{ patch.type }}_{{ patch.id }}$" + lvm_search: "{{ lvs_output.stdout_lines | select('match', my_query) | list | length > 0 }}" +# lvm_search: "{{ lvs_output.stdout_lines | select('search', my_query) | list | length > 0 }}" + + - block: + + # Skip patch actions + - name: LVM image found. Will skip patch actions. + set_fact: + perform_patch_actions: false + restore_from_lvm: true + + - name : Save old VM Snap + set_fact: + prev_vm_snapshot: "{{ vm_snapshot }}" - - name : Remove unzipped patch + - name : Set new VM Snap + set_fact: + vm_snapshot: "{{ db_version_short }}_{{ patch.type }}_{{ patch.id }}" + + when: found_lvm_entry + +# DEBUG: +# - name: Stop +# fail: +# msg: "Stop." + + when: oci_mode + + # Skip patch actions + - name: TAR file found. Will skip patch actions. + set_fact: + perform_patch_actions: false + restore_from_tar: true + when: patch.apply_method is defined and ( patch.apply_method == "tar" or patch.apply_method == "download_tar" ) and not restore_from_lvm + + # This part was together with the block before the lvm_check. + # It was put here together as we don't need to unzip the patch if using the VM. + - block: + + - name: Remove unzipped patch folder file: state: absent path: "{{ unzip_patch_folder }}" - - name : Rename patch subfolder - shell: "mv {{ shared_folder }}/{{ patch.patch_folder }} {{ unzip_patch_folder }}" + - name : Unzip Patch to VM shared folder + unarchive: + src: "{{ db_patch }}" + dest: "{{ shared_folder }}" + when: patch.patch_folder is undefined and (patch.apply_method is undefined or patch.apply_method != "gold_image") - when: patch.patch_folder is defined + - name : Copy zip Patch to VM shared folder + copy: + src: "{{ db_patch }}" + dest: "{{ shared_folder }}" + when: patch.apply_method is defined and patch.apply_method == "gold_image" - when: patch.id != 0 and skip_all == false + # When patch_folder variable is defined (mostly for BPs), extract that folder from unziped patch to apply + - block: -- include: vm_reload.yml - when: skip_all == false + - name : Unzip Patch to VM shared folder + shell: "unzip {{ db_patch }} '{{ patch.patch_number }}/{{ patch.patch_folder }}/*' -d {{ shared_folder }}" -# Replace opatch with latest version, when not processing base release. i.e patch.id != 0 -- block: + - name: Process only patch subfolder + command: "mv {{ unzip_patch_folder }}/{{ patch.patch_folder }} {{ shared_folder }}" + + - name : Remove unzipped patch + file: + state: absent + path: "{{ unzip_patch_folder }}" + + - name : Rename patch subfolder + shell: "mv {{ shared_folder }}/{{ patch.patch_folder }} {{ unzip_patch_folder }}" + + when: patch.patch_folder is defined and (patch.apply_method is undefined or patch.apply_method != "gold_image") + + - name: Remove file downloaded from OCI Bucket + file: + state: absent + path: "{{ db_patch }}" + when: patch_location_type == "bucket" and (not (patch.upload_only | default(false)) or only_deploy_patch) + + when: perform_patch_actions + + # Trigger database refresh command. + # This must be executed even if the "not database_started" block was just executed because of setup_database.yml script. + + - include: vbox_reload.yml + when: not oci_mode + + # We will run the lvm reload if we found the LVM entry to restore or if we are not running + - include: lvm_reload.yml + when: > + oci_mode and + ( + restore_from_lvm or + (patch.dep_type is not defined and not restore_from_tar) + ) + + - name : Restore old VM Snap + set_fact: + vm_snapshot: "{{ prev_vm_snapshot }}" + when: oci_mode and found_lvm_entry + + # It is not possible to have both restore_from_lvm and restore_from_tar as true + - include: tar_download.yml + when: restore_from_tar and patch.apply_method == "download_tar" + + # It is not possible to have both restore_from_lvm and restore_from_tar as true + - include: tar_restore.yml tar_file="{{ patch.apply_file }}" + when: restore_from_tar and patch.apply_method == "tar" + + # When download_rpm is true + - include: free_rpm_download.yml + when: patch.apply_method is defined and patch.apply_method == "download_rpm" + + # When patch has a pre-req, call the prepare_dependency script to setup. + - include: prepare_dependency.yml + when: patch.dep_type is defined and not restore_from_tar and not restore_from_lvm + + # Replace opatch with latest version, when perform_patch_actions + - block: + + - name: Remove OPatch folder + file: + state: absent + path: "{{ dbhome_locl }}/OPatch" + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + + - name : Unzip OPatch from VM shared folder + unarchive: + src: "{{ db_opatch }}" + dest: "{{ dbhome_locl }}" + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + + # skip_all must come first as db_opatch may not yet be declared + when: db_opatch|length > 0 # and perform_patch_actions + # place opatch even when there is no patch to be applied for the collector script. + # Some old versions of OPatch don't have the -bugs_fixed option. - - name: Remove OPatch folder - file: - state: absent - path: "{{ dbhome_locl }}/OPatch" - become: true - become_user: oracle - delegate_to: "{{ vm_ip_address }}" - - - name : Unzip OPatch from VM shared folder - unarchive: - src: "{{ db_opatch }}" - dest: "{{ dbhome_locl }}" - become: true - become_user: oracle - delegate_to: "{{ vm_ip_address }}" - - when: db_opatch|length > 0 and patch.id != 0 and skip_all == false \ No newline at end of file + when: not skip_all \ No newline at end of file diff --git a/tasks/prepare_dependency.yml b/tasks/prepare_dependency.yml new file mode 100644 index 0000000..4ad36ca --- /dev/null +++ b/tasks/prepare_dependency.yml @@ -0,0 +1,91 @@ +- name : Cascade dependencies not supported + fail: + msg: "More than 2 cascade dependencies not supported." + when: bkp2_patch is defined and bkp2_patch != None + +- name : Backup2 Variables + set_fact: + bkp2_patch: "{{ bkp1_patch }}" + bkp2_skip_dump_exists: "{{ bkp1_skip_dump_exists }}" + bkp2_only_deploy_patch: "{{ bkp1_only_deploy_patch }}" + bkp2_file_suffix: "{{ bkp1_file_suffix }}" + bkp2_dump_file_prefix: "{{ bkp1_dump_file_prefix }}" + bkp2_skip_all: "{{ bkp1_skip_all }}" + bkp2_mysid: "{{ bkp1_mysid }}" + bkp2_fix_datapatch_retries: "{{ bkp1_fix_datapatch_retries }}" + bkp2_db_patch: "{{ bkp1_db_patch }}" + bkp2_unzip_patch_folder: "{{ bkp1_unzip_patch_folder }}" + bkp2_perform_patch_actions: "{{ bkp1_perform_patch_actions }}" + bkp2_load_file_name: "{{ bkp1_load_file_name }}" + when: bkp1_patch is defined and bkp1_patch != None + +- name : Backup1 Variables + set_fact: + bkp1_patch: "{{ patch }}" + bkp1_skip_dump_exists: "{{ skip_dump_exists }}" + bkp1_only_deploy_patch: "{{ only_deploy_patch }}" + bkp1_file_suffix: "{{ file_suffix }}" + bkp1_dump_file_prefix: "{{ dump_file_prefix }}" + bkp1_skip_all: "{{ skip_all }}" + bkp1_mysid: "{{ mysid }}" + bkp1_fix_datapatch_retries: "{{ fix_datapatch_retries }}" + bkp1_db_patch: "{{ db_patch }}" + bkp1_unzip_patch_folder: "{{ unzip_patch_folder }}" + bkp1_perform_patch_actions: "{{ perform_patch_actions }}" + bkp1_load_file_name: "{{ load_file_name }}" + +- name : Replace settings + set_fact: + skip_dump_exists: false + only_deploy_patch: true + +# Execute dependency +- include: "{{ patch_file }}" + loop: "{{ lookup('vars', patch_list) | flatten(levels=1) }}" + loop_control: + loop_var: patch + label: "{{ patch.id }}" + when: + - (patch.version | default(db_version)) == (bkp1_patch.version | default(db_version)) + - patch.type == bkp1_patch.dep_type + - patch.id == bkp1_patch.dep_id + +- name : Restore Main Variables + set_fact: + skip_dump_exists: "{{ bkp1_skip_dump_exists }}" + only_deploy_patch: "{{ bkp1_only_deploy_patch }}" + patch: "{{ bkp1_patch }}" + file_suffix: "{{ bkp1_file_suffix }}" + dump_file_prefix: "{{ bkp1_dump_file_prefix }}" + skip_all: "{{ bkp1_skip_all }}" + mysid: "{{ bkp1_mysid }}" + fix_datapatch_retries: "{{ bkp1_fix_datapatch_retries }}" + db_patch: "{{ bkp1_db_patch }}" + unzip_patch_folder: "{{ bkp1_unzip_patch_folder }}" + perform_patch_actions: "{{ bkp1_perform_patch_actions }}" + load_file_name: "{{ bkp1_load_file_name }}" + +- name : Clean Backup1 Variables + set_fact: + bkp1_patch: + +- name : Restore Backup1 Variables + set_fact: + bkp1_skip_dump_exists: "{{ bkp2_skip_dump_exists }}" + bkp1_only_deploy_patch: "{{ bkp2_only_deploy_patch }}" + bkp1_patch: "{{ bkp2_patch }}" + bkp1_file_suffix: "{{ bkp2_file_suffix }}" + bkp1_dump_file_prefix: "{{ bkp2_dump_file_prefix }}" + bkp1_skip_all: "{{ bkp2_skip_all }}" + bkp1_mysid: "{{ bkp2_mysid }}" + bkp1_fix_datapatch_retries: "{{ bkp2_fix_datapatch_retries }}" + bkp1_db_patch: "{{ bkp2_db_patch }}" + bkp1_unzip_patch_folder: "{{ bkp2_unzip_patch_folder }}" + bkp1_perform_patch_actions: "{{ bkp2_perform_patch_actions }}" + bkp1_load_file_name: "{{ bkp2_load_file_name }}" + when: bkp2_patch is defined and bkp2_patch != None + +- name : Clean Backup2 Variables + set_fact: + bkp2_patch: + when: bkp2_patch is defined and bkp2_patch != None diff --git a/tasks/run_sql.yml b/tasks/run_sql.yml index 384aa64..0cd8cdc 100644 --- a/tasks/run_sql.yml +++ b/tasks/run_sql.yml @@ -5,14 +5,18 @@ # sql_param.params : Eventual parameters that may be provided to SQL script. # sql_param.termout : Boolean - print the SQL output. (Default: false) # sql_param.task_action : Task name to print. +# sql_param.root_dir : Where sql_param.folder is located. (Default: VM_folder variable) - name: "Run SQL - {{ sql_param.task_action }}" shell: | + set -e export ORACLE_HOME ORACLE_SID - {{ dbhome_locl }}/bin/sqlplus -s "/ as sysdba" @{{ VM_folder }}/{{ sql_param.folder | default('user_scripts') }}/{{ sql_param.file }} {{ sql_param.params | default('') }} + {{ dbhome_locl }}/bin/sqlplus -L -S "/ as sysdba" @{{ sql_param.root_dir | default(VM_folder) }}/{{ sql_param.folder | default('user_scripts') }}/{{ sql_param.file }} {{ sql_param.params | default('') }} environment: ORACLE_HOME: "{{ dbhome_locl }}" ORACLE_SID: "{{ mysid }}" + args: + chdir: "{{ sql_param.root_dir | default(VM_folder) }}/{{ sql_param.folder | default('user_scripts') }}" register: sqloutput become: true become_user: oracle @@ -21,3 +25,9 @@ - name: SQL Output debug: msg="{{ sqloutput.stdout_lines }}" when: (sql_param.termout | default(false)) == true + +- name: SQLPlus Error! + fail: + msg: "Found SP2 string in SQLPlus output." + when: '"SP2-" in sqloutput.stdout' +# when: sql_param.file == "hashGet.sql" diff --git a/tasks/setup_database.yml b/tasks/setup_database.yml index a23640b..920a947 100644 --- a/tasks/setup_database.yml +++ b/tasks/setup_database.yml @@ -1,5 +1,5 @@ - name: Find the location of DB Home from the SID - shell: 'grep {{ mysid }} /etc/oratab |grep -v ^[#] | cut -d: -f2|head -1' + shell: 'grep {{ mysid }} /etc/oratab | grep -v ^[#] | cut -d: -f2 | head -1' register: dbhomeoutput delegate_to: "{{ vm_ip_address }}" @@ -7,13 +7,18 @@ set_fact: dbhome_locl: "{{ dbhomeoutput.stdout }}" +- name : Override DB Home + set_fact: + dbhome_locl: "{{ patch.oracle_home }}" + when: patch.oracle_home is defined + - name : Print DB Home debug: var=dbhome_locl - name : Fail when ORACLE_HOME is null fail: msg: "Could not find ORACLE_HOME. Check if database {{ mysid }} is registered in /etc/oratab." - when: dbhomeoutput.stdout == '' + when: dbhome_locl == '' - block: @@ -22,7 +27,7 @@ src: files/ocm.rsp dest: "{{ shared_folder }}" mode: u=rw,g=r,o=r - + - name: Check if Database Vault is enabled shell: 'ar -t {{dbhome_locl}}/rdbms/lib/libknlopt.a | grep -q kzvidv.o && echo true || echo false' register: dbvaultoutput @@ -35,45 +40,85 @@ - name : Print Database Vault value debug: msg="Database Vault Enabled - {{ dbvault_enabled }}" - when: db_version == "11.2.0.4" +# when: db_version == "11.2.0.2" or db_version == "11.2.0.3" or db_version == "11.2.0.4" + when: ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) <= 11 ### Check if CDB -- name: "Check if CDB is enabled" - shell: | - export ORACLE_HOME ORACLE_SID - {{ dbhome_locl }}/bin/sqlplus -s "/ as sysdba" <<'EOF' | sed '/^$/d' - whenever sqlerror exit sql.sqlcode - set pages 0 head off feed off echo off trims on ver off term off - - COL is_ver_ge_12 new_v is_ver_ge_12 nopri - COL is_cdb_temp_col new_v is_cdb_temp_col nopri - COL is_cdb new_v is_cdb - - select case when version >= 12 then 'Y' else 'N' end is_ver_ge_12 - from (select to_number(substr(version,1,instr(version,'.')-1)) version - from v$instance); - - select DECODE('&&is_ver_ge_12.','Y','CDB','''N''') is_cdb_temp_col from dual; - - set term on - select decode(substr(&&is_cdb_temp_col.,1,1),'Y','true','N','false') is_cdb from v$database; - exit - EOF - environment: - ORACLE_HOME: "{{ dbhome_locl }}" - ORACLE_SID: "{{ mysid }}" - register: shell_output - become: true - become_user: oracle - delegate_to: "{{ vm_ip_address }}" +- block: + + - name: "Startup" + include: run_sql.yml + vars: + sql_param : { file : "startup.sql" , folder : "patch_sql" , task_action : "Start Database" } + when: oci_mode + + - name: "Check if CDB is enabled" + shell: | + set -eo pipefail + export ORACLE_HOME ORACLE_SID + {{ dbhome_locl }}/bin/sqlplus -L -S "/ as sysdba" <<'EOF' | sed '/^$/d' + whenever sqlerror exit sql.sqlcode + set pages 0 head off feed off echo off trims on ver off term on + select decode(substr(CDB,1,1),'Y','true','N','false') is_cdb from v$database; + exit + EOF + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + register: shell_output + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + + - name: SQL Output + debug: msg="{{ shell_output.stdout_lines }}" + + - name : Define CDB variable + set_fact: + db_iscdb: "{{ shell_output.stdout | bool }}" + + # If any error happens in this block, will trigger a LVM refresh and try again. + rescue: + + - name: Already tried that before error. No other chance. + fail: + msg: "Failed to get some database information." + when: db_start_retried is defined and db_start_retried -- name: SQL Output - debug: msg="{{ shell_output.stdout_lines }}" + - name: Print when errors + debug: + msg: 'I caught an error. Trying to lvm reload..' + + - name : Set db_start_retried variable + set_fact: + db_start_retried: true + + - include: lvm_reload.yml + when: oci_mode + + - include: setup_database.yml + + # If the previous include succeeded, reset variable. + - name : Clean db_start_retried variable + set_fact: + db_start_retried: false + +# when: db_version != "11.2.0.2" and db_version != "11.2.0.3" and db_version != "11.2.0.4" + when: ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) > 11 and ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) < 23 + + +- name : Define CDB variable + set_fact: + db_iscdb: false +# when: db_version == "11.2.0.2" or db_version == "11.2.0.3" or db_version == "11.2.0.4" + when: ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) <= 11 - name : Define CDB variable set_fact: - db_iscdb: "{{ shell_output.stdout | bool }}" + db_iscdb: true +# when: db_version == "11.2.0.2" or db_version == "11.2.0.3" or db_version == "11.2.0.4" + when: ( db_version | regex_replace('^([^\.]+).*','\\1') | int ) >= 23 ### Adjust dump_user_int based on database type and provided value. diff --git a/tasks/setup_env.yml b/tasks/setup_env.yml index 4456749..ea96746 100644 --- a/tasks/setup_env.yml +++ b/tasks/setup_env.yml @@ -1,14 +1,27 @@ +- name: Ensure shared disk "{{ shared_mount }}" is mounted + shell: | + set -eo pipefail + if mount | grep -q -F ' {{ shared_mount }} ' + then + echo ok + else + mount {{ shared_mount }} + fi + become: true + become_user: root + when: oci_mode + - name: Copy patch SQL to shared folder - copy: + synchronize: src: patch_sql/ dest: "{{ shared_folder }}/patch_sql/" - mode: u=rw,g=r,o=r + delete: yes - name: Copy user SQL to shared folder - copy: + synchronize: src: user_scripts/ dest: "{{ shared_folder }}/user_scripts/" - mode: u=rw,g=r,o=r + delete: yes - name : Check parameter param_patch set_fact: @@ -27,4 +40,10 @@ - name : Define latest processed as null set_fact: - latest_processed: "" \ No newline at end of file + latest_processed: "" + +- name : Define patch_location_bucket + set_fact: + patch_location_bucket: "{{ patch_location_path }}" + patch_location_path: "{{ stage_folder }}" + when: patch_location_type == "bucket" \ No newline at end of file diff --git a/tasks/setup_opatch.yml b/tasks/setup_opatch.yml index c728381..5d7db55 100644 --- a/tasks/setup_opatch.yml +++ b/tasks/setup_opatch.yml @@ -1,6 +1,28 @@ +# If bucket +- block: + + - name: List files in OCI Bucket + include_role: + name: oci_object_storage_object_facts + vars: + object_action: "list" + oci_list_bucket: "{{ patch_location_bucket }}" + + - name: Download OPatch file from OCI Bucket + shell: | + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + oci os object get --bucket-name {{ patch_location_bucket }} --name {{ oci_download_file }} --file {{ patch_location_path }}/{{ oci_download_file | basename }} + vars: + my_query: "{{ opatch_file }}" + oci_download_file: "{{ oci_action.objects | map(attribute='name') | select('search', my_query) | list | first }}" + when: oci_action.objects | map(attribute='name') | select('search', my_query) | list | length > 0 + + when: patch_location_type == "bucket" + - name: Finding OPatch File find: - paths: "{{ source_folder }}" + paths: "{{ patch_location_path }}" patterns: "{{ opatch_file }}" recurse: "yes" file_type: "file" diff --git a/tasks/tar_download.yml b/tasks/tar_download.yml new file mode 100644 index 0000000..dd39352 --- /dev/null +++ b/tasks/tar_download.yml @@ -0,0 +1,43 @@ +# If bucket +- block: + + - name: List files in OCI Bucket + include_role: + name: oci_object_storage_object_facts + vars: + object_action: "list" + oci_list_bucket: "{{ patch_location_bucket }}" + + - name: Download TAR file from OCI Bucket + shell: | + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + oci os object get --bucket-name {{ patch_location_bucket }} --name {{ oci_download_file }} --file {{ shared_folder }}/{{ oci_download_file | basename }} + vars: + my_query: "{{ patch.apply_file }}" + oci_download_file: "{{ oci_action.objects | map(attribute='name') | select('search', my_query) | list | first }}" + when: oci_action.objects | map(attribute='name') | select('search', my_query) | list | length > 0 + + when: patch_location_type == "bucket" + +- name: Finding TAR File + find: + paths: "{{ shared_folder }}" + patterns: "{{ patch.apply_file }}" + recurse: "no" + file_type: "file" + register: find_result + +# If TAR was not found +- name: Could not find TAR file + fail: + msg: "Could not find TAR file." + when: find_result.files[0] is undefined + +# Restore tar file +- include: tar_restore.yml tar_file="{{ find_result.files[0].path }}" + +- name : "Remove TAR {{ find_result.files[0].path }} from shared folder" + file: + state: absent + path: "{{ find_result.files[0].path }}" \ No newline at end of file diff --git a/tasks/tar_restore.yml b/tasks/tar_restore.yml new file mode 100644 index 0000000..2398180 --- /dev/null +++ b/tasks/tar_restore.yml @@ -0,0 +1,58 @@ +# Stop the database +- include: run_sql.yml + vars: + sql_param : { file : "shutdown.sql" , folder : "patch_sql" , task_action : "Stop Database for UNTAR" } + ignore_errors: yes # added as the previous database may be running with a diff home setting (example, it was /opt/oracle/product/23c/dbhomeFree and now is /opt/oracle/product/23ai/dbhomeFree) and may fail. + # when: not oci_mode or patch.dep_type is defined + # When patch has a dependency, if the dependency is loaded running the full patch process instead of loading from lvm, the DB will be left online. + +- name: "Kill all Oracle processes" + shell: | + set -e -x + # Term all oracle sessions + pkill -U oracle || true + # Kill all oracle sessions + sleep 5 + pkill -9 -U oracle || true + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + +- name: "Clean oracle Shared Segments" + shell: | + # Clean Shared Segments (ORA-12547 TNS: Lost Contact) + ipcs -m | grep oracle | awk ' { print $2 } ' | xargs -I {} ipcrm -m {} + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + +- name: "Free /dev/shm" + shell: | + set -e -x + # Free up space on /dev/shm + umount /dev/shm + mount /dev/shm + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + +## TAR ## + +- name: UNTAR full Oracle + shell: | + rm -rf /u01/* + tar -xzf {{ tar_file }} + args: + chdir: "/" + register: tmp_shell_output + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + +# Put the value inside another variable to avoid it from getting replaced with "skip_reason": "Conditional result was False" +- set_fact: shell_output="{{tmp_shell_output}}" + when: tmp_shell_output is not skipped + +- name: TAR Output + debug: msg="{{ shell_output.stdout_lines }}" + when: shell_output.stdout_lines is defined \ No newline at end of file diff --git a/tasks/vm_reload.yml b/tasks/vbox_reload.yml similarity index 100% rename from tasks/vm_reload.yml rename to tasks/vbox_reload.yml diff --git a/tasks/vm_savestate.yml b/tasks/vbox_savestate.yml similarity index 82% rename from tasks/vm_savestate.yml rename to tasks/vbox_savestate.yml index 71f86c6..987c34b 100644 --- a/tasks/vm_savestate.yml +++ b/tasks/vbox_savestate.yml @@ -1,10 +1,10 @@ ## This code will take a snapshot named "vm_snapshot" for the VM. It will later be used as a base release for OJVMs. # Save latest machine image if not already -- name: "Create new VM snapshot \"{{ vm_snapshot }}\" if not exists." +- name: "Create new VM snapshot \"{{ save_snapshot }}\" if not exists." shell: | MACHINE="{{ vm_machine }}" - SNAPSHOT="{{ vm_snapshot }}" + SNAPSHOT="{{ save_snapshot }}" if ! $(VBoxManage showvminfo --machinereadable "$MACHINE" | grep -q "^SnapshotName.*=\"$SNAPSHOT\"") then VBoxManage snapshot "$MACHINE" take "$SNAPSHOT" diff --git a/user_scripts/cleanUser.sql b/user_scripts/cleanUser.sql index d7e67f7..96b7016 100644 --- a/user_scripts/cleanUser.sql +++ b/user_scripts/cleanUser.sql @@ -18,7 +18,7 @@ BEGIN FOR I IN (select owner,table_name from sys.all_tables where owner=SYS_CONTEXT('USERENV','CURRENT_SCHEMA')) LOOP VCODE := 'TRUNCATE TABLE ' || DBMS_ASSERT.SCHEMA_NAME(I.OWNER) || '.' || DBMS_ASSERT.SQL_OBJECT_NAME(I.TABLE_NAME); - DBMS_OUTPUT.PUT_LINE(VCODE); + DBMS_OUTPUT.PUT_LINE(VCODE || ';'); EXECUTE IMMEDIATE VCODE; END LOOP; END; diff --git a/user_scripts/createUser.sql b/user_scripts/createUser.sql index aa755c2..8ece518 100644 --- a/user_scripts/createUser.sql +++ b/user_scripts/createUser.sql @@ -1,11 +1,12 @@ -- Create HASH user +WHENEVER SQLERROR CONTINUE -DROP USER HASH CASCADE; +DROP USER &&1. CASCADE; WHENEVER SQLERROR EXIT SQL.SQLCODE -CREATE USER HASH IDENTIFIED BY "hash" DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP"; +CREATE USER &&1. IDENTIFIED BY "hash" DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP"; -GRANT UNLIMITED TABLESPACE TO HASH; -GRANT CREATE SESSION TO HASH; -GRANT "DBA" TO HASH; \ No newline at end of file +GRANT UNLIMITED TABLESPACE TO &&1.; +GRANT CREATE SESSION TO &&1.; +GRANT "DBA" TO &&1.; \ No newline at end of file diff --git a/user_scripts/externalDir.sql b/user_scripts/externalDir.sql index 79ca417..3feb3b2 100644 --- a/user_scripts/externalDir.sql +++ b/user_scripts/externalDir.sql @@ -1,6 +1,12 @@ --- This code is called just before the expdp. EXPDIR is used by expdp and must exist. +-- This code is called just before the expdp. The DB directory is used by expdp and must exist. WHENEVER SQLERROR EXIT SQL.SQLCODE -CREATE OR REPLACE DIRECTORY expdir AS '&1'; +def v_path='&1.' +def v_username='&2.' +def v_dir_name='&3.' + +CREATE OR REPLACE DIRECTORY &v_dir_name. AS '&v_path.'; + +GRANT READ,WRITE ON DIRECTORY &v_dir_name. to &v_username.; EXIT 0 \ No newline at end of file diff --git a/user_scripts/externalDir.yml b/user_scripts/externalDir.yml index fc579ab..97437ac 100644 --- a/user_scripts/externalDir.yml +++ b/user_scripts/externalDir.yml @@ -1,3 +1,3 @@ - include: tasks/run_sql.yml vars: - sql_param : { file : "externalDir.sql" , task_action : "Create External Directory" , params : "{{ VM_folder }}" } + sql_param : { file : "externalDir.sql" , task_action : "Create External Directory" , params : "'{{ VM_folder }}' '{{ dump_user_int }}' '{{ dump_dir_name }}'" } diff --git a/user_scripts/gen/create_hash_custom.sql b/user_scripts/gen/create_hash_custom.sql index 8fe07b3..38e7878 100644 --- a/user_scripts/gen/create_hash_custom.sql +++ b/user_scripts/gen/create_hash_custom.sql @@ -53,7 +53,7 @@ DECLARE V_SQL := V_SQL || ' WHERE ' || IN_WHERE_CLAUSE_12; END IF; END IF; - DBMS_OUTPUT.PUT_LINE(V_SQL); + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); EXECUTE IMMEDIATE 'alter session set current_schema=SYS'; EXECUTE IMMEDIATE V_SQL; diff --git a/user_scripts/gen/create_hash_others.sql b/user_scripts/gen/create_hash_dba_cdb.sql similarity index 99% rename from user_scripts/gen/create_hash_others.sql rename to user_scripts/gen/create_hash_dba_cdb.sql index 7127da1..f8521b7 100644 --- a/user_scripts/gen/create_hash_others.sql +++ b/user_scripts/gen/create_hash_dba_cdb.sql @@ -63,7 +63,7 @@ DECLARE V_SQL := V_SQL || ' WHERE ' || IN_WHERE_CLAUSE_12; END IF; END IF; - DBMS_OUTPUT.PUT_LINE(V_SQL); + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); EXECUTE IMMEDIATE V_SQL; END; diff --git a/user_scripts/gen/create_hash_dv.sql b/user_scripts/gen/create_hash_dv.sql index 56aefe2..4f4d538 100644 --- a/user_scripts/gen/create_hash_dv.sql +++ b/user_scripts/gen/create_hash_dv.sql @@ -51,7 +51,7 @@ DECLARE V_SQL := V_SQL || ' WHERE ' || IN_WHERE_CLAUSE_12; END IF; END IF; - DBMS_OUTPUT.PUT_LINE(V_SQL); + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); EXECUTE IMMEDIATE 'alter session set current_schema=SYS'; EXECUTE IMMEDIATE V_SQL; diff --git a/user_scripts/gen/create_hash_source.sql b/user_scripts/gen/create_hash_source.sql index 126d4ca..cd38375 100644 --- a/user_scripts/gen/create_hash_source.sql +++ b/user_scripts/gen/create_hash_source.sql @@ -37,7 +37,7 @@ BEGIN LOOP VCODE := VCODE || I.TEXT; IF I.LINE = I.LAST_LINE THEN - INSERT INTO T_HASH (OWNER, NAME, TYPE, ORIGIN_CON_ID, CON_ID, MD5_ENC, SHA1_ENC, SERIES, ORAVERSION, PSU, CODE) + INSERT INTO T_HASH (OWNER, NAME, TYPE, ORIGIN_CON_ID, CON_ID, MD5_HASH, SHA1_HASH, SERIES, ORAVERSION, PSU, CODE) VALUES (I.OWNER, I.NAME, I.TYPE, I.ORIGIN_CON_ID, I.CON_ID, SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_MD5), SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_SH1), VSER, VVERS, VPSU, VCODE); VCODE := ''; -- Zera a variável diff --git a/user_scripts/gen/create_hash_view.sql b/user_scripts/gen/create_hash_view.sql index af0d82e..b6c94d2 100644 --- a/user_scripts/gen/create_hash_view.sql +++ b/user_scripts/gen/create_hash_view.sql @@ -85,7 +85,7 @@ BEGIN VCODE := UPPER(I.TEXT); VCODE := replaceClob(VCODE,'[[:space:]]*',''); -- Remove all space characters VCODE := replaceClob(VCODE,'"',''); -- Remove all quotes - INSERT INTO T_HASH (OWNER, NAME, TYPE, ORIGIN_CON_ID, CON_ID, MD5_ENC, SHA1_ENC, SERIES, ORAVERSION, PSU, CODE) + INSERT INTO T_HASH (OWNER, NAME, TYPE, ORIGIN_CON_ID, CON_ID, MD5_HASH, SHA1_HASH, SERIES, ORAVERSION, PSU, CODE) VALUES (I.OWNER, I.NAME, I.TYPE, I.ORIGIN_CON_ID, I.CON_ID, SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_MD5), SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_SH1), VSER, VVERS, VPSU, I.TEXT); diff --git a/user_scripts/gen/fileGet.yml b/user_scripts/gen/fileGet.yml index 2a2299d..6f13c51 100644 --- a/user_scripts/gen/fileGet.yml +++ b/user_scripts/gen/fileGet.yml @@ -1,54 +1,63 @@ # Folder to store the final generated ORACLE_HOME checksum -- name : Define folder name +- name : Define chksum folder name set_fact: - chksum_folder: "/Volumes/Samsung_T3/OraSum/files/binsum" + chksum_folder: "{{ output_folder }}/binsum" -- name : Define file names +- name : Define chksum file names set_fact: - sha256_file: "sha256sum_{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}.chk" - -- name: Generate files checksum - shell: | - find -type f -exec sha256sum "{}" + > {{ VM_folder }}/{{ sha256_file }} - args: - chdir: "{{ dbhome_locl }}" - register: sqloutput - become: true - become_user: root - delegate_to: "{{ vm_ip_address }}" - -- name: Generate files checksum for static libs - shell: | - v_libs=$(find {{ dbhome_locl }} -type f -name "*.a") - - v_ext_fold=/tmp/statlib - v_out_file=/tmp/statlib_list.txt - - IFS=$'\n' - for v_lib in ${v_libs} - do - rm -rf "${v_ext_fold}" - mkdir "${v_ext_fold}" - cd "${v_ext_fold}" - ar x "${v_lib}" - find -type f -exec sha256sum "{}" + > ${v_out_file} - sed -i "s| \.| ${v_lib}|" ${v_out_file} - cat ${v_out_file} >> {{ VM_folder }}/{{ sha256_file }} - rm -rf ${v_ext_fold} ${v_out_file} - done - args: - chdir: "{{ dbhome_locl }}" - register: sqloutput - become: true - become_user: root - delegate_to: "{{ vm_ip_address }}" - -- name: Copy {{ sha256_file }} to repository - copy: - src: "{{ shared_folder }}/{{ sha256_file }}" - dest: "{{ chksum_folder }}" - -- name : "Remove file {{ sha256_file }}" - file: - state: absent - path: "{{ shared_folder }}/{{ sha256_file }}" \ No newline at end of file + sha256_file: "sha256sum_{{ file_suffix }}.chk" + +- name: "Check if {{ chksum_folder }}/{{ sha256_file }} exists" + stat: + path: "{{ chksum_folder }}/{{ sha256_file }}" + register: chksum_stat_result + +# Will skip all the rest if the chksum file exists + +- block : + + - name: Generate files checksum + shell: | + find -type f -exec sha256sum "{}" + > {{ VM_folder }}/{{ sha256_file }} + args: + chdir: "{{ dbhome_locl }}" + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + + - name: Generate files checksum for static libs + shell: | + v_libs=$(find {{ dbhome_locl }} -type f -name "*.a") + + v_ext_fold=/tmp/statlib + v_out_file=/tmp/statlib_list.txt + + IFS=$'\n' + for v_lib in ${v_libs} + do + rm -rf "${v_ext_fold}" + mkdir "${v_ext_fold}" + cd "${v_ext_fold}" + ar x "${v_lib}" + find -type f -exec sha256sum "{}" + > ${v_out_file} + sed -i "s| \.| ${v_lib}|" ${v_out_file} + cat ${v_out_file} >> {{ VM_folder }}/{{ sha256_file }} + rm -rf ${v_ext_fold} ${v_out_file} + done + args: + chdir: "{{ dbhome_locl }}" + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + + - name: Copy {{ sha256_file }} to repository + copy: + src: "{{ shared_folder }}/{{ sha256_file }}" + dest: "{{ chksum_folder }}" + + - name : "Remove file {{ sha256_file }}" + file: + state: absent + path: "{{ shared_folder }}/{{ sha256_file }}" + + when: not chksum_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts/gen/hashGet.sql b/user_scripts/gen/hashGet.sql index f4aaed6..be88336 100644 --- a/user_scripts/gen/hashGet.sql +++ b/user_scripts/gen/hashGet.sql @@ -47,7 +47,7 @@ PRO CDB/DBA_VIEWS @@create_hash_view.sql PRO All others CDB/DBA -@@create_hash_others.sql +@@create_hash_dba_cdb.sql PRO Non CDB/DBA views or tables @@create_hash_custom.sql diff --git a/user_scripts/load/change_all_hash_code.sql b/user_scripts/load/change_all_hash_code.sql old mode 100755 new mode 100644 index 9fd2f30..17bd47e --- a/user_scripts/load/change_all_hash_code.sql +++ b/user_scripts/load/change_all_hash_code.sql @@ -81,7 +81,7 @@ DECLARE end; -- [[:graph:]] should be replaced by [A-Z][a-z][0-9]_$+=# BEGIN - FOR I IN (SELECT T_HASH_F.ROWID,T_HASH_F.*,T2.CODE REALCODE FROM T_HASH_F, (SELECT SHA1_ENC, CODE, RANK() OVER(PARTITION BY SHA1_ENC ORDER BY ROWID ASC) LIN FROM T_HASH) T2 WHERE T_HASH_F.SHA1_ENC = T2.SHA1_ENC AND T2.LIN=1 + FOR I IN (SELECT T_HASH_F.ROWID,T_HASH_F.*,T2.CODE REALCODE FROM T_HASH_F, (SELECT SHA1_HASH, CODE, RANK() OVER(PARTITION BY SHA1_HASH ORDER BY ROWID ASC) LIN FROM T_HASH) T2 WHERE T_HASH_F.SHA1_HASH = T2.SHA1_HASH AND T2.LIN=1 AND T_HASH_F.TYPE <> 'VIEW') LOOP VCODE := I.REALCODE; -- Zera a variável @@ -126,8 +126,8 @@ BEGIN IF VCODE <> I.REALCODE THEN UPDATE T_HASH_F - SET MD5_ENC = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_MD5), - SHA1_ENC = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_SH1) + SET MD5_HASH = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_MD5), + SHA1_HASH = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_SH1) WHERE ROWID = I.ROWID; END IF; IF VNAME <> I.NAME THEN @@ -199,7 +199,7 @@ DECLARE end; BEGIN - FOR I IN (SELECT T_HASH_F.ROWID,T_HASH_F.*,T2.CODE REALCODE FROM T_HASH_F, (SELECT SHA1_ENC, CODE, RANK() OVER(PARTITION BY SHA1_ENC ORDER BY ROWID ASC) LIN FROM T_HASH) T2 WHERE T_HASH_F.SHA1_ENC = T2.SHA1_ENC AND T2.LIN=1 + FOR I IN (SELECT T_HASH_F.ROWID,T_HASH_F.*,T2.CODE REALCODE FROM T_HASH_F, (SELECT SHA1_HASH, CODE, RANK() OVER(PARTITION BY SHA1_HASH ORDER BY ROWID ASC) LIN FROM T_HASH) T2 WHERE T_HASH_F.SHA1_HASH = T2.SHA1_HASH AND T2.LIN=1 AND T_HASH_F.TYPE = 'VIEW') LOOP VREALCODE := UPPER(I.REALCODE); @@ -218,8 +218,8 @@ BEGIN IF VCODE <> VREALCODE THEN UPDATE T_HASH_F - SET MD5_ENC = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_MD5), - SHA1_ENC = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_SH1) + SET MD5_HASH = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_MD5), + SHA1_HASH = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_SH1) WHERE ROWID = I.ROWID; END IF; IF VNAME <> I.NAME THEN diff --git a/user_scripts/load/change_all_privs_code.sql b/user_scripts/load/change_all_privs_code.sql old mode 100755 new mode 100644 diff --git a/user_scripts/load/fileLoad.sh b/user_scripts/load/fileLoad.sh old mode 100755 new mode 100644 index 716291a..44078f4 --- a/user_scripts/load/fileLoad.sh +++ b/user_scripts/load/fileLoad.sh @@ -39,7 +39,7 @@ LOAD INTO TABLE T_FILES_LOAD APPEND FIELDS TERMINATED BY ' ' -(file_name constant "$i",hash,path) +(file_name constant "$i", hash, path char(4000)) EOF echo $i sqlldr ${username}/hash control=${curdir}/load.ctl errors=0 discardmax=0 direct=true data=${filesdir}/${i} log=${filesdir}/${i}.log @@ -55,13 +55,13 @@ BEGIN EXECUTE IMMEDIATE 'DROP TABLE T_FILES PURGE'; EXCEPTION WHEN OTHERS THEN N CREATE TABLE T_FILES ( PATH VARCHAR2(500), - SHA256_ENC RAW(32), + SHA256_HASH RAW(32), SERIES VARCHAR2(10), ORAVERSION VARCHAR2(20), PSU NUMBER) COMPRESS NOLOGGING; -insert /*+ append */ into T_FILES (PATH, SHA256_ENC, ORAVERSION, SERIES, PSU) +insert /*+ append */ into T_FILES (PATH, SHA256_HASH, ORAVERSION, SERIES, PSU) select path, hash, substr(file_name,instr(file_name,'_',1,1)+1,instr(file_name,'_',1,2)-instr(file_name,'_',1,1)-1) oraversion, diff --git a/user_scripts/load/fileLoad.yml b/user_scripts/load/fileLoad.yml index 60f3780..6e22bd6 100644 --- a/user_scripts/load/fileLoad.yml +++ b/user_scripts/load/fileLoad.yml @@ -1,7 +1,7 @@ # Folder to store the final generated ORACLE_HOME checksum - name : Define file names set_fact: - chksum_path: "/Volumes/Samsung_T3/OraSum/files" + chksum_path: "{{ output_folder }}" chksum_folder: "binsum" - name: "Copy {{ chksum_path }}/{{ chksum_folder }} to shared location." diff --git a/user_scripts/load/insert_all_hash.sql b/user_scripts/load/insert_all_hash.sql old mode 100755 new mode 100644 index 72f5675..2aaea8c --- a/user_scripts/load/insert_all_hash.sql +++ b/user_scripts/load/insert_all_hash.sql @@ -3,20 +3,20 @@ @@insert_all_privs_clean "T_FILES" --------------------------------------------------- -alter table T_HASH modify (code null, md5_enc null,sha1_enc null); +alter table T_HASH modify (code null, md5_hash null,sha1_hash null); var v_table_cols clob var v_table_id_cols clob var v_print_cols clob def v_table_name = "T_HASH" ---exec :v_table_cols := 'owner, name, type, origin_con_id, md5_enc, sha1_enc'; -exec :v_table_cols := 'owner, name, type, sha1_enc'; +--exec :v_table_cols := 'owner, name, type, origin_con_id, md5_hash, sha1_hash'; +exec :v_table_cols := 'owner, name, type, sha1_hash'; exec :v_table_id_cols := 'owner, name, type, con_id, oraversion, hash_line_id'; -def v_hash_col_id = "sha1_enc" +def v_hash_col_id = "sha1_hash" def v_print_table = "&&v_table_name." -exec :v_print_cols := 'owner, name_comp, type, con_id, sha1_enc'; +exec :v_print_cols := 'owner, name_comp, type, con_id, sha1_hash'; def v_file_pref = 'db' def v_srczip_pref = 'db' @@ -33,12 +33,12 @@ var v_table_id_cols clob var v_print_cols clob def v_table_name = "T_FILES" -exec :v_table_cols := 'path, sha256_enc'; +exec :v_table_cols := 'path, sha256_hash'; exec :v_table_id_cols := 'path, con_id, oraversion, hash_line_id'; -def v_hash_col_id = "sha256_enc" +def v_hash_col_id = "sha256_hash" def v_print_table = "&&v_table_name." -exec :v_print_cols := 'path, con_id, sha256_enc'; +exec :v_print_cols := 'path, con_id, sha256_hash'; def v_file_pref = 'files' def v_srczip_pref = 'files.all' diff --git a/user_scripts/load/insert_all_privs.sql b/user_scripts/load/insert_all_privs.sql old mode 100755 new mode 100644 diff --git a/user_scripts/load/insert_all_privs_clean.sql b/user_scripts/load/insert_all_privs_clean.sql old mode 100755 new mode 100644 diff --git a/user_scripts/load/insert_all_privs_code.sql b/user_scripts/load/insert_all_privs_code.sql old mode 100755 new mode 100644 index a717ad4..6041137 --- a/user_scripts/load/insert_all_privs_code.sql +++ b/user_scripts/load/insert_all_privs_code.sql @@ -277,7 +277,7 @@ and not exists (select 1 commit; -- Analisar isso: oracle/net/ano/a em t_hash ou o output da query: --- select * from t_hash_final t1, t_hash_final t2 where t1.hash_line_id=t2.hash_line_id and t1.series <> 'OJVM' and t2.series='OJVM' and t1.sha1_enc=t2.sha1_enc and t1.flag='A' and t2.flag='A'; +-- select * from t_hash_final t1, t_hash_final t2 where t1.hash_line_id=t2.hash_line_id and t1.series <> 'OJVM' and t2.series='OJVM' and t1.sha1_hash=t2.sha1_hash and t1.flag='A' and t2.flag='A'; delete from &&v_table_final. a where series = 'OJVM' and PSU_FROM = (select min(c.PSU_FROM) from &&v_table_final. c where c.series = a.series and c.oraversion=a.oraversion and c.PSU_FROM>=0) diff --git a/user_scripts/load/insert_all_privs_spool.sql b/user_scripts/load/insert_all_privs_spool.sql old mode 100755 new mode 100644 diff --git a/user_scripts/odbfcl/adb_load_expdp/adb_load_expdp.yml b/user_scripts/odbfcl/adb_load_expdp/adb_load_expdp.yml new file mode 100644 index 0000000..02d18bc --- /dev/null +++ b/user_scripts/odbfcl/adb_load_expdp/adb_load_expdp.yml @@ -0,0 +1,68 @@ +# For main.yml, the pre_prepare_dump_file.yml won't be called. +# So load_file_stat_result may be false if the dump was created on this execution. +- name: "Check if {{ shared_folder }}/{{ load_file_name }} exists" + stat: + path: "{{ shared_folder }}/{{ load_file_name }}" + register: load_file_stat_result + +# This load_file_stat_result.stat.exists block is required only because this code is used +# for both the extraction (main.yml), where the file obviusly exists, but also on the +# loader_adb.yml. + +- block: + + - name: Upload expdp to OCI Bucket + include_role: + name: oci_object_storage_object + vars: + oci_upload_bucket: "{{ oci_adb_bucket }}" + oci_object_name: "{{ oci_upload_file | basename }}" + oci_upload_file: "{{ shared_folder }}/{{ load_file_name }}" + object_action: "create" + + # This is done because expdp/impdp still can't handle Credential using oracle native authentication (instance principal, tenancy id, etc), only swift. + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Copy file from Bucket to Oracle Directory" , + cred : "{{ oci_adb_main_tns }}" , + file : "adb_oradir_copy_file.sql" , + folder : "user_scripts/odbfcl/adb_load_expdp" , + params : "'{{ oci_adb_credential }}' '{{ oci_adb_os_url_prefix }}/{{ load_file_name }}'" + } + + - name: Remove expdp from OCI Bucket + include_role: + name: oci_object_storage_object + vars: + oci_upload_bucket: "{{ oci_adb_bucket }}" + oci_object_name: "{{ load_file_name }}" + object_action: "remove" + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Call import process" , + cred : "{{ oci_adb_main_tns }}" , + file : "adb_process_dp_dump.sql" , + folder : "user_scripts/odbfcl/adb_load_expdp" , + params : "'{{ db_version }}' '{{ patch.base_ru | default('') }}{{ patch.type }}' '{{ patch.id }}' '{{ load_file_name }}'" + } + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Remove dumpfile from Oracle Directory" , + cred : "{{ oci_adb_main_tns }}" , + file : "adb_oradir_remove_file.sql" , + folder : "user_scripts/odbfcl/adb_load_expdp" , + params : "'{{ load_file_name }}'" + } + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Remove logfile from Oracle Directory" , + cred : "{{ oci_adb_main_tns }}" , + file : "adb_oradir_remove_file.sql" , + folder : "user_scripts/odbfcl/adb_load_expdp" , + params : "'{{ dump_file_prefix }}.log'" + } + + when: load_file_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts/odbfcl/adb_load_expdp/adb_oradir_copy_file.sql b/user_scripts/odbfcl/adb_load_expdp/adb_oradir_copy_file.sql new file mode 100644 index 0000000..ef629aa --- /dev/null +++ b/user_scripts/odbfcl/adb_load_expdp/adb_oradir_copy_file.sql @@ -0,0 +1,9 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +BEGIN + DBMS_CLOUD.GET_OBJECT ( + credential_name => '&1.', + object_uri => '&2.', + directory_name => 'DATA_PUMP_DIR'); +END; +/ \ No newline at end of file diff --git a/user_scripts/odbfcl/adb_load_expdp/adb_oradir_remove_file.sql b/user_scripts/odbfcl/adb_load_expdp/adb_oradir_remove_file.sql new file mode 100644 index 0000000..048bc7e --- /dev/null +++ b/user_scripts/odbfcl/adb_load_expdp/adb_oradir_remove_file.sql @@ -0,0 +1,14 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +DECLARE + FILE_DOES_NOT_EXIST EXCEPTION; + PRAGMA EXCEPTION_INIT ( FILE_DOES_NOT_EXIST, -20019 ); +BEGIN + DBMS_CLOUD.DELETE_FILE ( + directory_name => 'ORADIFF_DIR', + file_name => '&1.'); + EXCEPTION + WHEN FILE_DOES_NOT_EXIST THEN + NULL; +END; +/ \ No newline at end of file diff --git a/user_scripts/odbfcl/adb_load_expdp/adb_process_dp_dump.sql b/user_scripts/odbfcl/adb_load_expdp/adb_process_dp_dump.sql new file mode 100644 index 0000000..5632b23 --- /dev/null +++ b/user_scripts/odbfcl/adb_load_expdp/adb_process_dp_dump.sql @@ -0,0 +1,15 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +BEGIN + PC_DUMP_LOAD.ADD_PROCESS + ( + P_ORAVERSION => '&1', + P_ORASERIES => '&2', + P_ORAPATCH => &3, + P_FILE_NAME => '&4', + P_EXECUTE => TRUE + ); + -- Pause refresh for the next hours. + PC_REFRESH_MVS.QUICK_PAUSE; +END; +/ diff --git a/user_scripts/odbfcl/adb_load_expdp/check_dump_file_loaded.yml b/user_scripts/odbfcl/adb_load_expdp/check_dump_file_loaded.yml new file mode 100644 index 0000000..6271a51 --- /dev/null +++ b/user_scripts/odbfcl/adb_load_expdp/check_dump_file_loaded.yml @@ -0,0 +1,8 @@ +- name : Define check filename + set_fact: + loaded_file_prefix: "tables_{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}_loaded_{{ oci_adb_tns }}" + +- name: "Check if {{ output_folder }}/expdp/{{ loaded_file_prefix }} exists" + stat: + path: "{{ output_folder }}/expdp/{{ loaded_file_prefix }}" + register: loaded_stat_result \ No newline at end of file diff --git a/user_scripts/odbfcl/adb_load_expdp/mark_dump_file_loaded.yml b/user_scripts/odbfcl/adb_load_expdp/mark_dump_file_loaded.yml new file mode 100644 index 0000000..cb52e93 --- /dev/null +++ b/user_scripts/odbfcl/adb_load_expdp/mark_dump_file_loaded.yml @@ -0,0 +1,8 @@ +- name : Define check filename + set_fact: + loaded_file_prefix: "tables_{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}_loaded_{{ oci_adb_tns }}" + +- name: "Create {{ output_folder }}/expdp/{{ loaded_file_prefix }}." + shell: | + set -eo pipefail + touch {{ output_folder }}/expdp/{{ loaded_file_prefix }} diff --git a/user_scripts/odbfcl/adb_load_expdp/post_remove_dump_file.yml b/user_scripts/odbfcl/adb_load_expdp/post_remove_dump_file.yml new file mode 100644 index 0000000..9a02cee --- /dev/null +++ b/user_scripts/odbfcl/adb_load_expdp/post_remove_dump_file.yml @@ -0,0 +1,5 @@ +- name : "Remove file {{ load_file_name }} from shared folder" + file: + state: absent + path: "{{ shared_folder }}/{{ load_file_name }}" + when: load_file_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts/odbfcl/adb_load_expdp/pre_prepare_dump_file.yml b/user_scripts/odbfcl/adb_load_expdp/pre_prepare_dump_file.yml new file mode 100644 index 0000000..ea0b6c1 --- /dev/null +++ b/user_scripts/odbfcl/adb_load_expdp/pre_prepare_dump_file.yml @@ -0,0 +1,25 @@ +- name : Define expdp filename + set_fact: + file_suffix: "{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}" + dump_file_prefix: "tables_{{ db_version }}_{{ patch.base_ru | default('') }}{{ patch.type }}_{{ patch.id }}" + +- name: Set DMP load file name + set_fact: + load_file_name: "{{ dump_file_prefix }}.dmp" + when: not (patch.upload_only | default(false)) + +- name: Set ZIP load file name + set_fact: + load_file_name: "{{ dump_file_prefix }}.zip" + when: (patch.upload_only | default(false)) + +- name: "Check if {{ output_folder }}/expdp/{{ load_file_name }} exists" + stat: + path: "{{ output_folder }}/expdp/{{ load_file_name }}" + register: load_file_stat_result + +- name: "Copy {{ load_file_name }} to shared_folder" + copy: + src: "{{ output_folder }}/expdp/{{ load_file_name }}" + dest: "{{ shared_folder }}" + when: load_file_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts/odbfcl/def_adb_variables.yml b/user_scripts/odbfcl/def_adb_variables.yml new file mode 100644 index 0000000..4fe7c5a --- /dev/null +++ b/user_scripts/odbfcl/def_adb_variables.yml @@ -0,0 +1,29 @@ +- name: Define oci_adb_main_tns + set_fact: + oci_adb_main_tns: "{{ oci_adb_user }}/{{ oci_adb_pass }}@{{ oci_adb_tns }}" + when: oci_adb_use_wallet == false + +- name: Define oci_adb_main_tns + set_fact: + oci_adb_main_tns: "/@{{ oci_adb_user }}" + when: oci_adb_use_wallet == true + +# - name: Generate oci_adb_transient_user +# set_fact: +# oci_adb_transient_user: "{{ oci_adb_user }}_{{ db_version | replace('.', '') }}" +# when: oci_adb_force_transient_user is undefined or (oci_adb_force_transient_user|length == 0) + +# - name: Force oci_adb_transient_user +# set_fact: +# oci_adb_transient_user: "{{ oci_adb_force_transient_user }}" +# when: not (oci_adb_force_transient_user is undefined or (oci_adb_force_transient_user|length == 0)) + +# - name: Define oci_adb_connection_tns +# set_fact: +# oci_adb_connection_tns: "{{ oci_adb_transient_user }}/{{ oci_adb_pass }}@{{ oci_adb_tns }}" +# when: oci_adb_use_wallet == false + +# - name: Define oci_adb_connection_tns +# set_fact: +# oci_adb_connection_tns: "/@{{ oci_adb_transient_user }}" +# when: oci_adb_use_wallet == true diff --git a/user_scripts/odbfcl/diff_calculate/diff_calculate.sql b/user_scripts/odbfcl/diff_calculate/diff_calculate.sql new file mode 100644 index 0000000..a2dee8a --- /dev/null +++ b/user_scripts/odbfcl/diff_calculate/diff_calculate.sql @@ -0,0 +1,299 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +DEF V_CONN = '&1' +DEF V_ORAVERSION_FROM = '&2' +DEF V_ORASERIES_FROM = '&3' +DEF V_ORAPATCH_FROM = '&4' +DEF V_ORAVERSION_TO = '&5' +DEF V_ORASERIES_TO = '&6' +DEF V_ORAPATCH_TO = '&7' +DEF V_BRELEASE = '&8' + +DEF V_TABLE_NAME_CODES = 'DIFF_CODES_LOAD_&&V_BRELEASE.' +DEF V_TABLE_NAME_CONTENTS = 'DIFF_CONTENTS_LOAD_&&V_BRELEASE.' + +SET TERMOUT OFF ECHO OFF + +set define '^' +SPO get_code.sql +PRO set pages 0 +PRO set long 1000000 +PRO set lines 10000 +PRO set trims on +PRO set feed off +PRO set echo off +PRO set verify off +PRO set define '&' +PRO col code for a10000 +PRO set termout off +PRO spool &1..sql +PRO select code from dm_codes where md5_hash='&1';; +PRO spool off +SPO OFF +set define '&' + +set define '^' +SPO get_contents.sql +PRO set pages 0 +PRO set long 1000000 +PRO set lines 10000 +PRO set trims on +PRO set feed off +PRO set echo off +PRO set verify off +PRO set define '&' +PRO col code for a10000 +PRO set termout off +PRO spool &1..sql +PRO select contents from dm_contents where md5_hash='&1';; +PRO spool off +SPO OFF +set define '&' + +SPO gen_diff.sh +PRO set -e +PRO v_file_1="$1" +PRO v_file_2="$2" +PRO +PRO v_size=$(diff -t -bB "${v_file_1}.sql" "${v_file_2}.sql" | awk '{ print length }' | sort -n | tail -1) +PRO +PRO # -2 to remove '> ' or '< ' +PRO # +3 to include ' | ' +PRO if [ -z ${v_size} ] +PRO then +PRO touch "${v_file_1}_${v_file_2}.txt" +PRO exit 0 +PRO fi +PRO v_size=$(((v_size-2)*2+3)) +PRO +PRO sdiff -w ${v_size} -bB -t -l "${v_file_1}.sql" "${v_file_2}.sql" | cat -n | grep -v -e '($' > "${v_file_1}_${v_file_2}.txt" +SPO OFF + +SPO load_codes.sh +PRO set -e +PRO +PRO v_outpref="./list" +PRO v_file="${v_outpref}.csv" +PRO +PRO if ! ls *_*.txt >/dev/null 2>/dev/null +PRO then +PRO echo "No file to process." +PRO exit 0 +PRO fi +PRO +PRO ls -1 *_*.txt > "${v_file}" +PRO +PRO cat << EOF > "${v_outpref}_load.ctl" +PRO LOAD +PRO INTO TABLE &&V_TABLE_NAME_CODES. +PRO APPEND +PRO FIELDS TERMINATED BY ',' +PRO (file_name, +PRO contents lobfile(file_name) terminated by eof) +PRO EOF +PRO +PRO sqlldr &V_CONN \ +PRO control="${v_outpref}_load.ctl" \ +PRO errors=0 \ +PRO discardmax=0 \ +PRO direct=Y \ +PRO data="${v_file}" \ +PRO log="${v_outpref}_load.log" +PRO +PRO rm -f "${v_outpref}_load.log" "${v_outpref}_load.ctl" "${v_file}" +SPO OFF + +SPO load_contents.sh +PRO set -e +PRO +PRO v_outpref="./list" +PRO v_file="${v_outpref}.csv" +PRO +PRO if ! ls *_*.txt >/dev/null 2>/dev/null +PRO then +PRO echo "No file to process." +PRO exit 0 +PRO fi +PRO +PRO ls -1 *_*.txt > "${v_file}" +PRO +PRO cat << EOF > "${v_outpref}_load.ctl" +PRO LOAD +PRO INTO TABLE &&V_TABLE_NAME_CONTENTS. +PRO APPEND +PRO FIELDS TERMINATED BY ',' +PRO (file_name, +PRO contents lobfile(file_name) terminated by eof) +PRO EOF +PRO +PRO sqlldr &V_CONN \ +PRO control="${v_outpref}_load.ctl" \ +PRO errors=0 \ +PRO discardmax=0 \ +PRO direct=Y \ +PRO data="${v_file}" \ +PRO log="${v_outpref}_load.log" +PRO +PRO rm -f "${v_outpref}_load.log" "${v_outpref}_load.ctl" "${v_file}" +SPO OFF + +-------------------------- +-------- PREPARE --------- +-------------------------- + +! rm -f *_*.txt + +-------------------------- +------- LOAD CODES ------- +-------------------------- + +ROLLBACK; +EXEC R_HASH.L('&&V_ORAVERSION_FROM.','&&V_ORASERIES_FROM.',&&V_ORAPATCH_FROM.,'&&V_ORAVERSION_TO.','&&V_ORASERIES_TO.',&&V_ORAPATCH_TO.); + +set serverout on lines 10000 trims on verify off feed off +SPOOL aaa.sql +BEGIN + FOR I IN (SELECT NVL(D1.MD5_HASH_UNWRAPPED,D1.MD5_HASH) OLD_VALUE, + NVL(D2.MD5_HASH_UNWRAPPED,D2.MD5_HASH) NEW_VALUE + FROM R_HASH.F('&&V_ORAVERSION_TO.','&&V_ORASERIES_TO.',&&V_ORAPATCH_TO.) D0, DM_CODES D1, DM_CODES D2 + WHERE D0.COMPARE_COLUMN_NAME='MD5_HASH' + AND D1.MD5_HASH = D0.OLD_VALUE + AND D2.MD5_HASH = D0.NEW_VALUE + MINUS + SELECT MD5_HASH_FROM, MD5_HASH_TO + FROM DIFF_CODES) + LOOP + DBMS_OUTPUT.PUT_LINE('@get_code.sql ' || I.OLD_VALUE); + DBMS_OUTPUT.PUT_LINE('@get_code.sql ' || I.NEW_VALUE); + DBMS_OUTPUT.PUT_LINE('! sh gen_diff.sh ' || I.OLD_VALUE || ' ' || I.NEW_VALUE); + DBMS_OUTPUT.PUT_LINE('! rm -f ' || I.OLD_VALUE || '.sql ' || I.NEW_VALUE || '.sql'); + DBMS_OUTPUT.PUT_LINE('! echo Processing ' || I.OLD_VALUE || '_' || I.NEW_VALUE); + END LOOP; +END; +/ +SPOOL OFF + +@aaa.sql + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE &&V_TABLE_NAME_CODES. PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE &&V_TABLE_NAME_CODES. +( + FILE_NAME VARCHAR2(100) NOT NULL, + CONTENTS CLOB NOT NULL +) +COMPRESS NOLOGGING; + +! sh load_codes.sh + +SET TERMOUT ON ECHO ON + +INSERT /*+ APPEND */ + INTO DIFF_CODES (MD5_HASH_FROM, MD5_HASH_TO, DIFF_CODE) +SELECT T1.HASH_FROM, + T1.HASH_TO, + T1.CONTENTS +FROM ( SELECT SUBSTR(FILE_NAME,1,INSTR(FILE_NAME,'_',1,1)-1) HASH_FROM, + SUBSTR(FILE_NAME,INSTR(FILE_NAME,'_',1,1)+1,INSTR(FILE_NAME,'.',1,1)-INSTR(FILE_NAME,'_',1,1)-1) HASH_TO, + CONTENTS + FROM &&V_TABLE_NAME_CODES. ) T1 +-- We need this as some other sessions in parallel can end up inserting the same row. +WHERE NOT EXISTS (SELECT 1 + FROM DIFF_CODES D + WHERE D.MD5_HASH_FROM = T1.HASH_FROM AND D.MD5_HASH_TO = T1.HASH_TO); + +COMMIT; + +DROP TABLE &&V_TABLE_NAME_CODES. PURGE; + +SET TERMOUT OFF ECHO OFF + +! rm -f *_*.txt +! rm -f load_codes.sh +! rm -f get_code.sql + +----------------------------- +------- LOAD CONTENTS ------- +----------------------------- + +ROLLBACK; +EXEC R_TXTCOLLECTION.L('&&V_ORAVERSION_FROM.','&&V_ORASERIES_FROM.',&&V_ORAPATCH_FROM.,'&&V_ORAVERSION_TO.','&&V_ORASERIES_TO.',&&V_ORAPATCH_TO.); + +set serverout on lines 10000 trims on verify off feed off +SPOOL aaa.sql +BEGIN + FOR I IN (SELECT HEXTORAW(D0.OLD_VALUE) OLD_VALUE, + HEXTORAW(D0.NEW_VALUE) NEW_VALUE + FROM R_TXTCOLLECTION.F('&&V_ORAVERSION_TO.','&&V_ORASERIES_TO.',&&V_ORAPATCH_TO.) D0 + WHERE D0.COMPARE_COLUMN_NAME='MD5_HASH' + MINUS + SELECT MD5_HASH_FROM, MD5_HASH_TO + FROM DIFF_CONTENTS) + LOOP + DBMS_OUTPUT.PUT_LINE('@get_contents.sql ' || I.OLD_VALUE); + DBMS_OUTPUT.PUT_LINE('@get_contents.sql ' || I.NEW_VALUE); + DBMS_OUTPUT.PUT_LINE('! sh gen_diff.sh ' || I.OLD_VALUE || ' ' || I.NEW_VALUE); + DBMS_OUTPUT.PUT_LINE('! rm -f ' || I.OLD_VALUE || '.sql ' || I.NEW_VALUE || '.sql'); + DBMS_OUTPUT.PUT_LINE('! echo Processing ' || I.OLD_VALUE || '_' || I.NEW_VALUE); + END LOOP; +END; +/ +SPOOL OFF + +@aaa.sql + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE &&V_TABLE_NAME_CONTENTS. PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE &&V_TABLE_NAME_CONTENTS. +( + FILE_NAME VARCHAR2(100) NOT NULL, + CONTENTS CLOB NOT NULL +) +COMPRESS NOLOGGING; + +! sh load_contents.sh + +SET TERMOUT ON ECHO ON + +INSERT /*+ APPEND */ + INTO DIFF_CONTENTS (MD5_HASH_FROM, MD5_HASH_TO, DIFF_CODE) +SELECT T1.HASH_FROM, + T1.HASH_TO, + T1.CONTENTS +FROM ( SELECT SUBSTR(FILE_NAME,1,INSTR(FILE_NAME,'_',1,1)-1) HASH_FROM, + SUBSTR(FILE_NAME,INSTR(FILE_NAME,'_',1,1)+1,INSTR(FILE_NAME,'.',1,1)-INSTR(FILE_NAME,'_',1,1)-1) HASH_TO, + CONTENTS + FROM &&V_TABLE_NAME_CONTENTS. ) T1 +-- We need this as some other sessions in parallel can end up inserting the same row. +WHERE NOT EXISTS (SELECT 1 + FROM DIFF_CONTENTS D + WHERE D.MD5_HASH_FROM = T1.HASH_FROM AND D.MD5_HASH_TO = T1.HASH_TO); + +COMMIT; + +DROP TABLE &&V_TABLE_NAME_CONTENTS. PURGE; + +SET TERMOUT OFF ECHO OFF + +! rm -f *_*.txt +! rm -f load_contents.sh +! rm -f get_contents.sql + +! rm -f gen_diff.sh +! rm -f aaa.sql \ No newline at end of file diff --git a/user_scripts/odbfcl/diff_calculate/diff_calculate.yml b/user_scripts/odbfcl/diff_calculate/diff_calculate.yml new file mode 100644 index 0000000..a422b9f --- /dev/null +++ b/user_scripts/odbfcl/diff_calculate/diff_calculate.yml @@ -0,0 +1,24 @@ +# This must come after MV_VERSIONS is reloaded + +- name: "Load {{ db_version_short }}_{{ oci_adb_db_id }} diff code and contents" + shell: | + set -e + v_folder="{{ stage_folder }}/temp_diff_{{ db_version_short }}_{{ oci_adb_db_id }}" + rm -rf "${v_folder}" + mkdir "${v_folder}" + cd "${v_folder}" + sqlplus -L -S {{ oci_adb_main_tns }} @{{ shared_folder }}/user_scripts/odbfcl/diff_calculate/diff_main.sql '{{ oci_adb_main_tns }}' '@{{ shared_folder }}/user_scripts/odbfcl/diff_calculate' {{ db_version }} {{ patch.base_ru | default('') }}{{ patch.type }} {{ patch.id }} + rm -rf "${v_folder}" + register: sqloutput + +#- include: tasks/local_sqlplus.yml +# vars: +# sql_param : { task_action : "Load {{ oci_adb_transient_user }} diff code and contents" , +# cred : "{{ oci_adb_user }}/{{ oci_adb_pass }}@{{ oci_adb_tns }}" , +# file : "diff_main.sql" , +# folder : "user_scripts/odbfcl/diff_calculate" , +# params : "'{{ oci_adb_user }}/{{ oci_adb_pass }}@{{ oci_adb_tns }}' {{ db_version }} {{ patch.base_ru | default('') }}{{ patch.type }} {{ patch.id }}" +# } + +- name: SQL Output + debug: msg="{{ sqloutput.stdout_lines }}" \ No newline at end of file diff --git a/user_scripts/odbfcl/diff_calculate/diff_calculate_all.sql b/user_scripts/odbfcl/diff_calculate/diff_calculate_all.sql new file mode 100644 index 0000000..2d20044 --- /dev/null +++ b/user_scripts/odbfcl/diff_calculate/diff_calculate_all.sql @@ -0,0 +1,373 @@ +-- Run diff generation process for ALL every database. +WHENEVER SQLERROR EXIT SQL.SQLCODE + +DEF V_CONN = '&1' +DEF V_BRELEASE = '&2' + +DEF V_TABLE_NAME_CODES = 'DIFF_CODES_LOAD_&&V_BRELEASE.' +DEF V_TABLE_NAME_CONTENTS = 'DIFF_CONTENTS_LOAD_&&V_BRELEASE.' + +SET TERMOUT OFF ECHO OFF + +set define '^' +SPO get_code.sql +PRO set pages 0 +PRO set long 1000000 +PRO set lines 10000 +PRO set trims on +PRO set feed off +PRO set echo off +PRO set verify off +PRO set define '&' +PRO col code for a10000 +PRO set termout off +PRO spool &1..sql +PRO select code from dm_codes where md5_hash='&1';; +PRO spool off +SPO OFF +set define '&' + +set define '^' +SPO get_contents.sql +PRO set pages 0 +PRO set long 1000000 +PRO set lines 10000 +PRO set trims on +PRO set feed off +PRO set echo off +PRO set verify off +PRO set define '&' +PRO col code for a10000 +PRO set termout off +PRO spool &1..sql +PRO select contents from dm_contents where md5_hash='&1';; +PRO spool off +SPO OFF +set define '&' + +SPO gen_diff.sh +PRO set -e +PRO v_type="$1" +PRO v_file_1="$2" +PRO v_file_2="$3" +PRO +PRO v_size=$(diff -t -bB "${v_file_1}.sql" "${v_file_2}.sql" | awk '{ print length }' | sort -n | tail -1) +PRO +PRO # -2 to remove '> ' or '< ' +PRO # +3 to include ' | ' +PRO if [ -z ${v_size} ] +PRO then +PRO touch "${v_file_1}_${v_file_2}.${v_type}.txt" +PRO exit 0 +PRO fi +PRO v_size=$(((v_size-2)*2+3)) +PRO +PRO sdiff -w ${v_size} -bB -t -l "${v_file_1}.sql" "${v_file_2}.sql" | cat -n | grep -v -e '($' > "${v_file_1}_${v_file_2}.${v_type}.txt" +SPO OFF + +SPO gen_sql.sh +PRO set -e +PRO v_file="$1" +PRO v_output="$2" +PRO +PRO cat "${v_file}" | sort -u > "${v_file}.new" +PRO mv "${v_file}.new" "${v_file}" +PRO +PRO rm -f "${v_output}" +PRO touch "${v_output}" +PRO +PRO v_counter=1 +PRO v_total=$(cat "${v_file}" | wc -l) +PRO v_entries=$(cat "${v_file}") +PRO +PRO OIFS="$IFS"; IFS=$'\n' +PRO for v_line in $v_entries +PRO do +PRO IFS="$OIFS" +PRO v_hash_1=$(cut -d: -f 1 <<< "${v_line}") +PRO v_hash_2=$(cut -d: -f 2 <<< "${v_line}") +PRO v_type=$(cut -d: -f 3 <<< "${v_line}") +PRO echo "! echo Processing ${v_counter}/${v_total}: ${v_hash_1}_${v_hash_2}" >> "${v_output}" +PRO if [ "${v_type}" = "codes" ] +PRO then +PRO echo "@get_code.sql ${v_hash_1}" >> "${v_output}" +PRO echo "@get_code.sql ${v_hash_2}" >> "${v_output}" +PRO elif [ "${v_type}" = "contents" ] +PRO then +PRO echo "@get_contents.sql ${v_hash_1}" >> "${v_output}" +PRO echo "@get_contents.sql ${v_hash_2}" >> "${v_output}" +PRO fi +PRO echo "! sh gen_diff.sh ${v_type} ${v_hash_1} ${v_hash_2}" >> "${v_output}" +PRO echo "! rm -f ${v_hash_1}.sql ${v_hash_2}.sql" >> "${v_output}" +PRO ((v_counter++)) +PRO done +SPO OFF + +SPO load_codes.sh +PRO set -e +PRO +PRO v_outpref="./list" +PRO v_file="${v_outpref}.csv" +PRO +PRO if ! ls *_*.codes.txt >/dev/null 2>/dev/null +PRO then +PRO echo "Codes: no file to process." +PRO exit 0 +PRO fi +PRO +PRO ls -1 *_*.codes.txt > "${v_file}" +PRO +PRO cat << EOF > "${v_outpref}_load.ctl" +PRO LOAD +PRO INTO TABLE &&V_TABLE_NAME_CODES. +PRO APPEND +PRO FIELDS TERMINATED BY ',' +PRO (file_name, +PRO contents lobfile(file_name) terminated by eof) +PRO EOF +PRO +PRO sqlldr &V_CONN \ +PRO control="${v_outpref}_load.ctl" \ +PRO errors=0 \ +PRO discardmax=0 \ +PRO direct=Y \ +PRO data="${v_file}" \ +PRO log="${v_outpref}_load.log" +PRO +PRO rm -f "${v_outpref}_load.log" "${v_outpref}_load.ctl" "${v_file}" +SPO OFF + +SPO load_contents.sh +PRO set -e +PRO +PRO v_outpref="./list" +PRO v_file="${v_outpref}.csv" +PRO +PRO if ! ls *_*.contents.txt >/dev/null 2>/dev/null +PRO then +PRO echo "Contents: no file to process." +PRO exit 0 +PRO fi +PRO +PRO ls -1 *_*.contents.txt > "${v_file}" +PRO +PRO cat << EOF > "${v_outpref}_load.ctl" +PRO LOAD +PRO INTO TABLE &&V_TABLE_NAME_CONTENTS. +PRO APPEND +PRO FIELDS TERMINATED BY ',' +PRO (file_name, +PRO contents lobfile(file_name) terminated by eof) +PRO EOF +PRO +PRO sqlldr &V_CONN \ +PRO control="${v_outpref}_load.ctl" \ +PRO errors=0 \ +PRO discardmax=0 \ +PRO direct=Y \ +PRO data="${v_file}" \ +PRO log="${v_outpref}_load.log" +PRO +PRO rm -f "${v_outpref}_load.log" "${v_outpref}_load.ctl" "${v_file}" +SPO OFF + +-------------------------- +-------- PREPARE --------- +-------------------------- + +! rm -f *_*.txt + +------------------------------------- +------- LOAD CODES & CONTENTS ------- +------------------------------------- + +set serverout on lines 10000 trims on verify off feed off +SPOOL hash.txt + +DECLARE + CURSOR V_VERS IS + with versions as (select /*+ materialize */ * from mv_versions) + select d.oraversion ORAVERSION_D, + d.oraseries ORASERIES_D, + d.orapatch ORAPATCH_D, + d.loaded_on loaded_on, + v2.oraversion ORAVERSION_FROM, + v2.oraseries ORASERIES_FROM, + v2.orapatch ORAPATCH_FROM, + v1.oraversion ORAVERSION_TO, + v1.oraseries ORASERIES_TO, + v1.orapatch ORAPATCH_TO + from versions v1, versions v2, d_patch_ready d -- driver table + where v1.display_name_prev=v2.display_name + and d.diff_generated is null + and ((v1.oraversion=d.oraversion and v1.oraseries=d.oraseries and v1.orapatch=d.orapatch) + or (v2.oraversion=d.oraversion and v2.oraseries=d.oraseries and v2.orapatch=d.orapatch)); + CURSOR V_DIFF_CODES (P_ORAVERSION_TO IN varchar2, P_ORASERIES_TO IN varchar2, P_ORAPATCH_TO IN NUMBER) IS + SELECT NVL(D1.MD5_HASH_UNWRAPPED,D1.MD5_HASH) OLD_VALUE, + NVL(D2.MD5_HASH_UNWRAPPED,D2.MD5_HASH) NEW_VALUE + FROM R_HASH.F(P_ORAVERSION_TO,P_ORASERIES_TO,P_ORAPATCH_TO) D0, DM_CODES D1, DM_CODES D2 + WHERE D0.COMPARE_COLUMN_NAME='MD5_HASH' + AND D1.MD5_HASH = D0.OLD_VALUE + AND D2.MD5_HASH = D0.NEW_VALUE + AND NOT (D1.WRAPPED = 'Y' AND D1.MD5_HASH_UNWRAPPED IS NULL) + AND NOT (D2.WRAPPED = 'Y' AND D2.MD5_HASH_UNWRAPPED IS NULL) + MINUS + SELECT MD5_HASH_FROM, MD5_HASH_TO + FROM DIFF_CODES; + CURSOR V_DIFF_CONTENTS (P_ORAVERSION_TO IN varchar2, P_ORASERIES_TO IN varchar2, P_ORAPATCH_TO IN NUMBER) IS + SELECT HEXTORAW(D0.OLD_VALUE) OLD_VALUE, + HEXTORAW(D0.NEW_VALUE) NEW_VALUE + FROM R_TXTCOLLECTION.F(P_ORAVERSION_TO, P_ORASERIES_TO, P_ORAPATCH_TO) D0 + WHERE D0.COMPARE_COLUMN_NAME='MD5_HASH' + MINUS + SELECT MD5_HASH_FROM, MD5_HASH_TO + FROM DIFF_CONTENTS; + V_FOUND BOOLEAN; +BEGIN + FOR V IN V_VERS + LOOP + V_FOUND := FALSE; + -- CODES + ROLLBACK; + R_HASH.L(V.ORAVERSION_FROM, V.ORASERIES_FROM, V.ORAPATCH_FROM, V.ORAVERSION_TO, V.ORASERIES_TO, V.ORAPATCH_TO); + FOR I IN V_DIFF_CODES (V.ORAVERSION_TO, V.ORASERIES_TO, V.ORAPATCH_TO) + LOOP + DBMS_OUTPUT.PUT_LINE(I.OLD_VALUE || ':' || I.NEW_VALUE || ':codes'); + V_FOUND := TRUE; + END LOOP; + -- CONTENTS + ROLLBACK; + R_TXTCOLLECTION.L(V.ORAVERSION_FROM, V.ORASERIES_FROM, V.ORAPATCH_FROM, V.ORAVERSION_TO, V.ORASERIES_TO, V.ORAPATCH_TO); + FOR I IN V_DIFF_CONTENTS (V.ORAVERSION_TO, V.ORASERIES_TO, V.ORAPATCH_TO) + LOOP + DBMS_OUTPUT.PUT_LINE(I.OLD_VALUE || ':' || I.NEW_VALUE || ':contents'); + V_FOUND := TRUE; + END LOOP; + ROLLBACK; + -- When there is nothing to generate, update the DIFF_GENERATED column so next execution will not query it again. + IF NOT V_FOUND + THEN + UPDATE D_PATCH_READY + SET DIFF_GENERATED=SYSTIMESTAMP + WHERE DIFF_GENERATED IS NULL + AND ORAVERSION=V.ORAVERSION_D + AND ORASERIES=V.ORASERIES_D + AND ORAPATCH=V.ORAPATCH_D + AND LOADED_ON=V.LOADED_ON; + COMMIT; + END IF; + END LOOP; +END; +/ +SPOOL OFF + +! sh gen_sql.sh hash.txt run.sql + +@run.sql + +-------------------------- +------- LOAD CODES ------- +-------------------------- + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE &&V_TABLE_NAME_CODES. PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE &&V_TABLE_NAME_CODES. +( + FILE_NAME VARCHAR2(100) NOT NULL, + CONTENTS CLOB NOT NULL +) +COMPRESS NOLOGGING; + +! sh load_codes.sh + +SET TERMOUT ON ECHO ON + +INSERT /*+ APPEND */ + INTO DIFF_CODES (MD5_HASH_FROM, MD5_HASH_TO, DIFF_CODE) +SELECT T1.HASH_FROM, + T1.HASH_TO, + T1.CONTENTS +FROM ( SELECT SUBSTR(FILE_NAME,1,INSTR(FILE_NAME,'_',1,1)-1) HASH_FROM, + SUBSTR(FILE_NAME,INSTR(FILE_NAME,'_',1,1)+1,INSTR(FILE_NAME,'.',1,1)-INSTR(FILE_NAME,'_',1,1)-1) HASH_TO, + CONTENTS + FROM &&V_TABLE_NAME_CODES. ) T1 +-- We need this as some other sessions in parallel can end up inserting the same row. +WHERE NOT EXISTS (SELECT 1 + FROM DIFF_CODES D + WHERE D.MD5_HASH_FROM = T1.HASH_FROM AND D.MD5_HASH_TO = T1.HASH_TO); + +COMMIT; + +DROP TABLE &&V_TABLE_NAME_CODES. PURGE; + +SET TERMOUT OFF ECHO OFF + +! rm -f *_*.codes.txt +! rm -f load_codes.sh +! rm -f get_code.sql + +----------------------------- +------- LOAD CONTENTS ------- +----------------------------- + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE &&V_TABLE_NAME_CONTENTS. PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE &&V_TABLE_NAME_CONTENTS. +( + FILE_NAME VARCHAR2(100) NOT NULL, + CONTENTS CLOB NOT NULL +) +COMPRESS NOLOGGING; + +! sh load_contents.sh + +SET TERMOUT ON ECHO ON + +INSERT /*+ APPEND */ + INTO DIFF_CONTENTS (MD5_HASH_FROM, MD5_HASH_TO, DIFF_CODE) +SELECT T1.HASH_FROM, + T1.HASH_TO, + T1.CONTENTS +FROM ( SELECT SUBSTR(FILE_NAME,1,INSTR(FILE_NAME,'_',1,1)-1) HASH_FROM, + SUBSTR(FILE_NAME,INSTR(FILE_NAME,'_',1,1)+1,INSTR(FILE_NAME,'.',1,1)-INSTR(FILE_NAME,'_',1,1)-1) HASH_TO, + CONTENTS + FROM &&V_TABLE_NAME_CONTENTS. ) T1 +-- We need this as some other sessions in parallel can end up inserting the same row. +WHERE NOT EXISTS (SELECT 1 + FROM DIFF_CONTENTS D + WHERE D.MD5_HASH_FROM = T1.HASH_FROM AND D.MD5_HASH_TO = T1.HASH_TO); + +COMMIT; + +DROP TABLE &&V_TABLE_NAME_CONTENTS. PURGE; + +SET TERMOUT OFF ECHO OFF + +! rm -f *_*.contents.txt +! rm -f load_contents.sh +! rm -f get_contents.sql + +---------------------- +------- FINISH ------- +---------------------- + +! rm -f gen_diff.sh +! rm -f gen_sql.sh +! rm -f run.sql +! rm -f hash.txt \ No newline at end of file diff --git a/user_scripts/odbfcl/diff_calculate/diff_main.sql b/user_scripts/odbfcl/diff_calculate/diff_main.sql new file mode 100644 index 0000000..ca6ad37 --- /dev/null +++ b/user_scripts/odbfcl/diff_calculate/diff_main.sql @@ -0,0 +1,69 @@ +WHENEVER SQLERROR CONTINUE + +CREATE TABLE "DIFF_CODES" +( + "MD5_HASH_FROM" RAW(16) NOT NULL, + "MD5_HASH_TO" RAW(16) NOT NULL, + "DIFF_CODE" CLOB NOT NULL, + CONSTRAINT DIFF_CODES_PK PRIMARY KEY ("MD5_HASH_FROM", "MD5_HASH_TO"), + CONSTRAINT DIFF_CODES_F1 FOREIGN KEY ("MD5_HASH_FROM") REFERENCES DM_CODES ("MD5_HASH") ON DELETE CASCADE, + CONSTRAINT DIFF_CODES_F2 FOREIGN KEY ("MD5_HASH_TO") REFERENCES DM_CODES ("MD5_HASH") ON DELETE CASCADE +) +COMPRESS NOLOGGING; + +CREATE INDEX "DIFF_CODES_F1" ON "DIFF_CODES" ("MD5_HASH_FROM"); +CREATE INDEX "DIFF_CODES_F2" ON "DIFF_CODES" ("MD5_HASH_TO"); + +CREATE TABLE "DIFF_CONTENTS" +( + "MD5_HASH_FROM" RAW(16) NOT NULL, + "MD5_HASH_TO" RAW(16) NOT NULL, + "DIFF_CODE" CLOB NOT NULL, + CONSTRAINT DIFF_CONTENTS_PK PRIMARY KEY ("MD5_HASH_FROM", "MD5_HASH_TO"), + CONSTRAINT DIFF_CONTENTS_F1 FOREIGN KEY ("MD5_HASH_FROM") REFERENCES DM_CONTENTS ("MD5_HASH") ON DELETE CASCADE, + CONSTRAINT DIFF_CONTENTS_F2 FOREIGN KEY ("MD5_HASH_TO") REFERENCES DM_CONTENTS ("MD5_HASH") ON DELETE CASCADE +) +COMPRESS NOLOGGING; + +CREATE INDEX "DIFF_CONTENTS_F1" ON "DIFF_CONTENTS" ("MD5_HASH_FROM"); +CREATE INDEX "DIFF_CONTENTS_F2" ON "DIFF_CONTENTS" ("MD5_HASH_TO"); + +WHENEVER SQLERROR EXIT SQL.SQLCODE + +DEF P_CRED = '&1' +DEF P_FOLDER = '&2' +DEF P_VERS = '&3' +DEF P_SER = '&4' +DEF P_PATCH = '&5' + +set pages 0 +set long 1000000 +set lines 10000 +set trims on +set feed off +set echo off +set verify off +col code for a10000 +set termout off +spo run_code.sql +with versions as (select /*+ materialize */ * from ld_versions) +select '@&P_FOLDER./diff_calculate.sql ' || + '''&P_CRED.'' ' || -- P1 + '''' || v2.oraversion || ''' ' || -- P2 + '''' || v2.oraseries || ''' ' || -- P3 + '''' || v2.orapatch || ''' ' || -- P4 + '''' || v1.oraversion || ''' ' || -- P5 + '''' || v1.oraseries || ''' ' || -- P6 + '''' || v1.orapatch || ''' ' || -- P7 + '''' || REPLACE('&P_VERS.','.','') || '''' -- P8 +from versions v1, versions v2 +where v1.display_name_prev=v2.display_name +and ((v1.oraversion='&P_VERS.' and v1.oraseries='&P_SER.' and v1.orapatch=&P_PATCH.) +or (v2.oraversion='&P_VERS.' and v2.oraseries='&P_SER.' and v2.orapatch=&P_PATCH.)); +spool off + +@run_code.sql + +! rm -f run_code.sql + +exit \ No newline at end of file diff --git a/user_scripts/odbfcl/diff_calculate/diff_main_all.sql b/user_scripts/odbfcl/diff_calculate/diff_main_all.sql new file mode 100644 index 0000000..7c15029 --- /dev/null +++ b/user_scripts/odbfcl/diff_calculate/diff_main_all.sql @@ -0,0 +1,40 @@ +-- Run diff generation process for ALL every database. +WHENEVER SQLERROR CONTINUE + +CREATE TABLE "DIFF_CODES" +( + "MD5_HASH_FROM" RAW(16) NOT NULL, + "MD5_HASH_TO" RAW(16) NOT NULL, + "DIFF_CODE" CLOB NOT NULL, + CONSTRAINT DIFF_CODES_PK PRIMARY KEY ("MD5_HASH_FROM", "MD5_HASH_TO"), + CONSTRAINT DIFF_CODES_F1 FOREIGN KEY ("MD5_HASH_FROM") REFERENCES DM_CODES ("MD5_HASH") ON DELETE CASCADE, + CONSTRAINT DIFF_CODES_F2 FOREIGN KEY ("MD5_HASH_TO") REFERENCES DM_CODES ("MD5_HASH") ON DELETE CASCADE +) +COMPRESS NOLOGGING; + +CREATE INDEX "DIFF_CODES_F1" ON "DIFF_CODES" ("MD5_HASH_FROM"); +CREATE INDEX "DIFF_CODES_F2" ON "DIFF_CODES" ("MD5_HASH_TO"); + +CREATE TABLE "DIFF_CONTENTS" +( + "MD5_HASH_FROM" RAW(16) NOT NULL, + "MD5_HASH_TO" RAW(16) NOT NULL, + "DIFF_CODE" CLOB NOT NULL, + CONSTRAINT DIFF_CONTENTS_PK PRIMARY KEY ("MD5_HASH_FROM", "MD5_HASH_TO"), + CONSTRAINT DIFF_CONTENTS_F1 FOREIGN KEY ("MD5_HASH_FROM") REFERENCES DM_CONTENTS ("MD5_HASH") ON DELETE CASCADE, + CONSTRAINT DIFF_CONTENTS_F2 FOREIGN KEY ("MD5_HASH_TO") REFERENCES DM_CONTENTS ("MD5_HASH") ON DELETE CASCADE +) +COMPRESS NOLOGGING; + +CREATE INDEX "DIFF_CONTENTS_F1" ON "DIFF_CONTENTS" ("MD5_HASH_FROM"); +CREATE INDEX "DIFF_CONTENTS_F2" ON "DIFF_CONTENTS" ("MD5_HASH_TO"); + +WHENEVER SQLERROR EXIT SQL.SQLCODE + +DEF P_CRED = '&1' +DEF P_FOLDER = '&2' + +@&P_FOLDER./diff_calculate_all.sql '&P_CRED.' 'all' + +-- Do not exit or it will stop next execution code. +-- exit \ No newline at end of file diff --git a/user_scripts/odbfcl/runExtractor.yml b/user_scripts/odbfcl/runExtractor.yml new file mode 100644 index 0000000..215c766 --- /dev/null +++ b/user_scripts/odbfcl/runExtractor.yml @@ -0,0 +1,24 @@ +## This code will call the extractor process. + +- name: "Run database extractor" + shell: | + set -eo pipefail + export ORACLE_HOME + export ORACLE_SID + export DB_EXP_USER="{{ dump_user_int }}" + export DB_EXP_DIRECTORY="{{ dump_dir_name }}" + export DB_EXP_GEN_DUMP=false + export DB_EXP_IGNORE_ERROR=false + export DB_EXP_INTERNAL_ONLY=false + export DB_EXP_USER_PASS="{{ dump_pass }}" + export DB_EXP_CLEAN_USER=true + [ ! -d ~/exporter_logs ] && mkdir ~/exporter_logs + [ -d ~/oradiff_exporter ] && rm -rf ~/oradiff_exporter && mkdir ~/oradiff_exporter + unzip -q "{{ VM_folder }}/user_scripts/odbfcl/oradiff_exporter.zip" -d ~/ + sh ~/oradiff_exporter/exporter.sh db 2>&1 | tee ~/exporter_logs/{{ file_suffix }}.log + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + ORACLE_SID: "{{ mysid }}" + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" diff --git a/user_scripts/tables_create.sql b/user_scripts/tables_create.sql index dd5aa3d..f43e57a 100644 --- a/user_scripts/tables_create.sql +++ b/user_scripts/tables_create.sql @@ -441,8 +441,8 @@ CREATE TABLE "T_HASH" "TYPE" VARCHAR2(12 CHAR), "ORIGIN_CON_ID" NUMBER, "CON_ID" NUMBER, -"MD5_ENC" RAW(16) NOT NULL, -"SHA1_ENC" RAW(20) NOT NULL, +"MD5_HASH" RAW(16) NOT NULL, +"SHA1_HASH" RAW(20) NOT NULL, "SERIES" VARCHAR2(10 CHAR) NOT NULL, "ORAVERSION" VARCHAR2(20 CHAR) NOT NULL, "PSU" NUMBER NOT NULL, diff --git a/user_scripts/tables_recreate.sql b/user_scripts/tables_recreate.sql index 86192e8..846dfc7 100644 --- a/user_scripts/tables_recreate.sql +++ b/user_scripts/tables_recreate.sql @@ -17,7 +17,7 @@ BEGIN FOR I IN (select table_name from sys.user_tables) LOOP VCODE := 'DROP TABLE ' || DBMS_ASSERT.SQL_OBJECT_NAME(I.TABLE_NAME) || ' CASCADE CONSTRAINTS PURGE'; - DBMS_OUTPUT.PUT_LINE(VCODE); + DBMS_OUTPUT.PUT_LINE(VCODE || ';'); EXECUTE IMMEDIATE VCODE; END LOOP; END; diff --git a/user_scripts_old/odbfcl/adb_load_bugs_fixed.2024Dez/bugsGet.sh b/user_scripts_old/odbfcl/adb_load_bugs_fixed.2024Dez/bugsGet.sh new file mode 100644 index 0000000..8fa4720 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_bugs_fixed.2024Dez/bugsGet.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Script to get all bugs fixed on OPatch + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_out_file_param="$1" + +[ -z "${v_out_file_param}" ] && exitError "1st parameter is the target file and cannot be null." +[ -f "${v_out_file_param}" ] && exitError "File \"${v_out_file_param}\" already exists. Remove it before rerunning." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." + +echo "Generating bugs list. Please wait.." + +# Check if opatch command works +v_opatch_out=$("$ORACLE_HOME"/OPatch/opatch lsinv -bugs_fixed 2>&1) && v_ret=$? || v_ret=$? +if [ ${v_ret} -ne 0 ] +then + echoError "Unable to run opatch. Error was:" + echoError "${v_opatch_out}" + echoError "Skipping opatch collection." + exit ${v_ret} +fi + +# When opatch runs again and too fast, it will fail as the lsinventory file name will have the exact same name (even the seconds part of it). +# Example: + +# Inventory load failed... OPatch cannot load inventory for the given Oracle Home. +# LsInventorySession failed: LsInventory cannot create the log directory /u01/app/oracle/product/database/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2024-03-20_13-56-38PM.txt + +# "$ORACLE_HOME"/OPatch/opatch lsinv -bugs_fixed | +echo "${v_opatch_out}" | +# Remove lines before this entry (inclusive) +sed '1,/^List of Bugs fixed by Installed Patches/d' | +# Remove lines before this entry (inclusive) +sed '1,/^---/d' | +# Remove lines after this entry (inclusive) +sed '/^---/Q' | +# Remove empty lines +sed '/^$/d' | +# Remove breaks from lines not starting with number +sed ':a $!{N; ba}; s/\n\+/\n/g; s/\n\([^0-9]\)/\1/g' | +# Remove double spaces +sed -r 's/[[:space:]]+/ /g' | +# Remove date columns +awk '{$3=$4=$5=$6=$7=$8=""; print $0}' | +# Remove double spaces again after column removal +sed -r 's/[[:space:]]+/ /g' | +# Replace first space per tab +sed 's/ /'$'\t''/' | +# Replace first space per tab (that was the second) +sed 's/ /'$'\t''/' > "${v_out_file_param}" + +exit 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_bugs_fixed.2024Dez/bugsLoad.sh b/user_scripts_old/odbfcl/adb_load_bugs_fixed.2024Dez/bugsLoad.sh new file mode 100644 index 0000000..99b920e --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_bugs_fixed.2024Dez/bugsLoad.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# Script to load all bugs on database + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_dump_user_name="$1" +v_data_file_param="$2" +v_out_prefix="${v_data_file_param%.*}" + +[ -z "${v_dump_user_name}" ] && exitError "1st parameter is the DB Schema and cannot be null." +[ -z "${v_data_file_param}" ] && exitError "2nd parameter is the source file and cannot be null." + +[ ! -f "${v_data_file_param}" -o ! -r "${v_data_file_param}" ] && exitError "File '${v_data_file_param}' does not exist." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." +[ -z "$ORACLE_SID" ] && exitError "\$ORACLE_SID is unset." + +# If DB_EXP_CONN is exported, use it as the credentials. +[ -z "$DB_EXP_CONN" ] && DB_EXP_CONN='/ as sysdba' + +echo "Loading bugs list. Please wait.." + +v_control_file="${v_out_prefix}_load.ctl" +v_log_file="${v_out_prefix}_load.log" + +cat << EOF > "${v_control_file}" +LOAD +INTO TABLE ${v_dump_user_name}.T_BUGSFIXED +APPEND +FIELDS TERMINATED BY x'09' +(bug_id, patch_id, bug_desc) +EOF + +set +e +$ORACLE_HOME/bin/sqlldr \ +userid=\'"${DB_EXP_CONN}"\' \ +control="${v_control_file}" \ +errors=0 \ +discardmax=0 \ +direct=Y \ +data="${v_data_file_param}" \ +log="${v_log_file}" +v_ret=$? +set -eo pipefail + +if [ $v_ret -ne 0 ] +then + exitError "sqlldr failed to load '${v_data_file_param}'. Check also the 'bad' file for more information." +fi + +rm -f "${v_log_file}" "${v_control_file}" + +exit 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_bugs_fixed/adb_load_bugs_fixed.yml.old b/user_scripts_old/odbfcl/adb_load_bugs_fixed/adb_load_bugs_fixed.yml.old new file mode 100644 index 0000000..0410714 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_bugs_fixed/adb_load_bugs_fixed.yml.old @@ -0,0 +1,64 @@ +- name : Define bugs_fixed filename and folder + set_fact: + bugs_fixed_file: "bugs_{{ file_suffix }}.txt" + bugs_fixed_folder: "{{ output_folder }}/bugsfixed" + +- name: "Check if {{ bugs_fixed_folder }}/{{ bugs_fixed_file }} exists" + stat: + path: "{{ bugs_fixed_folder }}/{{ bugs_fixed_file }}" + register: bugs_fixed_stat_result + +# Will skip all the rest if the bugs_fixed file does not exists +- block: + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Create sqlldr table" , + cred : "{{ oci_adb_connection_tns }}" , + file : "create_sqlldr_bugs_fixed_table.sql" , + folder : "user_scripts/odbfcl/adb_load_bugs_fixed" , + params : "" + } + + - name: "Load {{ bugs_fixed_file }} in the database" + shell: | + set -e + + v_file="{{ bugs_fixed_file }}" + v_outpref="{{ shared_folder }}/{{ bugs_fixed_file }}" + + cat << EOF > "${v_outpref}_load.ctl" + LOAD + INTO TABLE T_BUGSFIXED_LOAD + APPEND + FIELDS TERMINATED BY x'09' + (file_name constant "${v_file}", bug_id, patch_id, bug_desc) + EOF + + cd "{{ bugs_fixed_folder }}" + + sqlldr {{ oci_adb_connection_tns }} \ + control="${v_outpref}_load.ctl" \ + errors=0 \ + discardmax=0 \ + direct=Y \ + data="${v_file}" \ + log="${v_outpref}_load.log" + + rm -f "${v_outpref}_load.log" "${v_outpref}_load.ctl" + + register: sqloutput + + - name: SQL Output + debug: msg="{{ sqloutput.stdout_lines }}" + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Load bugs_fixed table" , + cred : "{{ oci_adb_connection_tns }}" , + file : "load_bugs_fixed_table.sql" , + folder : "user_scripts/odbfcl/adb_load_bugs_fixed" , + params : "" + } + + when: bugs_fixed_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_bugs_fixed/bugsGet.yml.old b/user_scripts_old/odbfcl/adb_load_bugs_fixed/bugsGet.yml.old new file mode 100644 index 0000000..ac9d029 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_bugs_fixed/bugsGet.yml.old @@ -0,0 +1,35 @@ +- name : Define bugs_fixed filename and folder + set_fact: + bugs_fixed_file: "bugs_{{ file_suffix }}.txt" + bugs_fixed_folder: "{{ output_folder }}/bugsfixed" + +- name: "Check if {{ bugs_fixed_folder }}/{{ bugs_fixed_file }} exists" + stat: + path: "{{ bugs_fixed_folder }}/{{ bugs_fixed_file }}" + register: bugs_fixed_stat_result + +# Will skip all the rest if the bugs_fixed file exists +- block : + + - name: Collect bugs from ORACLE_HOME + shell: | + set -eo pipefail + export ORACLE_HOME + {{ VM_folder }}/user_scripts/odbfcl/adb_load_bugs_fixed/bugsGet.sh "{{ VM_folder }}/{{ bugs_fixed_file }}" + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + become: true + become_user: oracle + delegate_to: "{{ vm_ip_address }}" + + - name: Copy {{ bugs_fixed_file }} to repository + copy: + src: "{{ shared_folder }}/{{ bugs_fixed_file }}" + dest: "{{ bugs_fixed_folder }}" + + - name : "Remove file {{ bugs_fixed_file }}" + file: + state: absent + path: "{{ shared_folder }}/{{ bugs_fixed_file }}" + + when: not bugs_fixed_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_bugs_fixed/create_sqlldr_bugs_fixed_table.sql.old b/user_scripts_old/odbfcl/adb_load_bugs_fixed/create_sqlldr_bugs_fixed_table.sql.old new file mode 100644 index 0000000..1a03385 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_bugs_fixed/create_sqlldr_bugs_fixed_table.sql.old @@ -0,0 +1,20 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE T_BUGSFIXED_LOAD PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE T_BUGSFIXED_LOAD +( + FILE_NAME VARCHAR2(50) NOT NULL, + BUG_ID NUMBER NOT NULL, + PATCH_ID NUMBER NOT NULL, + BUG_DESC VARCHAR2(1000 CHAR) +) +COMPRESS NOLOGGING; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_bugs_fixed/load_bugs_fixed_table.sql.old b/user_scripts_old/odbfcl/adb_load_bugs_fixed/load_bugs_fixed_table.sql.old new file mode 100644 index 0000000..9363e38 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_bugs_fixed/load_bugs_fixed_table.sql.old @@ -0,0 +1,16 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +insert /*+ append */ + into T_BUGSFIXED (BUG_ID, PATCH_ID, BUG_DESC, ORAVERSION, ORASERIES, ORAPATCH) +select BUG_ID, + PATCH_ID, + BUG_DESC, + substr(file_name,instr(file_name,'_',1,1)+1,instr(file_name,'_',1,2)-instr(file_name,'_',1,1)-1) oraversion, + substr(file_name,instr(file_name,'_',1,2)+1,instr(file_name,'_',1,3)-instr(file_name,'_',1,2)-1) oraseries, + -- to_number(substr(file_name,instr(file_name,'_',1,3)+1,instr(file_name,'.',-1)-instr(file_name,'_',1,3)-1)) orapatch + to_number(regexp_substr(file_name,'(\d+\.)?\d+',instr(file_name,'_',1,3)+1,1), '99999999D99', 'NLS_NUMERIC_CHARACTERS = .,') orapatch +from T_BUGSFIXED_LOAD; + +commit; + +drop table T_BUGSFIXED_LOAD purge; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_expdp/adb_load_expdp.yml.old b/user_scripts_old/odbfcl/adb_load_expdp/adb_load_expdp.yml.old new file mode 100644 index 0000000..228e254 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_expdp/adb_load_expdp.yml.old @@ -0,0 +1,126 @@ +# For main.yml, the pre_prepare_dump_file.yml won't be called. +# So dump_stat_result may be false if the dump was created on this execution. +- name: "Check if {{ shared_folder }}/{{ dump_file_prefix }}.dmp exists" + stat: + path: "{{ shared_folder }}/{{ dump_file_prefix }}.dmp" + register: dump_stat_result + +# This dump_stat_result.stat.exists block is required only because this code is used +# for both the extraction (main.yml), where the file obviusly exists, but also on the +# loader_adb.yml. + +- block: + + - name: Upload expdp to OCI Bucket + include_role: + name: oci_object_storage_object + vars: + oci_upload_bucket: "{{ oci_adb_bucket }}" + oci_object_name: "{{ oci_upload_file | basename }}" + oci_upload_file: "{{ shared_folder }}/{{ dump_file_prefix }}.dmp" + object_action: "create" + +# - name : Define source schema +# set_fact: +# dump_user_int: "{{ dump_user }}" +# when: db_version == "11.2.0.4" +# +# - name : Define source schema +# set_fact: +# dump_user_int: "c##{{ dump_user }}" +# when: db_version != "11.2.0.4" + + # This is done because expdp/impdp still can't handle Credential using oracle native authentication (instance principal, tenancy id, etc), only swift. + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Copy file from Bucket to Oracle Directory" , + cred : "{{ oci_adb_main_tns }}" , + file : "adb_oradir_copy_file.sql" , + folder : "user_scripts/odbfcl/adb_load_expdp" , + params : "'{{ oci_adb_credential }}' '{{ oci_adb_os_url_prefix }}/{{ dump_file_prefix }}.dmp'" + } + + - name: Remove expdp from OCI Bucket + include_role: + name: oci_object_storage_object + vars: + oci_upload_bucket: "{{ oci_adb_bucket }}" + oci_object_name: "{{ dump_file_prefix }}.dmp" + object_action: "remove" + + # This is done because expdp/impdp still can't handle Credential using oracle native authentication (instance principal, tenancy id, etc), only swift. + # - name: Import DB Tables + # shell: | + # impdp \ + # userid={{ oci_adb_connection_tns }} \ + # directory=data_pump_dir \ + # credential='{{ oci_adb_credential }}' \ + # remap_schema='{{ dump_user_int }}:{{ oci_adb_transient_user }}' \ + # parallel=16 \ + # table_exists_action=truncate \ + # dumpfile={{ oci_adb_os_url_prefix }}/{{ dump_file_prefix }}.dmp > "{{ output_folder }}/expdp/{{ dump_file_prefix }}.imp.{{ oci_adb_tns }}.log" 2>&1 + # register: shell_output + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Call import process" , + cred : "{{ oci_adb_main_tns }}" , + file : "adb_process_dp_dump.sql" , + folder : "user_scripts/odbfcl/adb_load_expdp" , + params : "'{{ db_version }}' '{{ patch.base_ru | default('') }}{{ patch.type }}' '{{ patch.id }}' '{{ dump_file_prefix }}.dmp'" + } + +# - name: Import DB Tables +# shell: | +# impdp \ +# userid={{ oci_adb_connection_tns }} \ +# directory=data_pump_dir \ +# remap_schema='{{ dump_user }}:{{ oci_adb_transient_user }},c##{{ dump_user }}:{{ oci_adb_transient_user }}' \ +# parallel=16 \ +# table_exists_action=truncate \ +# content=data_only \ +# logfile={{ dump_file_prefix }}.log \ +# dumpfile={{ dump_file_prefix }}.dmp > "{{ output_folder }}/expdp/{{ dump_file_prefix }}.imp.{{ oci_adb_tns }}.log" 2>&1 +# register: shell_output +# ignore_errors: yes + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Remove dumpfile from Oracle Directory" , + cred : "{{ oci_adb_main_tns }}" , + file : "adb_oradir_remove_file.sql" , + folder : "user_scripts/odbfcl/adb_load_expdp" , + params : "'{{ dump_file_prefix }}.dmp'" + } + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Remove logfile from Oracle Directory" , + cred : "{{ oci_adb_main_tns }}" , + file : "adb_oradir_remove_file.sql" , + folder : "user_scripts/odbfcl/adb_load_expdp" , + params : "'{{ dump_file_prefix }}.log'" + } + +# - name: Import error output +# debug: msg="{{ shell_output.stderr_lines }}" +# when: shell_output.rc != 0 +# +# - name: impdp error +# fail: +# msg: "Check {{ output_folder }}/expdp/{{ dump_file_prefix }}.imp.{{ oci_adb_tns }}.log." +# when: shell_output.rc != 0 and shell_output.rc != 5 +# +# - name: Check impdp error +# shell: | +# set -e +o pipefail +# v_tot=$(cat "{{ output_folder }}/expdp/{{ dump_file_prefix }}.imp.{{ oci_adb_tns }}.log" | grep 'ORA-' | grep -v -E 'ORA-39146|ORA-28002' | wc -l) +# if [ $v_tot -ne 0 ] +# then +# exit 1 +# else +# exit 0 +# fi +# when: shell_output.rc == 5 + + when: dump_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_filechksum.2024Dez/chksumGet.sh b/user_scripts_old/odbfcl/adb_load_filechksum.2024Dez/chksumGet.sh new file mode 100644 index 0000000..4887590 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_filechksum.2024Dez/chksumGet.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# Script to get the sha256sum of all ORACLE_HOME files and libraries + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_out_file_param="$1" + +[ -z "${v_out_file_param}" ] && exitError "1st parameter is the target file and cannot be null." +[ -f "${v_out_file_param}" ] && exitError "File \"${v_out_file_param}\" already exists. Remove it before rerunning." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." + +v_out_file_fdr="$(cd "$(dirname "${v_out_file_param}")"; pwd)" +v_out_file_name="$(basename "${v_out_file_param}")" +v_out_file_name_noext="${v_out_file_name%.*}" + +v_out_file_full="${v_out_file_fdr}/${v_out_file_name}" +v_err_file_full="${v_out_file_fdr}/${v_out_file_name_noext}.err" + +[ -f "${v_err_file_full}" ] && rm -f "${v_err_file_full}" + +echo "Generating sha256sum for \$ORACLE_HOME files. Please wait.." + +cd "$ORACLE_HOME" +set +e +find -type f -exec sha256sum "{}" + > "${v_out_file_full}" 2>> "${v_err_file_full}" +set -eo pipefail +cd - > /dev/null + +sed -i 's/$/ F/' "${v_out_file_full}" + +set +e +v_libs=$(find "$ORACLE_HOME" -type f -name "*.a" 2>> "${v_err_file_full}") +set -eo pipefail + +v_ext_fold=`mktemp -d` +v_out_file=`mktemp` + +echo "Generating sha256sum for static libs. Please wait.." + +IFS=$'\n' +for v_lib in ${v_libs} +do + rm -rf "${v_ext_fold}" + mkdir "${v_ext_fold}" + cd "${v_ext_fold}" + set +e + ar x "${v_lib}" 2>> "${v_err_file_full}" + set -eo pipefail + find -type f -exec sha256sum "{}" + > "${v_out_file}" + cd - > /dev/null + sed -i "s| \.| ${v_lib}|" "${v_out_file}" + sed -i 's/$/ L/' "${v_out_file}" + cat "${v_out_file}" >> "${v_out_file_param}" + rm -rf "${v_ext_fold}" "${v_out_file}" +done + +[ -f "${v_err_file_full}" ] && echo "Total errors detected: $(wc -l < "${v_err_file_full}")" + +[ -f "${v_err_file_full}" -a ! -s "${v_err_file_full}" ] && rm -f "${v_err_file_full}" + +exit 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_filechksum.2024Dez/chksumLoad.sh b/user_scripts_old/odbfcl/adb_load_filechksum.2024Dez/chksumLoad.sh new file mode 100644 index 0000000..de72a9c --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_filechksum.2024Dez/chksumLoad.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# Script to load all sha256sum on database + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_dump_user_name="$1" +v_data_file_param="$2" +v_out_prefix="${v_data_file_param%.*}" + +[ -z "${v_dump_user_name}" ] && exitError "1st parameter is the DB Schema and cannot be null." +[ -z "${v_data_file_param}" ] && exitError "2nd parameter is the source file and cannot be null." + +[ ! -f "${v_data_file_param}" -o ! -r "${v_data_file_param}" ] && exitError "File '${v_data_file_param}' does not exist." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." +[ -z "$ORACLE_SID" ] && exitError "\$ORACLE_SID is unset." + +# If DB_EXP_CONN is exported, use it as the credentials. +[ -z "$DB_EXP_CONN" ] && DB_EXP_CONN='/ as sysdba' + +echo "Loading sha256sum list. Please wait.." + +v_control_file="${v_out_prefix}_load.ctl" +v_log_file="${v_out_prefix}_load.log" + +cat << EOF > "${v_control_file}" +LOAD +INTO TABLE ${v_dump_user_name}.T_FILES +APPEND +FIELDS TERMINATED BY ' ' +(sha256_hash, path char(4000), file_type) +EOF + +set +e +$ORACLE_HOME/bin/sqlldr \ +userid=\'"${DB_EXP_CONN}"\' \ +control="${v_control_file}" \ +errors=0 \ +discardmax=0 \ +direct=Y \ +data="${v_data_file_param}" \ +log="${v_log_file}" +v_ret=$? +set -eo pipefail + +if [ $v_ret -ne 0 ] +then + exitError "sqlldr failed to load '${v_data_file_param}'. Check also the 'bad' file for more information." +fi + +rm -f "${v_log_file}" "${v_control_file}" + +exit 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_filechksum/adb_load_filechksum.yml.old b/user_scripts_old/odbfcl/adb_load_filechksum/adb_load_filechksum.yml.old new file mode 100644 index 0000000..a51173b --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_filechksum/adb_load_filechksum.yml.old @@ -0,0 +1,64 @@ +- name : Define chksum filename and folder + set_fact: + chksum_file: "sha256sum_{{ file_suffix }}.chk" + chksum_folder: "{{ output_folder }}/binsum" + +- name: "Check if {{ chksum_folder }}/{{ chksum_file }} exists" + stat: + path: "{{ chksum_folder }}/{{ chksum_file }}" + register: chksum_stat_result + +# Will skip all the rest if the chksum file does not exists +- block: + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Create sqlldr table" , + cred : "{{ oci_adb_connection_tns }}" , + file : "create_sqlldr_chksum_table.sql" , + folder : "user_scripts/odbfcl/adb_load_filechksum" , + params : "" + } + + - name: "Load {{ chksum_file }} in the database" + shell: | + set -e + + v_file="{{ chksum_file }}" + v_outpref="{{ shared_folder }}/{{ chksum_file }}" + + cat << EOF > "${v_outpref}_load.ctl" + LOAD + INTO TABLE T_FILES_LOAD + APPEND + FIELDS TERMINATED BY ' ' + (file_name constant "${v_file}", hash, path char(4000), file_type) + EOF + + cd "{{ chksum_folder }}" + + sqlldr {{ oci_adb_connection_tns }} \ + control="${v_outpref}_load.ctl" \ + errors=0 \ + discardmax=0 \ + direct=Y \ + data="${v_file}" \ + log="${v_outpref}_load.log" + + rm -f "${v_outpref}_load.log" "${v_outpref}_load.ctl" + + register: sqloutput + + - name: SQL Output + debug: msg="{{ sqloutput.stdout_lines }}" + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Load chksum table" , + cred : "{{ oci_adb_connection_tns }}" , + file : "load_chksum_table.sql" , + folder : "user_scripts/odbfcl/adb_load_filechksum" , + params : "" + } + + when: chksum_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_filechksum/chksumGet.yml.old b/user_scripts_old/odbfcl/adb_load_filechksum/chksumGet.yml.old new file mode 100644 index 0000000..6e71434 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_filechksum/chksumGet.yml.old @@ -0,0 +1,35 @@ +- name : Define chksum filename and folder + set_fact: + sha256_file: "sha256sum_{{ file_suffix }}.chk" + chksum_folder: "{{ output_folder }}/binsum" + +- name: "Check if {{ chksum_folder }}/{{ sha256_file }} exists" + stat: + path: "{{ chksum_folder }}/{{ sha256_file }}" + register: chksum_stat_result + +# Will skip all the rest if the chksum file exists +- block : + + - name: Generate files checksum + shell: | + set -eo pipefail + export ORACLE_HOME + {{ VM_folder }}/user_scripts/odbfcl/adb_load_filechksum/chksumLoad.sh "{{ VM_folder }}/{{ sha256_file }}" + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + + - name: Copy {{ sha256_file }} to repository + copy: + src: "{{ shared_folder }}/{{ sha256_file }}" + dest: "{{ chksum_folder }}" + + - name : "Remove file {{ sha256_file }}" + file: + state: absent + path: "{{ shared_folder }}/{{ sha256_file }}" + + when: not chksum_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_filechksum/create_sqlldr_chksum_table.sql.old b/user_scripts_old/odbfcl/adb_load_filechksum/create_sqlldr_chksum_table.sql.old new file mode 100644 index 0000000..ced7a2f --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_filechksum/create_sqlldr_chksum_table.sql.old @@ -0,0 +1,20 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE T_FILES_LOAD PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE T_FILES_LOAD +( + FILE_NAME VARCHAR2(50) NOT NULL, + HASH RAW(32) NOT NULL, + PATH VARCHAR2(500) NOT NULL, + FILE_TYPE VARCHAR2(1 CHAR) NOT NULL +) +COMPRESS NOLOGGING; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_filechksum/load_chksum_table.sql.old b/user_scripts_old/odbfcl/adb_load_filechksum/load_chksum_table.sql.old new file mode 100644 index 0000000..e626f4d --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_filechksum/load_chksum_table.sql.old @@ -0,0 +1,15 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +insert /*+ append */ into T_FILES (PATH, SHA256_HASH, FILE_TYPE, ORAVERSION, ORASERIES, ORAPATCH) +select path, + hash, + file_type, + substr(file_name,instr(file_name,'_',1,1)+1,instr(file_name,'_',1,2)-instr(file_name,'_',1,1)-1) oraversion, + substr(file_name,instr(file_name,'_',1,2)+1,instr(file_name,'_',1,3)-instr(file_name,'_',1,2)-1) oraseries, + -- to_number(substr(file_name,instr(file_name,'_',1,3)+1,instr(file_name,'.',-1)-instr(file_name,'_',1,3)-1)) orapatch + to_number(regexp_substr(file_name,'(\d+\.)?\d+',instr(file_name,'_',1,3)+1,1), '99999999D99', 'NLS_NUMERIC_CHARACTERS = .,') orapatch +from T_FILES_LOAD; + +commit; + +drop table T_FILES_LOAD purge; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_filechksum/load_chksum_table_2.sql.old b/user_scripts_old/odbfcl/adb_load_filechksum/load_chksum_table_2.sql.old new file mode 100644 index 0000000..1bcd2eb --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_filechksum/load_chksum_table_2.sql.old @@ -0,0 +1,17 @@ +-- Check one day if loading from Object Storage is faster + +WHENEVER SQLERROR EXIT SQL.SQLCODE + +DEF P_CRED = '&1' +DEF P_URL = '&2' +DEF P_FILE = '&3' + +BEGIN + DBMS_CLOUD.COPY_DATA( + table_name =>'T_FILES', + credential_name =>'&P_CRED', + file_uri_list =>'&P_URL/&P_FILE', + format => json_object('type' value 'datapump') + ); +END; +/ \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_symbols.2024Dez/symbolGet.sh b/user_scripts_old/odbfcl/adb_load_symbols.2024Dez/symbolGet.sh new file mode 100644 index 0000000..dfb99a0 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_symbols.2024Dez/symbolGet.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Script to list all symbols in ORACLE_HOME + +# Thanks Frits Hooglang + +# set -eo pipefail +set -e # grep can return 0 lines + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_out_file_param="$1" + +[ -z "${v_out_file_param}" ] && exitError "1st parameter is the target file and cannot be null." +[ -f "${v_out_file_param}" ] && exitError "File \"${v_out_file_param}\" already exists. Remove it before rerunning." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." + +echo > "${v_out_file_param}" + +echo "Generating symbols list. Please wait.." + +# Extract Symbols from Oracle archives (.a) +for ARCHIVE in $(ls $ORACLE_HOME/lib/*.a $ORACLE_HOME/rdbms/lib/*.a) +do + nm -A $ARCHIVE | grep ' [Tt] ' | tr ':' ' ' | cut -d" " -f1,2,4,5 | sort -u | awk '{ if ( $4 != "" ) { file=$1; sub(".*/","", file); printf "%s/%s|%s|%s\n", file, $2, $3, $4 } }' >> "${v_out_file_param}" +done + +# Extract Symbols from Oracle objects (.o) +for OBJECT in $(ls $ORACLE_HOME/lib/*.o $ORACLE_HOME/rdbms/lib/*.o) +do + nm -A $OBJECT | grep ' [Tt] ' | tr ':' ' ' | cut -d" " -f1,3,4 | sort -u | awk '{ if ( $3 != "" ) { file=$1; sub(".*/","", file); printf "%s|%s|%s\n", file, $2, $3 } }' >> "${v_out_file_param}" +done + +# Extract Symbols from Oracle executable +nm -A -C $ORACLE_HOME/bin/oracle | grep ' [TtDdRrVv] ' | tr ':' ' ' | cut -d" " -f1,3,4 | sort -u | awk '{ if ( $3 != "" ) { file=$1; sub(".*/","", file); printf "%s|%s|%s\n", file, $2, $3 } }' >> "${v_out_file_param}" + +# Remove empty lines or sqlldr will fail due to constant. +sed -i '/^$/d' "${v_out_file_param}" + +exit 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_symbols.2024Dez/symbolLoad.sh b/user_scripts_old/odbfcl/adb_load_symbols.2024Dez/symbolLoad.sh new file mode 100644 index 0000000..e8e6843 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_symbols.2024Dez/symbolLoad.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# Script to load all symbols on database + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_dump_user_name="$1" +v_data_file_param="$2" +v_out_prefix="${v_data_file_param%.*}" + +[ -z "${v_dump_user_name}" ] && exitError "1st parameter is the DB Schema and cannot be null." +[ -z "${v_data_file_param}" ] && exitError "2nd parameter is the source file and cannot be null." + +[ ! -f "${v_data_file_param}" -o ! -r "${v_data_file_param}" ] && exitError "File '${v_data_file_param}' does not exist." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." +[ -z "$ORACLE_SID" ] && exitError "\$ORACLE_SID is unset." + +# If DB_EXP_CONN is exported, use it as the credentials. +[ -z "$DB_EXP_CONN" ] && DB_EXP_CONN='/ as sysdba' + +echo "Loading symbols list. Please wait.." + +v_control_file="${v_out_prefix}_load.ctl" +v_log_file="${v_out_prefix}_load.log" + +cat << EOF > "${v_control_file}" +LOAD +INTO TABLE ${v_dump_user_name}.T_SYMBOLS +APPEND +FIELDS TERMINATED BY '|' +(file_name, symbol_type, symbol_name char(4000) "substr(:symbol_name, 0, 500)") +EOF + +set +e +$ORACLE_HOME/bin/sqlldr \ +userid=\'"${DB_EXP_CONN}"\' \ +control="${v_control_file}" \ +errors=0 \ +discardmax=0 \ +direct=Y \ +data="${v_data_file_param}" \ +log="${v_log_file}" +v_ret=$? +set -eo pipefail + +if [ $v_ret -ne 0 ] +then + exitError "sqlldr failed to load '${v_data_file_param}'. Check also the 'bad' file for more information." +fi + +rm -f "${v_log_file}" "${v_control_file}" + +exit 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_symbols/adb_load_symbols.yml.old b/user_scripts_old/odbfcl/adb_load_symbols/adb_load_symbols.yml.old new file mode 100644 index 0000000..ac2ab15 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_symbols/adb_load_symbols.yml.old @@ -0,0 +1,67 @@ +- name : Define symbols filename and folder + set_fact: + symbols_file: "symbols_{{ file_suffix }}.csv" + symbols_folder: "{{ output_folder }}/symbols" + +- name: "Check if {{ symbols_folder }}/{{ symbols_file }} exists" + stat: + path: "{{ symbols_folder }}/{{ symbols_file }}" + register: symbols_stat_result + +# Will skip all the rest if the symbols file does not exists +- block: + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Create sqlldr table" , + cred : "{{ oci_adb_connection_tns }}" , + file : "create_sqlldr_symbols_table.sql" , + folder : "user_scripts/odbfcl/adb_load_symbols" , + params : "" + } + + - name: "Load {{ symbols_file }} in the database" + shell: | + set -e + + v_file="{{ symbols_file }}" + v_outpref="{{ shared_folder }}/{{ symbols_file }}" + + cat << EOF > "${v_outpref}_load.ctl" + LOAD + INTO TABLE T_SYMBOLS_LOAD + APPEND + FIELDS TERMINATED BY '|' + (source_file constant "${v_file}", file_name, symbol_type, symbol_name char(4000)) + EOF + + cd "{{ symbols_folder }}" + + # Remove empty lines or sqlldr will fail due to constant. + sed -i '/^$/d' "${v_file}" + + sqlldr {{ oci_adb_connection_tns }} \ + control="${v_outpref}_load.ctl" \ + errors=0 \ + discardmax=0 \ + direct=Y \ + data="${v_file}" \ + log="${v_outpref}_load.log" + + rm -f "${v_outpref}_load.log" "${v_outpref}_load.ctl" + + register: sqloutput + + - name: SQL Output + debug: msg="{{ sqloutput.stdout_lines }}" + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Load symbols table" , + cred : "{{ oci_adb_connection_tns }}" , + file : "load_symbols_table.sql" , + folder : "user_scripts/odbfcl/adb_load_symbols" , + params : "" + } + + when: symbols_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_symbols/create_sqlldr_symbols_table.sql.old b/user_scripts_old/odbfcl/adb_load_symbols/create_sqlldr_symbols_table.sql.old new file mode 100644 index 0000000..d41caa3 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_symbols/create_sqlldr_symbols_table.sql.old @@ -0,0 +1,20 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE T_SYMBOLS_LOAD PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE T_SYMBOLS_LOAD +( + SOURCE_FILE VARCHAR2(50) NOT NULL, + FILE_NAME VARCHAR2(200) NOT NULL, + SYMBOL_TYPE VARCHAR2(1) NOT NULL, + SYMBOL_NAME VARCHAR2(500) NOT NULL +) +COMPRESS NOLOGGING; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_symbols/load_symbols_table.sql.old b/user_scripts_old/odbfcl/adb_load_symbols/load_symbols_table.sql.old new file mode 100644 index 0000000..790382f --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_symbols/load_symbols_table.sql.old @@ -0,0 +1,15 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +insert /*+ append */ into T_SYMBOLS (FILE_NAME, SYMBOL_TYPE, SYMBOL_NAME, ORAVERSION, ORASERIES, ORAPATCH) +select file_name, + symbol_type, + symbol_name, + substr(source_file,instr(source_file,'_',1,1)+1,instr(source_file,'_',1,2)-instr(source_file,'_',1,1)-1) oraversion, + substr(source_file,instr(source_file,'_',1,2)+1,instr(source_file,'_',1,3)-instr(source_file,'_',1,2)-1) oraseries, + -- to_number(substr(source_file,instr(source_file,'_',1,3)+1,instr(source_file,'.',-1)-instr(source_file,'_',1,3)-1)) orapatch + to_number(regexp_substr(file_name,'(\d+\.)?\d+',instr(file_name,'_',1,3)+1,1), '99999999D99', 'NLS_NUMERIC_CHARACTERS = .,') orapatch +from T_SYMBOLS_LOAD; + +commit; + +drop table T_SYMBOLS_LOAD purge; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_symbols/symbolGet.yml.old b/user_scripts_old/odbfcl/adb_load_symbols/symbolGet.yml.old new file mode 100644 index 0000000..0c82372 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_symbols/symbolGet.yml.old @@ -0,0 +1,35 @@ +- name : Define symbols filename and folder + set_fact: + symbols_file: "symbols_{{ file_suffix }}.csv" + symbols_folder: "{{ output_folder }}/symbols" + +- name: "Check if {{ symbols_folder }}/{{ symbols_file }} exists" + stat: + path: "{{ symbols_folder }}/{{ symbols_file }}" + register: symbols_stat_result + +# Will skip the rest if the symbols file exists +- block : + + - name: Collect symbols from ORACLE_HOME + shell: | + set -eo pipefail + export ORACLE_HOME + {{ VM_folder }}/user_scripts/odbfcl/adb_load_symbols/symbolGet.sh "{{ VM_folder }}/{{ symbols_file }}" + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + + - name: Copy {{ symbols_file }} to repository + copy: + src: "{{ shared_folder }}/{{ symbols_file }}" + dest: "{{ symbols_folder }}" + + - name : "Remove file {{ symbols_file }}" + file: + state: absent + path: "{{ shared_folder }}/{{ symbols_file }}" + + when: not symbols_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_txtcollection_files.2024Dez/fileGet.sh b/user_scripts_old/odbfcl/adb_load_txtcollection_files.2024Dez/fileGet.sh new file mode 100644 index 0000000..f80f386 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_txtcollection_files.2024Dez/fileGet.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# Script to get all non-binary files in ORACLE_HOME + +# TODO: Fix: tar: ./rdbms/log/stout_orcl_17338.txt: Cannot stat: No such file or directory +# SOLUTION: Stop DB before collection, or add flag to make tar ignore missing files + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_out_file_param="$1" + +[ -z "${v_out_file_param}" ] && exitError "1st parameter is the target file and cannot be null." +[ -f "${v_out_file_param}" ] && exitError "File \"${v_out_file_param}\" already exists. Remove it before rerunning." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." + +v_out_file_fdr="$(cd "$(dirname "${v_out_file_param}")"; pwd)" +v_out_file_name="$(basename "${v_out_file_param}")" +v_out_file_name_noext="${v_out_file_name%.*}" + +v_out_file_full="${v_out_file_fdr}/${v_out_file_name}" +v_err_file_full="${v_out_file_fdr}/${v_out_file_name_noext}.err" + +[ -f "${v_err_file_full}" ] && rm -f "${v_err_file_full}" + +echo "Generating ORACLE_HOME non-binary files list. Please wait.." + +cd "$ORACLE_HOME" + +set +e # grep may return "Permission denied" +find -type f -not -path "./.patch_storage/*" -not -name "tfa_setup" -print0 2>> "${v_err_file_full}" | xargs -0 -n 100 grep -Il '.' 2>> "${v_err_file_full}" | tar -czf "${v_out_file_full}" -T - +# "-n 100" added to xargs due to bug in grep where it is skipping files when the input list is huge. Tested with DB 18.12. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73360 + +[ -f "${v_err_file_full}" ] && echo "Total errors detected: $(wc -l < "${v_err_file_full}")" + +[ -f "${v_err_file_full}" -a ! -s "${v_err_file_full}" ] && rm -f "${v_err_file_full}" + +exit 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_txtcollection_files.2024Dez/fileLoad.sh b/user_scripts_old/odbfcl/adb_load_txtcollection_files.2024Dez/fileLoad.sh new file mode 100644 index 0000000..ae91768 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_txtcollection_files.2024Dez/fileLoad.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# Script to load all non-binary files on database + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_dump_user_name="$1" +v_data_file_param="$2" +v_out_prefix="${v_data_file_param%.*}" +v_out_prefix="${v_out_prefix%.*}" # Remove second extension + +[ -z "${v_dump_user_name}" ] && exitError "1st parameter is the DB Schema and cannot be null." +[ -z "${v_data_file_param}" ] && exitError "2nd parameter is the source file and cannot be null." + +[ ! -f "${v_data_file_param}" -o ! -r "${v_data_file_param}" ] && exitError "File '${v_data_file_param}' does not exist." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." +[ -z "$ORACLE_SID" ] && exitError "\$ORACLE_SID is unset." + +# If DB_EXP_CONN is exported, use it as the credentials. +[ -z "$DB_EXP_CONN" ] && DB_EXP_CONN='/ as sysdba' + +echo "Loading ORACLE_HOME non-binary files. Please wait.." + +v_control_file="${v_out_prefix}_load.ctl" +v_log_file="${v_out_prefix}_load.log" +v_untar_folder="${v_out_prefix}_untar" +v_list_file="tar_list_files.txt" + +rm -rf "${v_untar_folder}" +mkdir "${v_untar_folder}" +tar -tvf "${v_data_file_param}" | grep -o '\./.*' > "${v_untar_folder}/${v_list_file}" +tar -xf "${v_data_file_param}" -C "${v_untar_folder}" + +cd "${v_untar_folder}" + +$ORACLE_HOME/bin/sqlplus -L -S "${DB_EXP_CONN}" < "${v_control_file}" +LOAD +INTO TABLE ${v_dump_user_name}.T_TXTCOLLECTION_LOAD +APPEND +FIELDS TERMINATED BY ',' +(path char(4000), contents lobfile(path) terminated by eof) +EOF + +set +e +$ORACLE_HOME/bin/sqlldr \ +userid=\'"${DB_EXP_CONN}"\' \ +control="${v_control_file}" \ +errors=0 \ +discardmax=0 \ +direct=Y \ +data="${v_list_file}" \ +log="${v_log_file}" +v_ret=$? +set -eo pipefail + +if [ $v_ret -ne 0 ] +then + exitError "sqlldr failed to load '${v_data_file_param}'. Check also the 'bad' file for more information." +fi + +cd .. +rm -rf "${v_untar_folder}" + +$ORACLE_HOME/bin/sqlplus -L -S "${DB_EXP_CONN}" < "${v_outpref}_unzip/${v_file}_files.txt" + + tar -xf "{{ txtcollection_folder }}/${v_file}" -C "${v_outpref}_unzip" + + cat << EOF > "${v_outpref}_load.ctl" + LOAD + INTO TABLE T_TXTCOLLECTION_LOAD + APPEND + FIELDS TERMINATED BY ',' + (file_name constant "${v_file}", + path char(4000), + contents lobfile(path) terminated by eof) + EOF + + cd "${v_outpref}_unzip" + + sqlldr {{ oci_adb_connection_tns }} \ + control="${v_outpref}_load.ctl" \ + errors=0 \ + discardmax=0 \ + direct=Y \ + data="${v_file}_files.txt" \ + log="${v_outpref}_load.log" + + rm -f "${v_outpref}_load.log" "${v_outpref}_load.ctl" + rm -rf "${v_outpref}_unzip" + + register: sqloutput + + - name: SQL Output + debug: msg="{{ sqloutput.stdout_lines }}" + + - include: tasks/local_sqlplus.yml + vars: + sql_param : { task_action : "Load txtcollection table" , + cred : "{{ oci_adb_connection_tns }}" , + file : "load_txtcollection_table.sql" , + folder : "user_scripts/odbfcl/adb_load_txtcollection_files" , + params : "" + } + + when: txtcollection_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_txtcollection_files/create_sqlldr_txtcollection_table.sql.old b/user_scripts_old/odbfcl/adb_load_txtcollection_files/create_sqlldr_txtcollection_table.sql.old new file mode 100644 index 0000000..fa02dae --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_txtcollection_files/create_sqlldr_txtcollection_table.sql.old @@ -0,0 +1,20 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE T_TXTCOLLECTION_LOAD PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE T_TXTCOLLECTION_LOAD +( + FILE_NAME VARCHAR2(50) NOT NULL, + PATH VARCHAR2(500) NOT NULL, + CONTENTS CLOB NOT NULL, + MD5_HASH RAW(16) +) +COMPRESS NOLOGGING; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_txtcollection_files/fileGet.yml.old b/user_scripts_old/odbfcl/adb_load_txtcollection_files/fileGet.yml.old new file mode 100644 index 0000000..8248068 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_txtcollection_files/fileGet.yml.old @@ -0,0 +1,36 @@ +# Folder to store the collected ORACLE_HOME text files +- name : Define txtcollect filename and folder + set_fact: + txtcollect_file: "txtcol_{{ file_suffix }}.tar.gz" + txtcollect_folder: "{{ output_folder }}/txtcollect" + +- name: "Check if {{ txtcollect_folder }}/{{ txtcollect_file }} exists" + stat: + path: "{{ txtcollect_folder }}/{{ txtcollect_file }}" + register: txtcollect_stat_result + +# Will skip the rest if the txtcollect file exists +- block : + + - name: Collect text files from ORACLE_HOME + shell: | + set -eo pipefail + export ORACLE_HOME + {{ VM_folder }}/user_scripts/odbfcl/adb_load_txtcollection_files/fileGet.sh "{{ VM_folder }}/{{ txtcollect_file }}" + environment: + ORACLE_HOME: "{{ dbhome_locl }}" + become: true + become_user: root + delegate_to: "{{ vm_ip_address }}" + + - name: Copy {{ txtcollect_file }} to repository + copy: + src: "{{ shared_folder }}/{{ txtcollect_file }}" + dest: "{{ txtcollect_folder }}" + + - name : "Remove file {{ txtcollect_file }}" + file: + state: absent + path: "{{ shared_folder }}/{{ txtcollect_file }}" + + when: not txtcollect_stat_result.stat.exists \ No newline at end of file diff --git a/user_scripts_old/odbfcl/adb_load_txtcollection_files/load_txtcollection_table.sql.old b/user_scripts_old/odbfcl/adb_load_txtcollection_files/load_txtcollection_table.sql.old new file mode 100644 index 0000000..ec4b662 --- /dev/null +++ b/user_scripts_old/odbfcl/adb_load_txtcollection_files/load_txtcollection_table.sql.old @@ -0,0 +1,30 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +UPDATE T_TXTCOLLECTION_LOAD SET MD5_HASH=SYS.DBMS_CRYPTO.HASH(CONTENTS,2); + +-- TODO: CHANGE 2 QUERIES FOR 1 USING "INSERT ALL" + +insert /*+ append */ + into DM_CONTENTS (MD5_HASH, CONTENTS) +select MD5_HASH, CONTENTS +from ( + select MD5_HASH, + CONTENTS, + RANK() over (partition by MD5_HASH order by rowid asc) col_ind + from T_TXTCOLLECTION_LOAD +) +where col_ind=1; + +insert /*+ append */ + into T_TXTCOLLECTION (PATH, MD5_HASH, ORAVERSION, ORASERIES, ORAPATCH) +select PATH, + MD5_HASH, + substr(file_name,instr(file_name,'_',1,1)+1,instr(file_name,'_',1,2)-instr(file_name,'_',1,1)-1) oraversion, + substr(file_name,instr(file_name,'_',1,2)+1,instr(file_name,'_',1,3)-instr(file_name,'_',1,2)-1) oraseries, + -- to_number(substr(file_name,instr(file_name,'_',1,3)+1,instr(file_name,'.',-1,2)-instr(file_name,'_',1,3)-1)) orapatch + to_number(regexp_substr(file_name,'(\d+\.)?\d+',instr(file_name,'_',1,3)+1,1), '99999999D99', 'NLS_NUMERIC_CHARACTERS = .,') orapatch +from T_TXTCOLLECTION_LOAD; + +commit; + +drop table T_TXTCOLLECTION_LOAD purge; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/createUser.sql.2024Dez b/user_scripts_old/odbfcl/createUser.sql.2024Dez new file mode 100644 index 0000000..0b92e1e --- /dev/null +++ b/user_scripts_old/odbfcl/createUser.sql.2024Dez @@ -0,0 +1,40 @@ +-- Create exporter user +WHENEVER SQLERROR CONTINUE + +def v_username='&1.' +def v_password='&2.' +def v_data_tbs='&3.' +def v_temp_tbs='&4.' +def v_drop_user='&5.' + +DECLARE + USER_DOES_NOT_EXIST EXCEPTION; + PRAGMA EXCEPTION_INIT(USER_DOES_NOT_EXIST, -1918); +BEGIN + IF '&v_drop_user.' = 'true' + THEN + EXECUTE IMMEDIATE 'DROP USER &v_username. CASCADE'; + END IF; +EXCEPTION + WHEN USER_DOES_NOT_EXIST THEN + NULL; +END; +/ + +WHENEVER SQLERROR EXIT SQL.SQLCODE + +CREATE USER &v_username. + IDENTIFIED BY "&v_password." + DEFAULT TABLESPACE "&v_data_tbs." + TEMPORARY TABLESPACE "&v_temp_tbs." + QUOTA UNLIMITED ON "&v_data_tbs."; + +GRANT CREATE SESSION TO &v_username.; +GRANT CREATE TABLE TO &v_username.; + +-- REMOVE_IF_ZIP_AFTER + +-- This is no longer enabled after wrapper moved to PL/SQL + +-- For unwrapper: +-- GRANT CREATE PROCEDURE TO &v_username.; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/create_hash_load_table.sql b/user_scripts_old/odbfcl/extract.2024Dez/create_hash_load_table.sql new file mode 100644 index 0000000..f3c0dfb --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/create_hash_load_table.sql @@ -0,0 +1,24 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE &v_username.."T_HASH_LOAD" PURGE'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; +/ + +CREATE TABLE &v_username.."T_HASH_LOAD" +( + "OWNER" VARCHAR2(128 CHAR), + "NAME" VARCHAR2(128 CHAR), + "TYPE" VARCHAR2(12 CHAR), + "ORIGIN_CON_ID" NUMBER, + "CON_ID" NUMBER, + "MD5_HASH" RAW(16) NOT NULL, + "SHA1_HASH" RAW(20) NOT NULL, + "CODE" CLOB NOT NULL +) +COMPRESS NOLOGGING; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/hashGet.sql b/user_scripts_old/odbfcl/extract.2024Dez/hashGet.sql new file mode 100644 index 0000000..3688bed --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/hashGet.sql @@ -0,0 +1,86 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +set lines 1000 +set verify off +set tab off +set serverout on + +DEF V_USERNAME = '&1' +DEF V_DIRECTORY = '&2' +DEF V_INTERNAL = '&3' + +set termout off + +-- Convert to uppercase +col v_username new_v v_username nopri +col v_directory new_v v_directory nopri +col v_internal new_v v_internal nopri +SELECT UPPER('&V_USERNAME.') V_USERNAME, UPPER('&V_DIRECTORY.') V_DIRECTORY, LOWER('&V_INTERNAL.') V_INTERNAL FROM DUAL; +col v_username clear +col v_directory clear +col v_internal clear + +col p_vers_4d new_v p_vers_4d nopri +col p_vers_1d new_v p_vers_1d nopri +select substr(version,1,instr(version,'.',1,4)-1) p_vers_4d, + substr(version,1,instr(version,'.',1,1)-1) p_vers_1d +from (select version from v$instance); +col p_vers_4d clear +col p_vers_1d clear + +set termout on + +DECLARE + V_VERS_1D NUMBER := '&p_vers_1d.'; + V_VERS_4D VARCHAR2(20) := '&p_vers_4d.'; +BEGIN + IF V_VERS_4D = '12.1.0.1' THEN + NULL; + ELSIF V_VERS_4D = '12.1.0.2' THEN + execute immediate 'alter session set exclude_seed_cdb_view=false'; + ELSIF V_VERS_1D >= 12 THEN + execute immediate 'alter session set "_exclude_seed_cdb_view"=false'; + END IF; +END; +/ + +@@version_filter.sql + +PRO CREATE TABLE FOR INTERNAL OBJECTS +@@internal_schemas/int_resources_create.sql + +PRO CREATE TABLE FOR HASH_LOAD +@@create_hash_load_table.sql + +PRO CDB/DBA_SOURCE +@@load_source.sql + +PRO CDB/DBA_VIEWS +@@load_view.sql + +PRO LOAD HASH/CODE TABLES +@@load_code.sql + +PRO Some CDB/DBA Views +@@load_dba_cdb.sql + +-- PRO Database Vault tables +-- @@load_database_vault.sql + +PRO Some V$ Info +@@load_v_dollar.sql + +PRO Non CDB/DBA views or tables +@@load_custom.sql + +commit; + +PRO Some X$ Info +@@load_x_dollar.sql + +commit; + +PRO DROP TABLES +@@tables_drop.sql + +exit; diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.1.sql new file mode 100644 index 0000000..5e92f41 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.1.sql @@ -0,0 +1,61 @@ +-------------------------------------- +-- 10.2.0.1 +-------------------------------------- + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','DEFAULT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','MONITORING_PROFILE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AQ_ADMINISTRATOR_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AQ_USER_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AUTHENTICATEDUSER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CONNECT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CTXAPP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DBA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DELETE_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EJBCLIENT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EXECUTE_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EXP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','GATHER_SYSTEM_STATISTICS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','GLOBAL_AQ_USER_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','HS_ADMIN_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','IMP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVADEBUGPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVAIDPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVASYSPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVAUSERPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVA_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVA_DEPLOY'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','LOGSTDBY_ADMINISTRATOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','MGMT_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OEM_ADVISOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OEM_MONITOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAP_DBA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAP_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','RECOVERY_CATALOG_OWNER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','RESOURCE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SCHEDULER_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SELECT_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','WM_ADMIN_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDBADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDBWEBSERVICES'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ANONYMOUS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','CTXSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','DBSNMP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','DIP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','DMSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','EXFSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MDDATA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MDSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MGMT_VIEW'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OLAPSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORDPLUGINS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORDSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OUTLN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SCOTT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SI_INFORMTN_SCHEMA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYSMAN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYSTEM'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','TSMSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','WMSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','XDB'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('X','PUBLIC'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.2.sql new file mode 100644 index 0000000..d08ff1e --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.2.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.2 +-------------------------------------- + +-- The code is the same as 10.2.0.1 +@@int_resources_10.2.0.1.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.3.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.3.sql new file mode 100644 index 0000000..08d9714 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.3.sql @@ -0,0 +1,8 @@ +-------------------------------------- +-- 10.2.0.3 +-------------------------------------- + +-- The code is the same as 10.2.0.1 +@@int_resources_10.2.0.1.sql + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORACLE_OCM'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.4.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.4.sql new file mode 100644 index 0000000..2f2f035 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.4.sql @@ -0,0 +1,9 @@ +-------------------------------------- +-- 10.2.0.4 +-------------------------------------- + +-- The code is the same as 10.2.0.3 +@@int_resources_10.2.0.3.sql + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CWM_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAPI_TRACE_USER'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.5.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.5.sql new file mode 100644 index 0000000..3c4825d --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_10.2.0.5.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.5 +-------------------------------------- + +-- The code is the same as 10.2.0.4 +@@int_resources_10.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.1.0.6.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.1.0.6.sql new file mode 100644 index 0000000..a5e133a --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.1.0.6.sql @@ -0,0 +1,90 @@ +-------------------------------------- +-- 11.1.0.6 +-------------------------------------- + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','DEFAULT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','MONITORING_PROFILE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','WKSYS_PROF'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AQ_ADMINISTRATOR_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AQ_USER_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AUTHENTICATEDUSER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CONNECT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CSW_USR_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CTXAPP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CWM_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DATAPUMP_EXP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DATAPUMP_IMP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DBA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DELETE_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EJBCLIENT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EXECUTE_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EXP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','GATHER_SYSTEM_STATISTICS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','GLOBAL_AQ_USER_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','HS_ADMIN_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','IMP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVADEBUGPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVAIDPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVASYSPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVAUSERPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVA_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVA_DEPLOY'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JMXSERVER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','LOGSTDBY_ADMINISTRATOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','MGMT_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OEM_ADVISOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OEM_MONITOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAPI_TRACE_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAP_DBA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAP_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAP_XS_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','ORDADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OWB$CLIENT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OWB_DESIGNCENTER_VIEW'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OWB_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','RECOVERY_CATALOG_OWNER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','RESOURCE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SCHEDULER_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SELECT_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SPATIAL_CSW_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SPATIAL_WFS_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','WFS_USR_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','WKUSER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','WM_ADMIN_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDBADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDB_SET_INVOKER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDB_WEBSERVICES'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDB_WEBSERVICES_OVER_HTTP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDB_WEBSERVICES_WITH_PUBLIC'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ANONYMOUS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','APEX_PUBLIC_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','CTXSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','DBSNMP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','DIP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','EXFSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','FLOWS_030000'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','FLOWS_FILES'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MDDATA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MDSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MGMT_VIEW'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OLAPSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORACLE_OCM'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORDPLUGINS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORDSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OUTLN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OWBSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SCOTT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SI_INFORMTN_SCHEMA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SPATIAL_CSW_ADMIN_USR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SPATIAL_WFS_ADMIN_USR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYSMAN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYSTEM'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','TSMSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','WKPROXY'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','WKSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','WK_TEST'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','WMSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','XDB'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','XS$NULL'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('X','PUBLIC'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.1.0.7.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.1.0.7.sql new file mode 100644 index 0000000..93c774b --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.1.0.7.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.1.0.7 +-------------------------------------- + +-- The code is the same as 11.1.0.6 +@@int_resources_11.1.0.6.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.1.sql new file mode 100644 index 0000000..280d703 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.1.sql @@ -0,0 +1,8 @@ +-------------------------------------- +-- 11.2.0.1 +-------------------------------------- + +-- The code is the same as 11.2.0.2 +@@int_resources_11.2.0.2.sql + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAPI_TRACE_USER'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.2.sql new file mode 100644 index 0000000..b6dc345 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.2.sql @@ -0,0 +1,91 @@ +-------------------------------------- +-- 11.2.0.2 +-------------------------------------- + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','DEFAULT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','MONITORING_PROFILE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','ADM_PARALLEL_EXECUTE_TASK'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','APEX_ADMINISTRATOR_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AQ_ADMINISTRATOR_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AQ_USER_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','AUTHENTICATEDUSER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CONNECT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CSW_USR_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CTXAPP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','CWM_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DATAPUMP_EXP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DATAPUMP_IMP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DBA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DBFS_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','DELETE_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EJBCLIENT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EXECUTE_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','EXP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','GATHER_SYSTEM_STATISTICS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','GLOBAL_AQ_USER_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','HS_ADMIN_EXECUTE_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','HS_ADMIN_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','HS_ADMIN_SELECT_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','IMP_FULL_DATABASE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVADEBUGPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVAIDPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVASYSPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVAUSERPRIV'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVA_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JAVA_DEPLOY'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','JMXSERVER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','LOGSTDBY_ADMINISTRATOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','MGMT_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OEM_ADVISOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OEM_MONITOR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAP_DBA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAP_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OLAP_XS_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','ORDADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OWB$CLIENT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OWB_DESIGNCENTER_VIEW'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','OWB_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','RECOVERY_CATALOG_OWNER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','RESOURCE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SCHEDULER_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SELECT_CATALOG_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SPATIAL_CSW_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','SPATIAL_WFS_ADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','WFS_USR_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','WM_ADMIN_ROLE'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDBADMIN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDB_SET_INVOKER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDB_WEBSERVICES'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDB_WEBSERVICES_OVER_HTTP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('R','XDB_WEBSERVICES_WITH_PUBLIC'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ANONYMOUS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','APEX_030200'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','APEX_PUBLIC_USER'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','APPQOSSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','CTXSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','DBSNMP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','DIP'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','EXFSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','FLOWS_FILES'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MDDATA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MDSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','MGMT_VIEW'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OLAPSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORACLE_OCM'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORDDATA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORDPLUGINS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','ORDSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OUTLN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OWBSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OWBSYS_AUDIT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SCOTT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SI_INFORMTN_SCHEMA'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SPATIAL_CSW_ADMIN_USR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SPATIAL_WFS_ADMIN_USR'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYSMAN'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','SYSTEM'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','WMSYS'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','XDB'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','XS$NULL'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('X','PUBLIC'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.3.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.3.sql new file mode 100644 index 0000000..8f69315 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.3.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.2.0.3 +-------------------------------------- + +-- The code is the same as 11.2.0.2 +@@int_resources_11.2.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.4.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.4.sql new file mode 100644 index 0000000..dd3c3a9 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_11.2.0.4.sql @@ -0,0 +1,8 @@ +-------------------------------------- +-- 11.2.0.4 +-------------------------------------- + +-- The code is the same as 11.2.0.2 +@@int_resources_11.2.0.2.sql + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('U','OJVMSYS'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.1.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.1.0.1.sql new file mode 100644 index 0000000..028ffeb --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.1.0.1.sql @@ -0,0 +1,5 @@ +-------------------------------------- +-- 12.1.0.1 +-------------------------------------- + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','DEFAULT'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.1.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.1.0.2.sql new file mode 100644 index 0000000..82fe23d --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.1.0.2.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 12.1.0.2 +-------------------------------------- + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','DEFAULT'); +INSERT INTO &v_int_schema_tab. (TYPE,NAME) VALUES ('P','ORA_STIG_PROFILE'); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.2.0.1.sql new file mode 100644 index 0000000..ebbb837 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_12.2.0.1.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 12.2.0.1 +-------------------------------------- + +-- The code is the same as 12.1.0.2 +@@int_resources_12.1.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_18.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_18.0.0.0.sql new file mode 100644 index 0000000..3a916a9 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_18.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 18.0.0.0 +-------------------------------------- + +-- The code is the same as 12.1.0.2 +@@int_resources_12.1.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_19.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_19.0.0.0.sql new file mode 100644 index 0000000..afe8576 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_19.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 19.0.0.0 +-------------------------------------- + +-- The code is the same as 12.1.0.2 +@@int_resources_12.1.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_create.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_create.sql new file mode 100644 index 0000000..e2906d2 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_create.sql @@ -0,0 +1,28 @@ +def v_int_schema_tab = '&v_username..internal_schemas' + +create table &v_int_schema_tab. +( + type varchar2(1 char), + name varchar2(30 char) +); + +set termout off + +col v_suffix new_v v_suffix nopri + +-- Load users/roles/(profiles for < 12) +select case when &P_VERS_1D >= 12 then 'user_role_om' else '&P_VERS_4D.' end v_suffix from dual; +select decode('&v_internal','true','&v_suffix.','nothing') v_suffix from dual; +@@int_resources_&v_suffix..sql + +-- Load (profiles for >= 12) +select case when &P_VERS_1D >= 21 then 'prof_om' when &P_VERS_1D < 12 then 'nothing' else '&P_VERS_4D.' end v_suffix from dual; +select decode('&v_internal','true','&v_suffix.','nothing') v_suffix from dual; +@@int_resources_&v_suffix..sql + +col v_suffix clear +undef v_suffix + +commit; + +set termout on \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_drop.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_drop.sql new file mode 100644 index 0000000..d639d99 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_drop.sql @@ -0,0 +1 @@ +drop table &v_int_schema_tab. purge; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_nothing.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_nothing.sql new file mode 100644 index 0000000..fa8182f --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_nothing.sql @@ -0,0 +1,5 @@ +-------------------------------------- +-- Nothing +-------------------------------------- + +-- Do not do anything. \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_prof_om.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_prof_om.sql new file mode 100644 index 0000000..a06cb62 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_prof_om.sql @@ -0,0 +1,8 @@ +-------------------------------------- +-- >= 21 +-------------------------------------- + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) +SELECT DISTINCT 'P',PROFILE +FROM CDB_PROFILES +WHERE ORACLE_MAINTAINED = 'YES'; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_user_role_om.sql b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_user_role_om.sql new file mode 100644 index 0000000..561bcf9 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/internal_schemas/int_resources_user_role_om.sql @@ -0,0 +1,15 @@ +-------------------------------------- +-- >= 12 +-------------------------------------- + +INSERT INTO &v_int_schema_tab. (TYPE,NAME) +SELECT DISTINCT 'U',USERNAME +FROM CDB_USERS +WHERE ORACLE_MAINTAINED = 'Y' +UNION ALL +SELECT DISTINCT 'R',ROLE +FROM CDB_ROLES +WHERE ORACLE_MAINTAINED = 'Y' +UNION ALL +SELECT 'X','PUBLIC' +FROM DUAL; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/load_code.sql b/user_scripts_old/odbfcl/extract.2024Dez/load_code.sql new file mode 100644 index 0000000..2e1eecf --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/load_code.sql @@ -0,0 +1,52 @@ +WHENEVER SQLERROR EXIT SQL.SQLCODE + +-- TODO: CHANGE 2 QUERIES FOR 1 USING "INSERT ALL" + +insert /*+ append */ + into &v_username..DM_CODES (MD5_HASH, CODE) +select MD5_HASH, + CODE +from ( + select MD5_HASH, + CODE, + RANK() over (partition by MD5_HASH order by rowid asc) col_ind + from &v_username..T_HASH_LOAD +) +where col_ind=1 and '&v_internal' = 'false'; + +DECLARE + V_SQL VARCHAR2(32767); -- 10.2 does not support CLOB for EXECUTE IMMEDIATE +BEGIN + IF '&v_internal' = 'true' + THEN + V_SQL := 'DROP TABLE &v_username.."DM_CODES" PURGE'; + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + END IF; +END; +/ + +insert /*+ append */ + into &v_username..T_HASH (OWNER, NAME, TYPE, ORIGIN_CON_ID, CON_ID, MD5_HASH, SHA1_HASH) +select OWNER, + NAME, + TYPE, + ORIGIN_CON_ID, + CON_ID, + MD5_HASH, + SHA1_HASH +from &v_username..T_HASH_LOAD; + +commit; + +drop table &v_username..T_HASH_LOAD purge; + +-- REMOVE_IF_ZIP_AFTER + +-- This is no longer enabled after wrapper moved to PL/SQL + +-- BEGIN - Added to avoid "Java not installed" errors. +-- WHENEVER SQLERROR CONTINUE +-- @@unwrap_code.sql +-- WHENEVER SQLERROR EXIT SQL.SQLCODE +-- END - Added to avoid "Java not installed" errors. \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/load_custom.sql b/user_scripts_old/odbfcl/extract.2024Dez/load_custom.sql new file mode 100644 index 0000000..71ee862 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/load_custom.sql @@ -0,0 +1,130 @@ +DECLARE + V_VERS_1D NUMBER := '&P_VERS_1D.'; + V_VERS_4D VARCHAR2(20) := '&P_VERS_4D.'; + V_USER VARCHAR2(30) := '&&V_USERNAME.'; + + PROCEDURE RUN_INSERT (P_TGT_TABLE VARCHAR2, + P_SRC_TABLE VARCHAR2, + P_WHERE_CLAUSE_12 VARCHAR2 DEFAULT NULL, + P_WHERE_CLAUSE_11 VARCHAR2 DEFAULT NULL, + P_WHERE_INT_FILTER VARCHAR2 DEFAULT NULL) + AS + V_TAB_COLS VARCHAR2(32767); + V_INS_COLS VARCHAR2(32767); + V_SQL VARCHAR2(32767); -- 10.2 does not support CLOB for EXECUTE IMMEDIATE + V_OBJ_EXISTS NUMBER; + V_CDB_CLAUSE VARCHAR2(30); + V_WHERE_ADDED BOOLEAN := FALSE; + + PROCEDURE ADD_WHERE IS + BEGIN + IF NOT V_WHERE_ADDED + THEN + V_SQL := V_SQL || ' WHERE '; + V_WHERE_ADDED := TRUE; + ELSE + V_SQL := V_SQL || ' AND '; + END IF; + END ADD_WHERE; + + BEGIN + + IF V_VERS_1D <= 11 THEN + V_CDB_CLAUSE := ''; + else + V_CDB_CLAUSE := ', CON_ID'; + END IF; + + -- Bug 22168436 ORA-600 [kkdoilsn2] on select from CONTAINERS(...) - Using BLOB / ANYDATA / XMLTYPE. + + $IF DBMS_DB_VERSION.VER_LE_10_2 + $THEN + select wm_concat(c1_column_name), + wm_concat(c2_column_name) + $ELSIF DBMS_DB_VERSION.VER_LE_11_1 + $THEN + select wm_concat(c1_column_name), + wm_concat(c2_column_name) + $ELSE + select listagg(c1_column_name,', ') within group(order by column_id), + listagg(c2_column_name,', ') within group(order by column_id) + $END + into v_tab_cols, v_ins_cols + from ( + select c1.column_name c1_column_name, + nvl(c2.column_name,'NULL') c2_column_name, + c1.column_id + from dba_tab_columns c1, dba_tab_columns c2 + where c1.table_name = P_TGT_TABLE + and c2.table_name (+) = P_SRC_TABLE + and c1.owner = V_USER + and c2.owner(+) = 'SYS' + and c1.column_name = c2.column_name (+) + and c1.column_name not in ('CON_ID') + order by c1.column_id + ); + + V_SQL := 'INSERT /*+ APPEND */ INTO ' || V_USER || '.' || P_TGT_TABLE || '(' || V_TAB_COLS || V_CDB_CLAUSE || ') SELECT '; + + V_SQL := V_SQL || V_INS_COLS || V_CDB_CLAUSE; + + IF V_VERS_1D <= 11 THEN + V_SQL := V_SQL || ' FROM ' || P_SRC_TABLE; + ELSIF V_VERS_4D = '12.1.0.1' THEN + V_SQL := V_SQL || ' FROM CDB$VIEW("' || P_SRC_TABLE || '")'; + ELSE + V_SQL := V_SQL || ' FROM CONTAINERS(' || P_SRC_TABLE || ')'; + END IF; + + IF V_VERS_1D <= 11 THEN + IF P_WHERE_CLAUSE_11 IS NOT NULL THEN + ADD_WHERE; + V_SQL := V_SQL || '( ' || P_WHERE_CLAUSE_11 || ' )'; + END IF; + ELSE + IF P_WHERE_CLAUSE_12 IS NOT NULL THEN + ADD_WHERE; + V_SQL := V_SQL || '( ' || P_WHERE_CLAUSE_12 || ' )'; + END IF; + END IF; + + IF '&v_internal' = 'true' AND P_WHERE_INT_FILTER IS NOT NULL THEN + ADD_WHERE; + V_SQL := V_SQL || '( ' || P_WHERE_INT_FILTER || ' )'; + END IF; + + SELECT COUNT(1) + INTO V_OBJ_EXISTS + FROM DBA_OBJECTS V1 + WHERE V1.OWNER = 'SYS' + AND V1.OBJECT_NAME = P_SRC_TABLE + AND OBJECT_TYPE IN ('TABLE','VIEW'); + + DBMS_OUTPUT.PUT_LINE('----------'); + IF V_OBJ_EXISTS = 1 + THEN + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + ELSE + DBMS_OUTPUT.PUT_LINE(P_SRC_TABLE || ' does not exist.'); + V_SQL := 'DROP TABLE ' || V_USER || '.' || P_TGT_TABLE || ' PURGE'; + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + END IF; + + END; +BEGIN + DBMS_OUTPUT.ENABLE(NULL); + + RUN_INSERT ('T_AUDIT_UNIFIED_POLICIES', + 'AUDIT_UNIFIED_POLICIES', + NULL, + NULL, + q'[OBJECT_SCHEMA = 'NONE' OR OBJECT_SCHEMA IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + RUN_INSERT ('T_AUD_UNIFIED_ENABLED_POLICIES','AUDIT_UNIFIED_ENABLED_POLICIES'); + RUN_INSERT ('T_AUD_UNIFIED_POLICY_COMMENTS','AUDIT_UNIFIED_POLICY_COMMENTS'); + RUN_INSERT ('T_OPTSTAT_HIST_CONTROL','OPTSTAT_HIST_CONTROL$'); + +END; +/ \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/load_database_vault.sql b/user_scripts_old/odbfcl/extract.2024Dez/load_database_vault.sql new file mode 100644 index 0000000..ee8eead --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/load_database_vault.sql @@ -0,0 +1,75 @@ +DECLARE + V_VERS_1D NUMBER := '&P_VERS_1D.'; + V_VERS_4D VARCHAR2(20) := '&P_VERS_4D.'; + V_USER VARCHAR2(30) := '&v_username.'; + + PROCEDURE RUN_INSERT (IN_TAB_NAME VARCHAR2, + OUT_TAB_NAME VARCHAR2) + AS + V_TAB_COLS CLOB; + V_INS_COLS CLOB; + V_SQL CLOB; + V_CDB_CLAUSE VARCHAR2(30); + BEGIN + + IF V_VERS_1D <= 11 THEN + V_CDB_CLAUSE := ''; + else + V_CDB_CLAUSE := ', CON_ID'; + END IF; + + $IF DBMS_DB_VERSION.VER_LE_10_2 + $THEN + select wm_concat(c1_column_name), + wm_concat(c2_column_name) + $ELSIF DBMS_DB_VERSION.VER_LE_11_1 + $THEN + select wm_concat(c1_column_name), + wm_concat(c2_column_name) + $ELSE + select listagg(c1_column_name,', ') within group(order by column_id), + listagg(c2_column_name,', ') within group(order by column_id) + $END + into v_tab_cols, v_ins_cols + from ( + select c1.column_name c1_column_name, + nvl(c2.column_name,'NULL') c2_column_name, + c1.column_id + from dba_tab_columns c1, dba_tab_columns c2 + where c1.table_name = OUT_TAB_NAME + and c2.table_name (+) = IN_TAB_NAME + and c1.owner = V_USER + and c2.owner(+) = 'DVSYS' + and c1.column_name = c2.column_name (+) + and c1.column_name not in ('CON_ID') + order by c1.column_id + ); + + V_SQL := 'INSERT /*+ APPEND */ INTO ' || V_USER || '.' || OUT_TAB_NAME || '(' || V_TAB_COLS || V_CDB_CLAUSE || ') SELECT '; + + V_SQL := V_SQL || V_INS_COLS || V_CDB_CLAUSE; + + IF V_VERS_1D <= 11 THEN + V_SQL := V_SQL || ' FROM DVSYS.' || IN_TAB_NAME; + ELSIF V_VERS_4D = '12.1.0.1' THEN + V_SQL := V_SQL || ' FROM CDB$VIEW("DVSYS"."' || IN_TAB_NAME || '")'; + ELSE + V_SQL := V_SQL || ' FROM CONTAINERS(DVSYS.' || IN_TAB_NAME || ')'; + END IF; + + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + + END; +BEGIN + DBMS_OUTPUT.ENABLE(NULL); + + RUN_INSERT ('DBA_DV_COMMAND_RULE','T_DV_COMMAND_RULE'); + RUN_INSERT ('DBA_DV_REALM','T_DV_REALM'); + RUN_INSERT ('DBA_DV_REALM_AUTH','T_DV_REALM_AUTH'); + RUN_INSERT ('DBA_DV_REALM_OBJECT','T_DV_REALM_OBJECT'); + RUN_INSERT ('DBA_DV_RULE','T_DV_RULE'); + RUN_INSERT ('DBA_DV_RULE_SET','T_DV_RULE_SET'); + +END; +/ \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/load_dba_cdb.sql b/user_scripts_old/odbfcl/extract.2024Dez/load_dba_cdb.sql new file mode 100644 index 0000000..d980aa9 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/load_dba_cdb.sql @@ -0,0 +1,284 @@ +DECLARE + V_VERS_1D NUMBER := '&&P_VERS_1D.'; + V_USER VARCHAR2(30) := '&&V_USERNAME.'; + + PROCEDURE RUN_INSERT (P_OBJ_SUFFIX VARCHAR2, + P_WHERE_CLAUSE_12 VARCHAR2 DEFAULT NULL, + P_WHERE_CLAUSE_11 VARCHAR2 DEFAULT NULL, + P_WHERE_INT_FILTER VARCHAR2 DEFAULT NULL) + AS + V_TAB_COLS VARCHAR2(32767); + V_INS_COLS VARCHAR2(32767); + V_SQL VARCHAR2(32767); -- 10.2 does not support CLOB for EXECUTE IMMEDIATE + V_OBJ_EXISTS NUMBER; + V_WHERE_ADDED BOOLEAN := FALSE; + V_SRC_OBJECT VARCHAR2(100); + V_TGT_TABLE VARCHAR2(100) := 'T_' || P_OBJ_SUFFIX; + + PROCEDURE ADD_WHERE IS + BEGIN + IF NOT V_WHERE_ADDED + THEN + V_SQL := V_SQL || ' WHERE '; + V_WHERE_ADDED := TRUE; + ELSE + V_SQL := V_SQL || ' AND '; + END IF; + END ADD_WHERE; + + BEGIN + IF V_VERS_1D <= 11 THEN + V_SRC_OBJECT := 'DBA_' || P_OBJ_SUFFIX; + else + V_SRC_OBJECT := 'CDB_' || P_OBJ_SUFFIX; + END IF; + + SELECT COUNT(1) + INTO V_OBJ_EXISTS + FROM DBA_VIEWS V1 + WHERE V1.OWNER = 'SYS' + AND V1.VIEW_NAME = V_SRC_OBJECT; + + -- ORA-12805: parallel query server died unexpectedly + -- ORA-00600: internal error code, arguments: [kkdlGetBaseUser2:authIdType], [0], [104], [_NEXT_USER], [], [], [], [], [], [], [], [] + -- Bug 22168436 ORA-600 [kkdoilsn2] on select from CONTAINERS(...) - Using BLOB / ANYDATA / XMLTYPE. + + $IF DBMS_DB_VERSION.VER_LE_10_2 + $THEN + select wm_concat(c1_column_name), + wm_concat(c2_column_name) + $ELSIF DBMS_DB_VERSION.VER_LE_11_1 + $THEN + select wm_concat(c1_column_name), + wm_concat(c2_column_name) + $ELSE + select listagg(c1_column_name,', ') within group(order by column_id), + listagg(c2_column_name,', ') within group(order by column_id) + $END + into v_tab_cols, v_ins_cols + from ( + select c1.column_name c1_column_name, + nvl(c2.column_name,'NULL') c2_column_name, + c1.column_id + from dba_tab_columns c1, dba_tab_columns c2 + where c1.owner = v_user + and c1.table_name = V_TGT_TABLE + and c2.owner(+) = 'SYS' + and c2.table_name (+) = V_SRC_OBJECT + and c1.column_name = c2.column_name (+) + order by c1.column_id + ); + + V_SQL := 'INSERT /*+ APPEND */ INTO ' || V_USER || '.' || V_TGT_TABLE || '(' || V_TAB_COLS || ') SELECT '; + + V_SQL := V_SQL || V_INS_COLS; + + V_SQL := V_SQL || ' FROM ' || V_SRC_OBJECT; + + IF V_VERS_1D <= 11 THEN + IF P_WHERE_CLAUSE_11 IS NOT NULL THEN + ADD_WHERE; + V_SQL := V_SQL || '( ' || P_WHERE_CLAUSE_11 || ' )'; + END IF; + else + IF P_WHERE_CLAUSE_12 IS NOT NULL THEN + ADD_WHERE; + V_SQL := V_SQL || '( ' || P_WHERE_CLAUSE_12 || ' )'; + END IF; + END IF; + + IF '&v_internal' = 'true' AND P_WHERE_INT_FILTER IS NOT NULL THEN + ADD_WHERE; + V_SQL := V_SQL || '( ' || P_WHERE_INT_FILTER || ' )'; + END IF; + + DBMS_OUTPUT.PUT_LINE('----------'); + IF V_OBJ_EXISTS = 1 + THEN + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + ELSE + DBMS_OUTPUT.PUT_LINE(V_SRC_OBJECT || ' does not exist.'); + V_SQL := 'DROP TABLE ' || V_USER || '.' || V_TGT_TABLE || ' PURGE'; + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + END IF; + + END; +BEGIN + DBMS_OUTPUT.ENABLE(NULL); + + RUN_INSERT ('TAB_PRIVS', + q'[GRANTEE != '&&V_USERNAME.' + AND NOT(TABLE_NAME LIKE '&&V_USERNAME.' AND PRIVILEGE='INHERIT PRIVILEGES')]', + q'[GRANTEE != '&&V_USERNAME.']', + q'[GRANTEE IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('U','R','X')) + AND OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') + AND NOT (PRIVILEGE = 'INHERIT PRIVILEGES' AND TABLE_NAME NOT IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('U','X')))]' + ); + + RUN_INSERT ('COL_PRIVS', + q'[GRANTEE != '&&V_USERNAME.']', + q'[GRANTEE != '&&V_USERNAME.']', + q'[GRANTEE IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('U','R','X')) + AND OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('SYS_PRIVS', + q'[GRANTEE != '&&V_USERNAME.']', + q'[GRANTEE != '&&V_USERNAME.']', + q'[GRANTEE IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('U','R','X'))]' + ); + + RUN_INSERT ('ROLE_PRIVS', + q'[GRANTEE != '&&V_USERNAME.']', + q'[GRANTEE != '&&V_USERNAME.']', + q'[GRANTEE IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('U','R','X')) + AND GRANTED_ROLE IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('R','X'))]' + ); + + RUN_INSERT ('JAVA_POLICY', + NULL, + NULL, + q'[GRANTEE IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('U','R','X')) + AND TYPE_SCHEMA IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('JOBS', + NULL, + NULL, + q'[SCHEMA_USER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('TS_QUOTAS', + q'[USERNAME != '&&V_USERNAME.']', + q'[USERNAME != '&&V_USERNAME.']', + q'[USERNAME IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('POLICIES', + NULL, + NULL, + q'[OBJECT_OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('TRIGGERS', + NULL, + NULL, + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('SCHEDULER_JOBS', + NULL, + NULL, + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('SCHEDULER_PROGRAMS', + NULL, + NULL, + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('OBJ_AUDIT_OPTS', + NULL, + NULL, + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('STMT_AUDIT_OPTS', + NULL, + NULL, + q'[USER_NAME IS NULL OR USER_NAME IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('PRIV_AUDIT_OPTS', + NULL, + NULL, + q'[USER_NAME IS NULL OR USER_NAME IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('AUDIT_POLICIES', + NULL, + NULL, + q'[OBJECT_SCHEMA IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') + &skip_ver_le_10_s. + AND POLICY_OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') + &skip_ver_le_10_e.]' + ); + + RUN_INSERT ('AUDIT_POLICY_COLUMNS', + NULL, + NULL, + q'[OBJECT_SCHEMA IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('DIRECTORIES', + q'[DIRECTORY_NAME != '&&V_DIRECTORY.']', + q'[DIRECTORY_NAME != '&&V_DIRECTORY.']', + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('PROCEDURES', + NULL, + NULL, + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('SYNONYMS', + q'[ORIGIN_CON_ID=CON_ID]', + NULL, + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('U','X')) + AND ( + TABLE_OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') OR + (TABLE_OWNER = 'DVSYS' AND '&&P_VERS_4D.' = '11.2.0.4') OR + (TABLE_OWNER = 'DBMS_PRIVILEGE_CAPTURE' AND '&&P_VERS_4D.' IN ('12.1.0.1','12.1.0.2')) + )]' + ); + + RUN_INSERT ('USERS', + q'[USERNAME != '&&V_USERNAME.']', + q'[USERNAME != '&&V_USERNAME.']', + q'[USERNAME IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('ROLES', + NULL, + NULL, + q'[ROLE IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'R')]' + ); + + RUN_INSERT ('PROFILES', + NULL, + NULL, + q'[PROFILE IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'P')]' + ); + + RUN_INSERT ('OBJECTS', + q'[OWNER != '&&V_USERNAME.' AND NOT (OWNER='SYS' AND OBJECT_NAME='&&V_DIRECTORY.' AND OBJECT_TYPE='DIRECTORY')]', + q'[OWNER != '&&V_USERNAME.' AND NOT (OWNER='SYS' AND OBJECT_NAME='&&V_DIRECTORY.' AND OBJECT_TYPE='DIRECTORY')]', + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE IN ('U','X'))]' + ); + + RUN_INSERT ('TAB_COLUMNS', + q'[OWNER != '&&V_USERNAME.']', + q'[OWNER != '&&V_USERNAME.']', + q'[OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U')]' + ); + + RUN_INSERT ('REGISTRY'); + RUN_INSERT ('REGISTRY_BACKPORTS'); + RUN_INSERT ('REGISTRY_DATABASE'); + RUN_INSERT ('REGISTRY_DEPENDENCIES'); + RUN_INSERT ('REGISTRY_ERROR'); + RUN_INSERT ('REGISTRY_HIERARCHY'); + RUN_INSERT ('REGISTRY_HISTORY'); + RUN_INSERT ('REGISTRY_LOG'); + RUN_INSERT ('REGISTRY_PROGRESS'); + RUN_INSERT ('REGISTRY_SCHEMAS'); + RUN_INSERT ('REGISTRY_SQLPATCH'); + RUN_INSERT ('REGISTRY_SQLPATCH_RU_INFO'); + RUN_INSERT ('SERVER_REGISTRY'); + +END; +/ \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/load_source.sql b/user_scripts_old/odbfcl/extract.2024Dez/load_source.sql new file mode 100644 index 0000000..a407b6a --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/load_source.sql @@ -0,0 +1,46 @@ +DECLARE + VCODE CLOB; + + $IF DBMS_DB_VERSION.VERSION <= 11 + $THEN + CURSOR OBJS IS + SELECT OWNER, + NAME, + TYPE, + NULL ORIGIN_CON_ID, + NULL CON_ID, + LINE, + MAX(LINE) OVER (PARTITION BY OWNER, NAME, TYPE) LAST_LINE, + TEXT + FROM DBA_SOURCE + WHERE (OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') or '&v_internal' = 'false') + ORDER BY OWNER, NAME, TYPE, LINE ASC; + $ELSE + CURSOR OBJS IS + SELECT OWNER, + NAME, + TYPE, + ORIGIN_CON_ID, + CON_ID, + LINE, + MAX(LINE) OVER (PARTITION BY OWNER, NAME, TYPE, ORIGIN_CON_ID, CON_ID) LAST_LINE, + TEXT + FROM CDB_SOURCE + WHERE ORIGIN_CON_ID=CON_ID -- AND CON_ID IN (1,2) + AND (OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') or '&v_internal' = 'false') + ORDER BY OWNER, NAME, TYPE, ORIGIN_CON_ID, CON_ID, LINE ASC; + $END +BEGIN + VCODE := ''; -- Reset var + FOR I IN OBJS + LOOP + VCODE := VCODE || I.TEXT; + IF I.LINE = I.LAST_LINE THEN + INSERT INTO &v_username..T_HASH_LOAD (OWNER, NAME, TYPE, ORIGIN_CON_ID, CON_ID, MD5_HASH, SHA1_HASH, CODE) + VALUES + (I.OWNER, I.NAME, I.TYPE, I.ORIGIN_CON_ID, I.CON_ID, SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_MD5), SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_SH1), VCODE); + VCODE := ''; -- Reset var + END IF; + END LOOP; +END; +/ \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/load_v_dollar.sql b/user_scripts_old/odbfcl/extract.2024Dez/load_v_dollar.sql new file mode 100644 index 0000000..2318da0 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/load_v_dollar.sql @@ -0,0 +1,127 @@ +DECLARE + V_VERS_1D NUMBER := '&P_VERS_1D.'; + V_USER VARCHAR2(30) := '&&V_USERNAME.'; + + PROCEDURE RUN_INSERT (P_TGT_TABLE VARCHAR2, + P_SRC_TABLE VARCHAR2, + P_WHERE_CLAUSE_12 VARCHAR2 DEFAULT NULL, + P_WHERE_CLAUSE_11 VARCHAR2 DEFAULT NULL) + AS + V_TAB_COLS VARCHAR2(32767); + V_INS_COLS VARCHAR2(32767); + V_SQL VARCHAR2(32767); -- 10.2 does not support CLOB for EXECUTE IMMEDIATE + V_OBJ_EXISTS NUMBER; + BEGIN + + SELECT COUNT(1) + INTO V_OBJ_EXISTS + FROM DBA_OBJECTS V1 + WHERE V1.OWNER = 'SYS' + AND V1.OBJECT_NAME = P_SRC_TABLE; + + $IF DBMS_DB_VERSION.VER_LE_10_2 + $THEN + select wm_concat(c1_column_name), + wm_concat(c2_column_name) + $ELSIF DBMS_DB_VERSION.VER_LE_11_1 + $THEN + select wm_concat(c1_column_name), + wm_concat(c2_column_name) + $ELSE + select listagg(c1_column_name,', ') within group(order by column_id), + listagg(c2_column_name,', ') within group(order by column_id) + $END + into v_tab_cols, v_ins_cols + from ( + select c1.column_name c1_column_name, + nvl(c2.column_name,'NULL') c2_column_name, + c1.column_id + from dba_tab_columns c1, dba_tab_columns c2 + where c1.owner = V_USER + and c1.table_name = P_TGT_TABLE + and c2.owner(+) = 'SYS' + and c2.table_name (+) = P_SRC_TABLE + and c1.column_name = c2.column_name (+) + order by c1.column_id + ); + + V_SQL := 'INSERT /*+ APPEND */ INTO ' || V_USER || '.' || P_TGT_TABLE || '(' || V_TAB_COLS || ') SELECT '; + + V_SQL := V_SQL || V_INS_COLS; + + V_SQL := V_SQL || ' FROM ' || P_SRC_TABLE; + + IF V_VERS_1D <= 11 THEN + IF P_WHERE_CLAUSE_11 IS NOT NULL THEN + V_SQL := V_SQL || ' WHERE ' || P_WHERE_CLAUSE_11; + END IF; + else + IF P_WHERE_CLAUSE_12 IS NOT NULL THEN + V_SQL := V_SQL || ' WHERE ' || P_WHERE_CLAUSE_12; + END IF; + END IF; + + DBMS_OUTPUT.PUT_LINE('----------'); + IF V_OBJ_EXISTS = 1 + THEN + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + ELSE + DBMS_OUTPUT.PUT_LINE(P_SRC_TABLE || ' does not exist.'); + V_SQL := 'DROP TABLE ' || V_USER || '.' || P_TGT_TABLE || ' PURGE'; + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + END IF; + + END; +BEGIN + DBMS_OUTPUT.ENABLE(NULL); + + RUN_INSERT ('T_FIXED_TABLE','V_$FIXED_TABLE'); + + RUN_INSERT ('T_FIXED_VIEW_DEFINITION','V_$FIXED_VIEW_DEFINITION'); + + RUN_INSERT ('T_SYSSTAT','V_$SYSSTAT'); + + RUN_INSERT ('T_SYS_TIME_MODEL','V_$SYS_TIME_MODEL'); + + RUN_INSERT ('T_EVENT_NAME','V_$EVENT_NAME'); + +-- Those 2 tables will be loaded from X$ to include hidden parameters + +-- RUN_INSERT ('T_PARAMETER','V_$PARAMETER'); +-- RUN_INSERT ('T_PARAMETER_VALID_VALUES','V_$PARAMETER_VALID_VALUES'); + + RUN_INSERT ('T_RESERVED_WORDS','V_$RESERVED_WORDS'); + + RUN_INSERT ('T_SYSTEM_FIX_CONTROL','V_$SYSTEM_FIX_CONTROL'); + + RUN_INSERT ('T_OBSOLETE_PARAMETER','V_$OBSOLETE_PARAMETER'); + + RUN_INSERT ('T_SQL_HINT','V_$SQL_HINT'); + +END; +/ + +commit; + +-- Get Fixed View Definition full code + +DECLARE + l_clob CLOB; +BEGIN + $IF DBMS_DB_VERSION.VERSION >= 12 + $THEN + FOR I IN (select view_name from v_$fixed_view_definition t1 where length(t1.view_definition)=4000) + LOOP + DBMS_UTILITY.expand_sql_text ( + input_sql_text => 'select * from ' || i.view_name, + output_sql_text => l_clob + ); + update &v_username..t_fixed_view_definition t1 set t1.view_definition_clob=l_clob where t1.view_name=i.view_name; + END LOOP; + $ELSE + NULL; + $END +END; +/ diff --git a/user_scripts_old/odbfcl/extract.2024Dez/load_view.sql b/user_scripts_old/odbfcl/extract.2024Dez/load_view.sql new file mode 100644 index 0000000..7b8ad94 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/load_view.sql @@ -0,0 +1,95 @@ +DECLARE + VCODE CLOB; + + CURSOR OBJS IS + SELECT OWNER, ROWID, CODE + FROM &v_username..T_HASH_LOAD + WHERE TYPE = 'VIEW'; + + FUNCTION replaceClob + ( srcClob IN CLOB, + replaceStr IN varchar2, + replaceWith IN varchar2 ) + RETURN CLOB + IS + l_buffer VARCHAR2 (32767); + l_amount BINARY_INTEGER := 32767; + l_pos INTEGER := 1; + l_clob_len INTEGER; + newClob clob := EMPTY_CLOB; + BEGIN + -- initalize the new clob + dbms_lob.CreateTemporary( newClob, TRUE ); + l_clob_len := DBMS_LOB.getlength (srcClob); + WHILE l_pos <= l_clob_len + LOOP + DBMS_LOB.READ (srcClob,l_amount,l_pos,l_buffer); + IF l_buffer IS NOT NULL + THEN + -- replace the text + l_buffer := regexp_replace(l_buffer,replaceStr,replaceWith); + -- write it to the new clob + DBMS_LOB.writeAppend(newClob, LENGTH(l_buffer), l_buffer); + END IF; + l_pos := l_pos + l_amount; + END LOOP; + RETURN newClob; + END replaceClob; +BEGIN + + $IF DBMS_DB_VERSION.VERSION <= 11 + $THEN + INSERT INTO &v_username..T_HASH_LOAD (OWNER, NAME, TYPE, CON_ID, ORIGIN_CON_ID, CODE, MD5_HASH, SHA1_HASH) + SELECT OWNER, + VIEW_NAME, + 'VIEW', + NULL CON_ID, + NULL ORIGIN_CON_ID, + TO_LOB(TEXT), + '0', + '0' + FROM DBA_VIEWS + WHERE (OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') or '&v_internal' = 'false'); + $ELSE + INSERT INTO &v_username..T_HASH_LOAD (OWNER, NAME, TYPE, CON_ID, ORIGIN_CON_ID, CODE, MD5_HASH, SHA1_HASH) + SELECT OWNER, + VIEW_NAME, + 'VIEW', + SYS_CONTEXT('USERENV','CON_ID') CON_ID, + ORIGIN_CON_ID, + TO_LOB(TEXT), + '0', + '0' + FROM DBA_VIEWS + WHERE (OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') or '&v_internal' = 'false'); + + INSERT INTO &v_username..T_HASH_LOAD (OWNER, NAME, TYPE, CON_ID, ORIGIN_CON_ID, CODE, MD5_HASH, SHA1_HASH) + SELECT OWNER, + VIEW_NAME, + 'VIEW', + CON_ID, + ORIGIN_CON_ID, + TEXT_VC, + '0', + '0' + FROM CDB_VIEWS + WHERE CON_ID <> SYS_CONTEXT('USERENV','CON_ID') -- AND CON_ID IN (1,2) + AND ORIGIN_CON_ID = CON_ID + AND (OWNER IN (SELECT NAME FROM &v_int_schema_tab. WHERE TYPE = 'U') or '&v_internal' = 'false'); + $END + + FOR I IN OBJS + LOOP + + VCODE := UPPER(I.CODE); + VCODE := replaceClob(VCODE,'[[:space:]]*',''); -- Remove all space characters + VCODE := replaceClob(VCODE,'"',''); -- Remove all quotes + UPDATE &v_username..T_HASH_LOAD + SET MD5_HASH = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_MD5), + SHA1_HASH = SYS.DBMS_CRYPTO.HASH(VCODE, SYS.DBMS_CRYPTO.HASH_SH1) + WHERE ROWID = I.ROWID; + + END LOOP; + +END; +/ \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/load_x_dollar.sql b/user_scripts_old/odbfcl/extract.2024Dez/load_x_dollar.sql new file mode 100644 index 0000000..8f39ab3 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/load_x_dollar.sql @@ -0,0 +1,45 @@ +@@underscore_parameters/load_underscore_&P_VERS_4D..sql + +-- + +@@underscore_valid_values/load_underscore_vv_&P_VERS_4D..sql + +-- + +-- There is a bug since oracle 11.2 which is that starting from x$kqfta.nkqftanam=x$ksxptesttbl, +-- The field x$kqfco.kqfcotab should be subtracted by one to get the correct columns. +-- Thanks David Kurtz and Frits Hoogland + +-- Issue started with 11.2 and was fixed on 23c - 30492260 + +INSERT INTO &v_username..T_XTABCOLS +( + "TABLE_NAME", + "COLUMN_NAME", + "COLUMN_TYPE" +) +select t.kqftanam table_name, + c.kqfconam column_name, + c.kqfcodty column_type +from x$kqfta t, x$kqfco c, x$kqfta divider +where divider.kqftanam = 'X$KSXPTESTTBL' +and t.indx < divider.indx +and t.indx = c.kqfcotab +and &P_VERS_1D. between 11 and 21 +union all +select t.kqftanam table_name, + c.kqfconam column_name, + c.kqfcodty column_type +from x$kqfta t, x$kqfco c, x$kqfta divider +where divider.kqftanam = 'X$KSXPTESTTBL' +and t.indx >= divider.indx +and t.indx = c.kqfcotab-1 +and &P_VERS_1D. between 11 and 21 +union all +-- Version < 11.2 or Version >= 23 +select t.kqftanam table_name, + c.kqfconam column_name, + c.kqfcodty column_type +from x$kqfta t, x$kqfco c +where t.indx = c.kqfcotab +and (not exists (select 1 from x$kqfta divider where divider.kqftanam = 'X$KSXPTESTTBL') or &P_VERS_1D. < 11 or &P_VERS_1D. > 21); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/tables_drop.sql b/user_scripts_old/odbfcl/extract.2024Dez/tables_drop.sql new file mode 100644 index 0000000..5d53be9 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/tables_drop.sql @@ -0,0 +1,21 @@ +-- drop table for internal objects +@@internal_schemas/int_resources_drop.sql + +-- drop non-loaded tables when internal mode is used +DECLARE + TYPE V_STR_LIST IS TABLE OF VARCHAR2(30); + V_LIST V_STR_LIST; + V_SQL VARCHAR2(32767); -- 10.2 does not support CLOB for EXECUTE IMMEDIATE +BEGIN + V_LIST := V_STR_LIST('DM_CONTENTS', 'T_TXTCOLLECTION', 'T_SYMBOLS'); + IF '&v_internal' = 'true' + THEN + FOR I IN V_LIST.FIRST .. V_LIST.LAST + LOOP + V_SQL := 'DROP TABLE &v_username..' || V_LIST(I) || ' PURGE'; + DBMS_OUTPUT.PUT_LINE(V_SQL || ';'); + EXECUTE IMMEDIATE V_SQL; + END LOOP; + END IF; +END; +/ \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.1.sql new file mode 100644 index 0000000..b69b3c0 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.1.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.1 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.2.sql new file mode 100644 index 0000000..55212f0 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.2.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.2 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.3.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.3.sql new file mode 100644 index 0000000..d1f226d --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.3.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.3 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.4.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.4.sql new file mode 100644 index 0000000..6d05d59 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.4.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.4 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.5.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.5.sql new file mode 100644 index 0000000..241532d --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_10.2.0.5.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.5 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.1.0.6.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.1.0.6.sql new file mode 100644 index 0000000..397437c --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.1.0.6.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.1.0.6 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.1.0.7.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.1.0.7.sql new file mode 100644 index 0000000..a290f05 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.1.0.7.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.1.0.7 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.1.sql new file mode 100644 index 0000000..0653470 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.1.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.2.0.1 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.2.sql new file mode 100644 index 0000000..b621589 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.2.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.2.0.2 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.3.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.3.sql new file mode 100644 index 0000000..0b0672d --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.3.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.2.0.3 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.4.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.4.sql new file mode 100644 index 0000000..05db86f --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_11.2.0.4.sql @@ -0,0 +1,66 @@ +-------------------------------------- +-- 11.2.0.4 +-------------------------------------- + +DELETE FROM &v_username..T_PARAMETER; + +INSERT INTO &v_username..T_PARAMETER +( + "NAME", + "TYPE", + "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +) +WITH T1 AS ( +SELECT + x.inst_id, + x.indx + 1 num, + ksppinm name, + ksppity type, + ksppstvl value, + ksppstdvl display_value, + ksppstdf isdefault, + decode(bitand(ksppiflg / 256, 1), 1, 'TRUE', 'FALSE') isses_modifiable, + decode(bitand(ksppiflg / 65536, 3), 1, 'IMMEDIATE', 2, 'DEFERRED', + 3, 'IMMEDIATE', 'FALSE') issys_modifiable, + decode(bitand(ksppiflg, 4), 4, 'FALSE', decode(bitand(ksppiflg / 65536, 3), 0, 'FALSE', 'TRUE')) isinstance_modifiable, + decode(bitand(ksppstvf, 7), 1, 'MODIFIED', 4, 'SYSTEM_MOD', + 'FALSE') ismodified, + decode(bitand(ksppstvf, 2), 2, 'TRUE', 'FALSE') isadjusted, + decode(bitand(ksppilrmflg / 64, 1), 1, 'TRUE', 'FALSE') isdeprecated, + decode(bitand(ksppilrmflg / 268435456, 1), 1, 'TRUE', 'FALSE') isbasic, + ksppdesc description, + ksppstcmnt update_comment, + ksppihash hash +FROM + x$ksppi x, + x$ksppcv y +WHERE + ( x.indx = y.indx ) +-- AND NOT ( +-- bitand(ksppiflg, 268435456) = 0 +-- AND ( ( translate(ksppinm, '_', '#') NOT LIKE '##%' ) +-- AND ( ( translate(ksppinm, '_', '#') NOT LIKE '#%' ) +-- OR ( ksppstdf = 'FALSE' ) +-- OR ( bitand(ksppstvf, 5) > 0 ) ) ) +-- ) +) +SELECT "NAME", + "TYPE", + DECODE("ISDEFAULT",'TRUE',"VALUE",NULL) "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + NULL "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + NULL "CON_ID" +FROM T1; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.1.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.1.0.1.sql new file mode 100644 index 0000000..f36ae68 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.1.0.1.sql @@ -0,0 +1,66 @@ +-------------------------------------- +-- 12.1.0.1 +-------------------------------------- + +INSERT INTO &v_username..T_PARAMETER +( + "NAME", + "TYPE", + "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +) +WITH T1 AS ( +SELECT + x.inst_id, + x.indx + 1 num, + ksppinm name, + ksppity type, + ksppstvl value, + ksppstdvl display_value, + ksppstdf isdefault, + decode(bitand(ksppiflg / 256, 1), 1, 'TRUE', 'FALSE') isses_modifiable, + decode(bitand(ksppiflg / 65536, 3), 1, 'IMMEDIATE', 2, 'DEFERRED', + 3, 'IMMEDIATE', 'FALSE') issys_modifiable, + decode(bitand(ksppiflg / 524288, 1), 1, 'TRUE', 'FALSE') ispdb_modifiable, + decode(bitand(ksppiflg, 4), 4, 'FALSE', decode(bitand(ksppiflg / 65536, 3), 0, 'FALSE', 'TRUE')) isinstance_modifiable, + decode(bitand(ksppstvf, 7), 1, 'MODIFIED', 4, 'SYSTEM_MOD', + 'FALSE') ismodified, + decode(bitand(ksppstvf, 2), 2, 'TRUE', 'FALSE') isadjusted, + decode(bitand(ksppilrmflg / 64, 1), 1, 'TRUE', 'FALSE') isdeprecated, + decode(bitand(ksppilrmflg / 268435456, 1), 1, 'TRUE', 'FALSE') isbasic, + ksppdesc description, + ksppstcmnt update_comment, + ksppihash hash, + x.con_id +FROM + x$ksppi x, + x$ksppcv y +WHERE + ( x.indx = y.indx ) +-- AND NOT ( +-- bitand(ksppiflg, 268435456) = 0 +-- AND ( ( translate(ksppinm, '_', '#') NOT LIKE '##%' ) +-- AND ( ( translate(ksppinm, '_', '#') NOT LIKE '#%' ) +-- OR ( ksppstdf = 'FALSE' ) +-- OR ( bitand(ksppstvf, 5) > 0 ) ) ) +-- ) +) +SELECT "NAME", + "TYPE", + DECODE("ISDEFAULT",'TRUE',"VALUE",NULL) "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +FROM T1; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.1.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.1.0.2.sql new file mode 100644 index 0000000..2cc6214 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.1.0.2.sql @@ -0,0 +1,67 @@ +-------------------------------------- +-- 12.1.0.2 +-------------------------------------- + +INSERT INTO &v_username..T_PARAMETER +( + "NAME", + "TYPE", + "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +) +WITH T1 AS ( +SELECT + x.inst_id, + x.indx + 1 num, + ksppinm name, + ksppity type, + ksppstvl value, + ksppstdvl display_value, + ksppstdfl default_value, + ksppstdf isdefault, + decode(bitand(ksppiflg / 256, 1), 1, 'TRUE', 'FALSE') isses_modifiable, + decode(bitand(ksppiflg / 65536, 3), 1, 'IMMEDIATE', 2, 'DEFERRED', + 3, 'IMMEDIATE', 'FALSE') issys_modifiable, + decode(bitand(ksppiflg / 524288, 1), 1, 'TRUE', 'FALSE') ispdb_modifiable, + decode(bitand(ksppiflg, 4), 4, 'FALSE', decode(bitand(ksppiflg / 65536, 3), 0, 'FALSE', 'TRUE')) isinstance_modifiable, + decode(bitand(ksppstvf, 7), 1, 'MODIFIED', 4, 'SYSTEM_MOD', + 'FALSE') ismodified, + decode(bitand(ksppstvf, 2), 2, 'TRUE', 'FALSE') isadjusted, + decode(bitand(ksppilrmflg / 64, 1), 1, 'TRUE', 'FALSE') isdeprecated, + decode(bitand(ksppilrmflg / 268435456, 1), 1, 'TRUE', 'FALSE') isbasic, + ksppdesc description, + ksppstcmnt update_comment, + ksppihash hash, + x.con_id +FROM + x$ksppi x, + x$ksppcv y +WHERE + ( x.indx = y.indx ) +-- AND NOT ( +-- bitand(ksppiflg, 268435456) = 0 +-- AND ( ( translate(ksppinm, '_', '#') NOT LIKE '##%' ) +-- AND ( ( translate(ksppinm, '_', '#') NOT LIKE '#%' ) +-- OR ( ksppstdf = 'FALSE' ) +-- OR ( bitand(ksppstvf, 5) > 0 ) ) ) +-- ) +) +SELECT "NAME", + "TYPE", + "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +FROM T1; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.2.0.1.sql new file mode 100644 index 0000000..0c0d03b --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_12.2.0.1.sql @@ -0,0 +1,67 @@ +-------------------------------------- +-- 12.2.0.1 +-------------------------------------- + +INSERT INTO &v_username..T_PARAMETER +( + "NAME", + "TYPE", + "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +) +WITH T1 AS ( +SELECT + x.inst_id, + x.indx + 1 num, + ksppinm name, + ksppity type, + ksppstvl value, + ksppstdvl display_value, + ksppstdfl default_value, + ksppstdf isdefault, + decode(bitand(ksppiflg / 256, 1), 1, 'TRUE', 'FALSE') isses_modifiable, + decode(bitand(ksppiflg / 65536, 3), 1, 'IMMEDIATE', 2, 'DEFERRED', + 3, 'IMMEDIATE', 'FALSE') issys_modifiable, + decode(bitand(ksppiflg / 524288, 1), 1, 'TRUE', 'FALSE') ispdb_modifiable, + decode(bitand(ksppiflg, 4), 4, 'FALSE', decode(bitand(ksppiflg / 65536, 3), 0, 'FALSE', 'TRUE')) isinstance_modifiable, + decode(bitand(ksppstvf, 7), 1, 'MODIFIED', 4, 'SYSTEM_MOD', + 'FALSE') ismodified, + decode(bitand(ksppstvf, 2), 2, 'TRUE', 'FALSE') isadjusted, + decode(bitand(ksppilrmflg / 64, 1), 1, 'TRUE', 'FALSE') isdeprecated, + decode(bitand(ksppilrmflg / 268435456, 1), 1, 'TRUE', 'FALSE') isbasic, + ksppdesc description, + ksppstcmnt update_comment, + ksppihash hash, + y.con_id +FROM + x$ksppi x, + x$ksppcv y +WHERE + ( x.indx = y.indx ) +-- AND NOT ( +-- bitand(ksppiflg, 268435456) = 0 +-- AND ( ( translate(ksppinm, '_', '$') NOT LIKE '$$%' ) +-- AND ( ( translate(ksppinm, '_', '$') NOT LIKE '$%' ) +-- OR ( ksppstdf = 'FALSE' ) +-- OR ( bitand(ksppstvf, 5) > 0 ) ) ) +-- ) +) +SELECT "NAME", + "TYPE", + "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +FROM T1; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_18.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_18.0.0.0.sql new file mode 100644 index 0000000..eae149e --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_18.0.0.0.sql @@ -0,0 +1,67 @@ +-------------------------------------- +-- 18.0.0.0 +-------------------------------------- + +INSERT INTO &v_username..T_PARAMETER +( + "NAME", + "TYPE", + "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +) +WITH T1 AS ( +SELECT /*+ use_hash(x y) */ + x.inst_id, + x.indx + 1 num, + ksppinm name, + ksppity type, + ksppstvl value, + ksppstdvl display_value, + ksppstdfl default_value, + ksppstdf isdefault, + decode(bitand(ksppiflg / 256, 1), 1, 'TRUE', 'FALSE') isses_modifiable, + decode(bitand(ksppiflg / 65536, 3), 1, 'IMMEDIATE', 2, 'DEFERRED', + 3, 'IMMEDIATE', 'FALSE') issys_modifiable, + decode(bitand(ksppiflg / 524288, 1), 1, 'TRUE', 'FALSE') ispdb_modifiable, + decode(bitand(ksppiflg, 4), 4, 'FALSE', decode(bitand(ksppiflg / 65536, 3), 0, 'FALSE', 'TRUE')) isinstance_modifiable, + decode(bitand(ksppstvf, 7), 1, 'MODIFIED', 4, 'SYSTEM_MOD', + 'FALSE') ismodified, + decode(bitand(ksppstvf, 2), 2, 'TRUE', 'FALSE') isadjusted, + decode(bitand(ksppilrmflg / 64, 1), 1, 'TRUE', 'FALSE') isdeprecated, + decode(bitand(ksppilrmflg / 268435456, 1), 1, 'TRUE', 'FALSE') isbasic, + ksppdesc description, + ksppstcmnt update_comment, + ksppihash hash, + y.con_id +FROM + x$ksppi x, + x$ksppcv y +WHERE + ( x.indx = y.indx ) +-- AND NOT ( +-- bitand(ksppiflg, 268435456) = 0 +-- AND ( ( translate(ksppinm, '_', '$') NOT LIKE '$$%' ) +-- AND ( ( translate(ksppinm, '_', '$') NOT LIKE '$%' ) +-- OR ( ksppstdf = 'FALSE' ) +-- OR ( bitand(ksppstvf, 5) > 0 ) ) ) +-- ) +) +SELECT "NAME", + "TYPE", + "DEFAULT_VALUE", + "ISSES_MODIFIABLE", + "ISSYS_MODIFIABLE", + "ISPDB_MODIFIABLE", + "ISINSTANCE_MODIFIABLE", + "ISDEPRECATED", + "ISBASIC", + "DESCRIPTION", + "CON_ID" +FROM T1; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_19.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_19.0.0.0.sql new file mode 100644 index 0000000..97da1cd --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_19.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 19.0.0.0 +-------------------------------------- + +-- The code is the same as 18c in V$FIXED_VIEW_DEFINITION +@@load_underscore_18.0.0.0.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_21.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_21.0.0.0.sql new file mode 100644 index 0000000..31339b6 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_21.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 21.0.0.0 +-------------------------------------- + +-- The code is the same as 18c in V$FIXED_VIEW_DEFINITION +@@load_underscore_18.0.0.0.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_23.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_23.0.0.0.sql new file mode 100644 index 0000000..e29390f --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_parameters/load_underscore_23.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 23.0.0.0 +-------------------------------------- + +-- The code is the same as 18c in V$FIXED_VIEW_DEFINITION +@@load_underscore_18.0.0.0.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.1.sql new file mode 100644 index 0000000..66dab24 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.1.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.1 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.2.sql new file mode 100644 index 0000000..74ff130 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.2.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.2 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.3.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.3.sql new file mode 100644 index 0000000..1c1103c --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.3.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.3 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.4.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.4.sql new file mode 100644 index 0000000..a829ab9 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.4.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.4 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.5.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.5.sql new file mode 100644 index 0000000..2142539 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_10.2.0.5.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 10.2.0.5 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.1.0.6.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.1.0.6.sql new file mode 100644 index 0000000..d35fcaf --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.1.0.6.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.1.0.6 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.1.0.7.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.1.0.7.sql new file mode 100644 index 0000000..5289fbc --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.1.0.7.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.1.0.7 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.1.sql new file mode 100644 index 0000000..6ab58ed --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.1.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.2.0.1 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.2.sql new file mode 100644 index 0000000..2a2437c --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.2.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.2.0.2 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.3.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.3.sql new file mode 100644 index 0000000..0598d53 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.3.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 11.2.0.3 +-------------------------------------- + +-- The code is the same as 11.2.0.4 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_11.2.0.4.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.4.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.4.sql new file mode 100644 index 0000000..f34dff3 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_11.2.0.4.sql @@ -0,0 +1,50 @@ +-------------------------------------- +-- 11.2.0.4 +-------------------------------------- + +INSERT INTO &v_username..T_PARAMETER_VALID_VALUES +( + "NAME", + "ORDINAL", + "VALUE", + "ISDEFAULT", + "CON_ID" +) +WITH T1 AS ( +SELECT + inst_id, + parno_kspvld_values num, + name_kspvld_values name, + ordinal_kspvld_values ordinal, + value_kspvld_values value, + isdefault_kspvld_values isdefault +FROM + x$kspvld_values +-- WHERE +-- NOT (translate(name_kspvld_values, '_', '#') NOT LIKE '#%') +) +SELECT "NAME", + "ORDINAL", + "VALUE", + "ISDEFAULT", + NULL "CON_ID" +FROM T1; + +-- Add Default Value info into T_PARAMETER + +UPDATE &v_username..T_PARAMETER A +SET A."DEFAULT_VALUE" = ( + SELECT B."VALUE" + FROM &v_username..T_PARAMETER_VALID_VALUES B + WHERE A."NAME"=B."NAME" + AND B."ISDEFAULT"='TRUE' + AND B."VALUE" IS NOT NULL +) +WHERE A."DEFAULT_VALUE" IS NULL +AND EXISTS ( + SELECT 1 + FROM &v_username..T_PARAMETER_VALID_VALUES B + WHERE A."NAME"=B."NAME" + AND B."ISDEFAULT"='TRUE' + AND B."VALUE" IS NOT NULL +); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.1.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.1.0.1.sql new file mode 100644 index 0000000..d43f726 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.1.0.1.sql @@ -0,0 +1,51 @@ +-------------------------------------- +-- 12.1.0.1 +-------------------------------------- + +INSERT INTO &v_username..T_PARAMETER_VALID_VALUES +( + "NAME", + "ORDINAL", + "VALUE", + "ISDEFAULT", + "CON_ID" +) +WITH T1 AS ( +SELECT + inst_id, + parno_kspvld_values num, + name_kspvld_values name, + ordinal_kspvld_values ordinal, + value_kspvld_values value, + isdefault_kspvld_values isdefault, + con_id +FROM + x$kspvld_values +-- WHERE +-- NOT (translate(name_kspvld_values, '_', '#') NOT LIKE '#%') +) +SELECT "NAME", + "ORDINAL", + "VALUE", + "ISDEFAULT", + "CON_ID" +FROM T1; + +-- Add Default Value info into T_PARAMETER + +UPDATE &v_username..T_PARAMETER A +SET A."DEFAULT_VALUE" = ( + SELECT B."VALUE" + FROM &v_username..T_PARAMETER_VALID_VALUES B + WHERE A."NAME"=B."NAME" + AND B."ISDEFAULT"='TRUE' + AND B."VALUE" IS NOT NULL +) +WHERE A."DEFAULT_VALUE" IS NULL +AND EXISTS ( + SELECT 1 + FROM &v_username..T_PARAMETER_VALID_VALUES B + WHERE A."NAME"=B."NAME" + AND B."ISDEFAULT"='TRUE' + AND B."VALUE" IS NOT NULL +); \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.1.0.2.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.1.0.2.sql new file mode 100644 index 0000000..abb9a73 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.1.0.2.sql @@ -0,0 +1,32 @@ +-------------------------------------- +-- 12.1.0.2 +-------------------------------------- + +INSERT INTO &v_username..T_PARAMETER_VALID_VALUES +( + "NAME", + "ORDINAL", + "VALUE", + "ISDEFAULT", + "CON_ID" +) +WITH T1 AS ( +SELECT + inst_id, + parno_kspvld_values num, + name_kspvld_values name, + ordinal_kspvld_values ordinal, + value_kspvld_values value, + isdefault_kspvld_values isdefault, + con_id +FROM + x$kspvld_values +-- WHERE +-- NOT (translate(name_kspvld_values, '_', '#') NOT LIKE '#%') +) +SELECT "NAME", + "ORDINAL", + "VALUE", + "ISDEFAULT", + "CON_ID" +FROM T1; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.2.0.1.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.2.0.1.sql new file mode 100644 index 0000000..aa4ef9b --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_12.2.0.1.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 12.2.0.1 +-------------------------------------- + +-- The code is the same as 12.1.0.2 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_12.1.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_18.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_18.0.0.0.sql new file mode 100644 index 0000000..d287639 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_18.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 18.0.0.0 +-------------------------------------- + +-- The code is the same as 12.1.0.2 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_12.1.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_19.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_19.0.0.0.sql new file mode 100644 index 0000000..1562d4d --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_19.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 19.0.0.0 +-------------------------------------- + +-- The code is the same as 12.1.0.2 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_12.1.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_21.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_21.0.0.0.sql new file mode 100644 index 0000000..ad0196f --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_21.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 21.0.0.0 +-------------------------------------- + +-- The code is the same as 12.1.0.2 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_12.1.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_23.0.0.0.sql b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_23.0.0.0.sql new file mode 100644 index 0000000..39e99b8 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/underscore_valid_values/load_underscore_vv_23.0.0.0.sql @@ -0,0 +1,6 @@ +-------------------------------------- +-- 23.0.0.0 +-------------------------------------- + +-- The code is the same as 12.1.0.2 in V$FIXED_VIEW_DEFINITION +@@load_underscore_vv_12.1.0.2.sql \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/unwrap_code.sql b/user_scripts_old/odbfcl/extract.2024Dez/unwrap_code.sql new file mode 100644 index 0000000..729d63f --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/unwrap_code.sql @@ -0,0 +1,253 @@ +--------------------------------------------- +------------ SECTION START ------------ +------------ UNWRAP WRAPPED CODE ------------ +--------------------------------------------- + +set def ^ + +create or replace java source named CUX_UNWRAPPER +as +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.Reader; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.zip.Deflater; +import java.util.zip.InflaterInputStream; +import oracle.jdbc.OracleDriver; +import oracle.sql.CLOB; + +public class UNWRAPPER { + //unzip + public static CLOB Inflate(CLOB src) throws IOException, SQLException { + StringBuffer sb = new StringBuffer(); + String s = src.stringValue(); + try{ + ByteArrayInputStream bis = + new ByteArrayInputStream(decodeHex(s.toCharArray())); + //ByteArrayInputStream bis = new ByteArrayInputStream(src); + InflaterInputStream iis = new InflaterInputStream(bis); + for (int c = iis.read(); c != -1; c = iis.read()) { + sb.append((char)c); + } + }catch (Exception e) + { + e.printStackTrace(); + } + + Connection conn = DriverManager.getConnection("jdbc:default:connection:"); + CLOB clob = CLOB.createTemporary(conn, false, CLOB.DURATION_SESSION); + clob.setString(1, sb.toString()); + return clob; + + } + + public static byte[] Deflate(String src, int quality) { + try { + byte[] tmp = new byte[src.length() + 100]; + Deflater defl = new Deflater(quality); + defl.setInput(src.getBytes("UTF-8")); + defl.finish(); + int cnt = defl.deflate(tmp); + byte[] res = new byte[cnt]; + for (int i = 0; i < cnt; i++) + res = tmp; + return res; + } catch (Exception e) { + } + return null; + } + + public static int toDigit(char ch, int index) { + int digit = Character.digit(ch, 16); + if (digit == -1) { + throw new RuntimeException("illegal hexadecimal character " + ch + + " at index " + index); + } + return digit; + } + + //16-ary string to byte array + public static byte[] decodeHex(char[] data) { + int len = data.length; + if ((len & 0x01) != 0) { + throw new RuntimeException("odd number of characters "); + } + + byte[] out = new byte[len >> 1]; + + for (int i = 0, j = 0; j < len; i++) { + int f = toDigit(data[j], j) << 4; + j++; + f = f | toDigit(data[j], j); + j++; + out[i] = (byte)(f & 0xFF); + } + + return out; + } +} +/ + +ALTER JAVA SOURCE CUX_UNWRAPPER COMPILE +/ + +CREATE OR REPLACE PACKAGE CUX_UNWRAPPER IS + FUNCTION UNWRAP(P_CLOB IN CLOB) RETURN CLOB; +END; +/ + +create or replace package body cux_unwrapper is + + --unzip + function inflate(src in clob) return clob as + language java name 'UNWRAPPER.Inflate( oracle.sql.CLOB ) return oracle.sql.CLOB'; + + --Decrypt the main program + function unwrap(p_clob IN CLOB) return clob AS + + l_wrap varchar2(32767); + + l_inf clob; + l_res clob; + l_src clob; + l_inflate varchar2(32767); + l_temp VARCHAR2(32767); + l_bt varchar2(32767); + l_text varchar2(32767); + l_char varchar2(2); + l_len number; + l_slen integer; + l_offset integer := 1; + l_chunk_len integer := 10080; + + --Decryption byte comparison dictionary table + l_dict varchar2(512) := '3D6585B318DBE287F152AB634BB5A05F' || + '7D687B9B24C228678ADEA4261E03EB17' || + '6F343E7A3FD2A96A0FE935561FB14D10' || + '78D975F6BC4104816106F9ADD6D5297E' || + '869E79E505BA84CC6E278EB05DA8F39F' || + 'D0A271B858DD2C38994C480755E4538C' || + '46B62DA5AF322240DC50C3A1258B9C16' || + '605CCFFD0C981CD4376D3C3A30E86C31' || + '47F533DA43C8E35E1994ECE6A39514E0' || + '9D64FA5915C52FCABB0BDFF297BF0A76' || + 'B449445A1DF0009621807F1A82394FC1' || + 'A7D70DD1D8FF139370EE5BEFBE09B977' || + '72E7B254B72AC7739066200E51EDF87C' || + '8F2EF412C62B83CDACCB3BC44EC06936' || + '6202AE88FCAA4208A64557D39ABDE123' || + '8D924A1189746B91FBFEC901EA1BF7CE'; + l_sl varchar2(512) := '000102030405060708090A0B0C0D0E0F' || + '101112131415161718191A1B1C1D1E1F' || + '202122232425262728292A2B2C2D2E2F' || + '303132333435363738393A3B3C3D3E3F' || + '404142434445464748494A4B4C4D4E4F' || + '505152535455565758595A5B5C5D5E5F' || + '606162636465666768696A6B6C6D6E6F' || + '707172737475767778797A7B7C7D7E7F' || + '808182838485868788898A8B8C8D8E8F' || + '909192939495969798999A9B9C9D9E9F' || + 'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF' || + 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF' || + 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF' || + 'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF' || + 'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF' || + 'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'; + BEGIN + dbms_lob.createtemporary(lob_loc => l_inf, + cache => TRUE, + dur => dbms_lob.session); + --Get package ciphertext + l_src := p_clob; + + --out_put('source:<'||l_src||'>'); + l_src := substr(l_src, regexp_instr(l_src, 'wrapped', 1, 1, 0, 'i')); + l_src := rtrim(substr(l_src, instr(l_src, chr(10), 1, 20) + 1), chr(10)); + l_src := replace(l_src, chr(10), ''); + --dbms_output.put_line('source:<'||l_src||'>'); + --l_src:=substr(l_src,41); + + --base64 decoding + l_len := dbms_lob.getlength(l_src); + while l_offset < l_len loop + if (l_len - l_offset) < 10080 then + l_chunk_len := (l_len - l_offset); + end if; + l_temp := dbms_lob.substr(l_src, l_chunk_len, l_offset); + l_bt := utl_encode.base64_decode(utl_raw.cast_to_raw(l_temp)); + + if l_bt is not null then + if l_offset = 1 then + -- Remove the first 40 hash strings + l_bt := substr(l_bt, 41); + end if; + -- l_wrap := l_wrap || l_bt; + -- dictionary table conversion + l_bt := utl_raw.translate(l_bt, l_sl, l_dict); + + l_offset := l_offset + l_chunk_len; + -- l_inflate := l_inflate || l_bt; + dbms_lob.writeappend(l_inf, length(l_bt), l_bt); + end if; + + end loop; + + /* dbms_output.put_line('base:' || l_wrap); + dbms_output.put_line('<' || l_inflate || '>');*/ + + --unzip + l_res := inflate(l_inf); + return l_res; + END unwrap; +END; +/ + +set def & + +--------------------------------------------- +------------ SECTION END ------------ +------------ UNWRAP WRAPPED CODE ------------ +--------------------------------------------- + +-- Create unwrapped table +create table &v_username..DM_CODES_LOAD AS +select SYS.DBMS_CRYPTO.HASH(UNCODE,2) MD5_HASH, + MD5_HASH MD5_HASH_WRAPPED, + UNCODE CODE, + 'N' WRAPPED +from ( select cux_unwrapper.unwrap(code) uncode, MD5_HASH + from &v_username..DM_CODES + where WRAPPED='Y'); + +-- Load back into DM_CODES +insert /*+ append */ + into &v_username..DM_CODES (MD5_HASH, CODE, WRAPPED) +select MD5_HASH, + CODE, + 'N' WRAPPED +from ( select MD5_HASH, + CODE, + RANK() over (partition by MD5_HASH order by rowid asc) col_ind + from &v_username..DM_CODES_LOAD +) +where col_ind=1; + +commit; + +-- Update DM_CODES +update &v_username..DM_CODES T1 SET T1.MD5_HASH_UNWRAPPED = + (SELECT T2.MD5_HASH + FROM &v_username..DM_CODES_LOAD T2 + WHERE T2.MD5_HASH_WRAPPED=T1.MD5_HASH) +WHERE T1.WRAPPED = 'Y'; + +commit; + +drop table &v_username..DM_CODES_LOAD purge; + +drop package cux_unwrapper; + +drop java source CUX_UNWRAPPER; \ No newline at end of file diff --git a/user_scripts_old/odbfcl/extract.2024Dez/version_filter.sql b/user_scripts_old/odbfcl/extract.2024Dez/version_filter.sql new file mode 100644 index 0000000..a2bf646 --- /dev/null +++ b/user_scripts_old/odbfcl/extract.2024Dez/version_filter.sql @@ -0,0 +1,31 @@ +------------------------------- + +set termout off + +-- Set version variables. Value will be 'Y' or 'N' +COL is_ver_le_10 new_v is_ver_le_10 nopri + +select -- Lower or Equal + case when version <= 10 then 'Y' else 'N' end is_ver_le_10 +from (select to_number(substr(version,1,instr(version,'.')-1)) version + , to_number(substr(version,instr(version,'.')+1, instr(version,'.',1,2)-instr(version,'.')-1)) release + , to_number(substr(version,instr(version,'.',1,2)+1, instr(version,'.',1,3)-instr(version,'.',1,2)-1)) server + , to_number(substr(version,instr(version,'.',1,3)+1, instr(version,'.',1,4)-instr(version,'.',1,3)-1)) component + from v$instance); + +COL is_ver_le_10 clear + +COL skip_ver_le_10_s new_v skip_ver_le_10_s nopri +COL skip_ver_le_10_e new_v skip_ver_le_10_e nopri + +select -- Lower or Equal + decode('&&is_ver_le_10.','Y','/*','N','') skip_ver_le_10_s, + decode('&&is_ver_le_10.','Y','*/','N','') skip_ver_le_10_e +from dual; + +COL skip_ver_le_10_s clear +COL skip_ver_le_10_e clear + +set termout on + +------------------------------- diff --git a/user_scripts_old/odbfcl/extract/hashGet.yml.old b/user_scripts_old/odbfcl/extract/hashGet.yml.old new file mode 100644 index 0000000..39ca963 --- /dev/null +++ b/user_scripts_old/odbfcl/extract/hashGet.yml.old @@ -0,0 +1,4 @@ +- include: tasks/run_sql.yml + vars: + sql_param : { file : "hashGet.sql" , folder : "user_scripts/odbfcl/extract" , task_action : "Calculate Hash" , params : "'{{ dump_user_int }}' '{{ dump_dir_name }}'" } +# patch.base_ru will only be populated for RURs \ No newline at end of file diff --git a/user_scripts_old/odbfcl/sh_extractor.2024Dez/VERSION b/user_scripts_old/odbfcl/sh_extractor.2024Dez/VERSION new file mode 100644 index 0000000..40115e9 --- /dev/null +++ b/user_scripts_old/odbfcl/sh_extractor.2024Dez/VERSION @@ -0,0 +1 @@ +24.11.0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/sh_extractor.2024Dez/cleanUser.sql b/user_scripts_old/odbfcl/sh_extractor.2024Dez/cleanUser.sql new file mode 100644 index 0000000..7c301fd --- /dev/null +++ b/user_scripts_old/odbfcl/sh_extractor.2024Dez/cleanUser.sql @@ -0,0 +1,18 @@ +-- This code will clean the created objects. +WHENEVER SQLERROR EXIT FAILURE ROLLBACK + +def v_username='&1.' +def v_directory='&2.' +def v_drop_user='&3.' + +DROP DIRECTORY &v_directory.; + +BEGIN + IF '&v_drop_user.' = 'true' + THEN + EXECUTE IMMEDIATE 'DROP USER &v_username. CASCADE'; + END IF; +END; +/ + +EXIT 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/sh_extractor.2024Dez/dictionaryGet.sh b/user_scripts_old/odbfcl/sh_extractor.2024Dez/dictionaryGet.sh new file mode 100644 index 0000000..0960a3a --- /dev/null +++ b/user_scripts_old/odbfcl/sh_extractor.2024Dez/dictionaryGet.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Script to collect dictionary tables + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_dump_user_name="$1" + +[ -z "${v_dump_user_name}" ] && exitError "1st parameter is the DB Schema and cannot be null." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." +[ -z "$ORACLE_SID" ] && exitError "\$ORACLE_SID is unset." + +# If DB_EXP_CONN is exported, use it. +[ -z "$DB_EXP_CONN" ] && DB_EXP_CONN='/ as sysdba' + +# If DB_EXP_DIRECTORY is exported, use it. +[ -z "$DB_EXP_DIRECTORY" ] && DB_EXP_DIRECTORY='expdir_oradiff' + +# If DB_EXP_INTERNAL_ONLY is exported, use it. +[ -z "$DB_EXP_INTERNAL_ONLY" ] && DB_EXP_INTERNAL_ONLY='true' + +v_thisdir="$(cd "$(dirname "$0")"; pwd)" +cd "${v_thisdir}" + +echo "Generating table export. Please wait.." + +cd "${v_thisdir}"/../extract # REMOVE_IF_ZIP +$ORACLE_HOME/bin/sqlplus -L -S "${DB_EXP_CONN}" <&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_dump_user_name="$1" +v_out_file_param="$2" +v_drop_dump_user="$3" + +[ -z "${v_dump_user_name}" ] && exitError "1st parameter is the DB Schema and cannot be null." +[ -z "${v_out_file_param}" ] && exitError "2nd parameter is the target file and cannot be null." +[ -z "${v_drop_dump_user}" ] && exitError "3rd parameter is if DB Schema can be dropped and cannot be null." + +[ -f "${v_out_file_param}" ] && exitError "File \"${v_out_file_param}\" already exists. Remove it before rerunning." + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." +[ -z "$ORACLE_SID" ] && exitError "\$ORACLE_SID is unset." + +v_out_file_fdr="$(cd "$(dirname "${v_out_file_param}")"; pwd)" +v_out_file_name="$(basename "${v_out_file_param}")" +v_out_file_name_noext="${v_out_file_name%.*}" + +v_out_file_full="${v_out_file_fdr}/${v_out_file_name}" +v_err_file_full="${v_out_file_fdr}/${v_out_file_name_noext}.err" + +# If DB_EXP_USER_PASS is exported, use it. +[ -z "$DB_EXP_USER_PASS" ] && DB_EXP_USER_PASS='HhAaSsHh..135' + +# If DB_EXP_CONN is exported, use it. +[ -z "$DB_EXP_CONN" ] && DB_EXP_CONN='/ as sysdba' + +# If DB_EXP_DIRECTORY is exported, use it. +[ -z "$DB_EXP_DIRECTORY" ] && DB_EXP_DIRECTORY='expdir_oradiff' + +# If DB_EXP_COMPRESS is exported, use it. +[ -z "$DB_EXP_COMPRESS" ] && DB_EXP_COMPRESS='false' + +v_thisdir="$(cd "$(dirname "$0")"; pwd)" +cd "${v_thisdir}" + +v_output_file_cnt=`awk -F" " '{print NF-1}' <<< "${v_out_file_name_noext}"` +[ ${v_output_file_cnt} -ne 0 ] && exitError "File \"${v_out_file_param}\" must not have any spaces." + +echo "Generating table export. Please wait.." + +cd "${v_thisdir}"/../../ # REMOVE_IF_ZIP +$ORACLE_HOME/bin/sqlplus -L -S "${DB_EXP_CONN}" <&1 >&3. This sends the stderr of expdp +# to the same place as the current stdout, which is the pipe, then sends the stdout +# to fd 3, the original output. The pipe feeds the original stderr of expdp to tee, +# which saves it in a file and sends it to the screen. +exec 3>&1 + +set +e +$ORACLE_HOME/bin/expdp \ +userid="${v_dump_user_name}/${DB_EXP_USER_PASS}" \ +directory=${DB_EXP_DIRECTORY} \ +"${v_compress_alg}" \ +dumpfile="${v_out_file_name}" \ +logfile="${v_out_file_name_noext}.log" \ +content=data_only "${v_version_param}" \ +schemas="${v_dump_user_name}" 2>&1 >&3 | tee "${v_err_file_full}" +v_ret=$? +set -eo pipefail + +if [ ${v_ret} -ne 0 ] +then + if grep -q 'ORA-39070: Unable to open the log file' "${v_err_file_full}" + then + v_ora_user=$(stat -c '%U' $ORACLE_HOME/bin/expdp) + exitError "Error, check if the Oracle Database ('${v_ora_user}' user) has access to this directory: ${v_out_file_fdr}" + else + exitError 'Error when generating dump file.' + fi +fi + +[ -f "${v_err_file_full}" ] && rm -f "${v_err_file_full}" + +cd odbfcl/sh_extractor/ # REMOVE_IF_ZIP +$ORACLE_HOME/bin/sqlplus -L -S "${DB_EXP_CONN}" <&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +echoDebug () +{ + if [ "$DEBUG" = "1" ] + then + echo "$1" + fi +} + +v_pattern="$1" + +v_example='MYDB' + +# Defaults +v_def_load_file='true' +v_def_gen_dump='true' +v_def_ignore_error='true' +v_def_verbose='false' +v_def_sysdba_connect='/ as sysdba' +v_def_dump_user_name='hash' +v_def_dump_user_pass='HhAaSsHh..135' +v_def_dump_user_tbs='USERS' +v_def_dump_user_temp='TEMP' +v_def_dump_exp_dir='expdir_hash' +v_def_dump_exp_comp='false' +v_def_dump_int_only='true' + +[ -z "$v_pattern" -o "$#" -ne 1 -o "$v_pattern" = "-help" ] && echoError "Usage: $0 | -help + +First parameter is the output file name and cannot be null. + +ORAdiff exporter will collect all metadata information from the database, +to be loaded in the ORAdiff utility for comparison with another patch set, +including another custom patch set you already loaded. + +Example: + + \$ $0 ${v_example} + + The output will be a zip file named '${v_example}.zip'. +" + +[ -z "$v_pattern" -o "$#" -ne 1 ] && echoError "The behaviour of the ORAdiff exporter can be changed by exporting +some environment variables. (Use -help for more details)" + +[ "$v_pattern" = "-help" ] && echoError "The behaviour of the ORAdiff exporter can be changed by exporting +some environment variables described below. + +Environment Variables: + + DB_EXP_GEN_DUMP + + If ORAdiff schema is exported after being populated. If set to false, + the code will only populate the DB schema and stop. + + Accepted values: 'true' or 'false'. + Default value: '${v_def_gen_dump}' + + DB_EXP_IGNORE_ERROR + + Code will ignore critical errors and move forward. + + Accepted values: 'true' or 'false'. + Default value: '${v_def_ignore_error}' + + DB_EXP_CONN + + SQL*Plus connect string. + + Default value: '${v_def_sysdba_connect}' + + DB_EXP_USER + + Schema inside the database that will temporarily hold the ORAdiff data + before it is exported. + + Default value: '${v_def_dump_user_name}' + + DB_EXP_USER_PASS + + Password for the temporary ORAdiff schema. + + Default value: '${v_def_dump_user_pass}' + + DB_EXP_USER_TBS + + Default permanent tablespace for the temporary ORAdiff schema. + + Default value: '${v_def_dump_user_tbs}' + + DB_EXP_USER_TEMP + + Default temp tablespace for the temporary ORAdiff schema. + + Default value: '${v_def_dump_user_temp}' + + DB_EXP_DIRECTORY + + Temporary directory that will be created to export the genetared data. + Only applicable when DB_EXP_GEN_DUMP=true. + + Default value: '${v_def_dump_exp_dir}' + + DB_EXP_COMPRESS + + Enable data pump compression. + (Requires licensing of the Oracle Advanced Compression option). + Only valid when DB_EXP_GEN_DUMP=true. + + Accepted values: 'true' or 'false'. + Default value: '${v_def_dump_exp_comp}' + + DB_EXP_INTERNAL_ONLY + + Retrieve dictionary info of all DB schemas or just internal + oracle maintained schemas. If 'true', will also skip collecting + ORACLE_HOME files and symbols. + + Accepted values: 'true' or 'false'. + Default value: '${v_def_dump_int_only}' + + DB_EXP_MERGE_DUMP + + The generated ORACLE_HOME related files (bugs, symbols, chksum, etc) + will be loaded on DB tables, not added to zip as separate files. + + Accepted values: 'true' or 'false'. + Default value: '${v_def_load_file}' + +" + +[ -z "$v_pattern" -o "$#" -ne 1 -o "$v_pattern" = "-help" ] && exit 1 + +################### +# Check variables # +################### + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." +[ -z "$ORACLE_SID" ] && exitError "\$ORACLE_SID is unset." + +# If DB_EXP_MERGE_DUMP=false, then the generated ORACLE_HOME related files (bugs, symbols, chksum, etc) won't be loaded on DB tables, but added to zip as separate files. +if [ -z "$DB_EXP_MERGE_DUMP" ] +then + DB_EXP_MERGE_DUMP=${v_def_load_file} + echoDebug "Note: Variable 'DB_EXP_MERGE_DUMP' was not exported. Assigning DB_EXP_MERGE_DUMP=${DB_EXP_MERGE_DUMP} (default)." +else + DB_EXP_MERGE_DUMP=$(echo "${DB_EXP_MERGE_DUMP}" | tr '[:upper:]' '[:lower:]') + echo "Note: DB_EXP_MERGE_DUMP=${DB_EXP_MERGE_DUMP} (provided)." +fi + +if [ "${DB_EXP_MERGE_DUMP}" != "false" -a "${DB_EXP_MERGE_DUMP}" != "true" ] +then + exitError "DB_EXP_MERGE_DUMP must be 'true' or 'false'." +fi + +# If DB_EXP_GEN_DUMP=false, then nothing will be exported. Only the schema populated. +if [ -z "$DB_EXP_GEN_DUMP" ] +then + DB_EXP_GEN_DUMP=${v_def_gen_dump} + echoDebug "Note: Variable 'DB_EXP_GEN_DUMP' was not exported. Assigning DB_EXP_GEN_DUMP=${DB_EXP_GEN_DUMP} (default)." +else + DB_EXP_GEN_DUMP=$(echo "${DB_EXP_GEN_DUMP}" | tr '[:upper:]' '[:lower:]') + echo "Note: DB_EXP_GEN_DUMP=${DB_EXP_GEN_DUMP} (provided)." +fi + +if [ "${DB_EXP_GEN_DUMP}" != "false" -a "${DB_EXP_GEN_DUMP}" != "true" ] +then + exitError "DB_EXP_GEN_DUMP must be 'true' or 'false'." +fi + +# If DB_EXP_IGNORE_ERROR=false, the code will stop on some critical errors. +if [ -z "$DB_EXP_IGNORE_ERROR" ] +then + DB_EXP_IGNORE_ERROR=${v_def_ignore_error} + echoDebug "Note: Variable 'DB_EXP_IGNORE_ERROR' was not exported. Assigning DB_EXP_IGNORE_ERROR=${DB_EXP_IGNORE_ERROR} (default)." +else + DB_EXP_IGNORE_ERROR=$(echo "${DB_EXP_IGNORE_ERROR}" | tr '[:upper:]' '[:lower:]') + echo "Note: DB_EXP_IGNORE_ERROR=${DB_EXP_IGNORE_ERROR} (provided)." +fi + +if [ "${DB_EXP_IGNORE_ERROR}" != "false" -a "${DB_EXP_IGNORE_ERROR}" != "true" ] +then + exitError "DB_EXP_IGNORE_ERROR must be 'true' or 'false'." +fi + +# If DB_EXP_VERBOSE=true, the code will print detailed steps. +if [ -z "$DB_EXP_VERBOSE" ] +then + DB_EXP_VERBOSE=${v_def_ignore_error} + echoDebug "Note: Variable 'DB_EXP_VERBOSE' was not exported. Assigning DB_EXP_VERBOSE=${DB_EXP_VERBOSE} (default)." +else + DB_EXP_VERBOSE=$(echo "${DB_EXP_VERBOSE}" | tr '[:upper:]' '[:lower:]') + echo "Note: DB_EXP_VERBOSE=${DB_EXP_VERBOSE} (provided)." +fi + +if [ "${DB_EXP_VERBOSE}" != "false" -a "${DB_EXP_VERBOSE}" != "true" ] +then + exitError "DB_EXP_VERBOSE must be 'true' or 'false'." +fi + +# If DB_EXP_CONN is exported, then connect using this string instead of '/ as sysdba'. +if [ -z "$DB_EXP_CONN" ] +then + # To be used by child shells. + DB_EXP_CONN=${v_def_sysdba_connect} + export DB_EXP_CONN + echoDebug "Note: Variable 'DB_EXP_CONN' was not exported. Assigning DB_EXP_CONN='${DB_EXP_CONN}' (default)." +else + DB_EXP_CONN="${DB_EXP_CONN}" + echo "Note: DB_EXP_CONN (provided)." +fi + +# If DB_EXP_USER defines the user inside the database to export the ORAdiff data. +if [ -z "$DB_EXP_USER" ] +then + DB_EXP_USER=${v_def_dump_user_name} + export DB_EXP_USER + echoDebug "Note: Variable 'DB_EXP_USER' was not exported. Assigning DB_EXP_USER='${DB_EXP_USER}' (default)." +else + DB_EXP_USER=$(echo "${DB_EXP_USER}" | tr '[:upper:]' '[:lower:]') + echo "Note: DB_EXP_USER (provided)." +fi + +# If DB_EXP_USER_PASS defines the user password inside the database to export the ORAdiff data. +if [ -z "$DB_EXP_USER_PASS" ] +then + # To be used by child shells. + DB_EXP_USER_PASS=${v_def_dump_user_pass} + export DB_EXP_USER_PASS + echoDebug "Note: Variable 'DB_EXP_USER_PASS' was not exported. Assigning DB_EXP_USER_PASS='${v_def_dump_user_pass}' (default)." +else + echo "Note: DB_EXP_USER_PASS (provided)." +fi + +# If DB_EXP_USER_TBS defines the user tablespace inside the database to export the ORAdiff data. +if [ -z "$DB_EXP_USER_TBS" ] +then + # To be used by child shells. + DB_EXP_USER_TBS=${v_def_dump_user_tbs} + export DB_EXP_USER_TBS + echoDebug "Note: Variable 'DB_EXP_USER_TBS' was not exported. Assigning DB_EXP_USER_TBS='${DB_EXP_USER_TBS}' (default)." +else + echo "Note: DB_EXP_USER_TBS (provided)." +fi + +# If DB_EXP_USER_TEMP defines the user temp tablespace inside the database to export the ORAdiff data. +if [ -z "$DB_EXP_USER_TEMP" ] +then + # To be used by child shells. + DB_EXP_USER_TEMP=${v_def_dump_user_temp} + export DB_EXP_USER_TEMP + echoDebug "Note: Variable 'DB_EXP_USER_TEMP' was not exported. Assigning DB_EXP_USER_TEMP='${DB_EXP_USER_TEMP}' (default)." +else + echo "Note: DB_EXP_USER_TEMP (provided)." +fi + +# If DB_EXP_DIRECTORY defines the directory name inside the database to export the ORAdiff data. +if [ -z "$DB_EXP_DIRECTORY" ] +then + # To be used by child shells. + DB_EXP_DIRECTORY=${v_def_dump_exp_dir} + export DB_EXP_DIRECTORY + echoDebug "Note: Variable 'DB_EXP_DIRECTORY' was not exported. Assigning DB_EXP_DIRECTORY='${DB_EXP_DIRECTORY}' (default)." +else + echo "Note: DB_EXP_DIRECTORY (provided)." +fi + +# If DB_EXP_COMPRESS defines if compression can be used to export the ORAdiff data. +if [ -z "$DB_EXP_COMPRESS" ] +then + # To be used by child shells. + DB_EXP_COMPRESS=${v_def_dump_exp_comp} + export DB_EXP_COMPRESS + echoDebug "Note: Variable 'DB_EXP_COMPRESS' was not exported. Assigning DB_EXP_COMPRESS='${DB_EXP_COMPRESS}' (default)." +else + DB_EXP_COMPRESS=$(echo "${DB_EXP_COMPRESS}" | tr '[:upper:]' '[:lower:]') + echo "Note: DB_EXP_COMPRESS (provided)." +fi + +if [ "${DB_EXP_COMPRESS}" != "false" -a "${DB_EXP_COMPRESS}" != "true" ] +then + exitError "DB_EXP_COMPRESS must be 'true' or 'false'." +fi + +# If DB_EXP_INTERNAL_ONLY defines if we filter for internal schemas during export of ORAdiff data. +if [ -z "$DB_EXP_INTERNAL_ONLY" ] +then + # To be used by child shells. + DB_EXP_INTERNAL_ONLY=${v_def_dump_int_only} + export DB_EXP_INTERNAL_ONLY + echoDebug "Note: Variable 'DB_EXP_INTERNAL_ONLY' was not exported. Assigning DB_EXP_INTERNAL_ONLY='${DB_EXP_INTERNAL_ONLY}' (default)." +else + DB_EXP_INTERNAL_ONLY=$(echo "${DB_EXP_INTERNAL_ONLY}" | tr '[:upper:]' '[:lower:]') + echo "Note: DB_EXP_INTERNAL_ONLY (provided)." +fi + +if [ "${DB_EXP_INTERNAL_ONLY}" != "false" -a "${DB_EXP_INTERNAL_ONLY}" != "true" ] +then + exitError "DB_EXP_INTERNAL_ONLY must be 'true' or 'false'." +fi + +# Check if DB_EXP_USER is the default. If it is, we drop it before and after. +if [ "$v_def_dump_user_name" = "$DB_EXP_USER" ] +then + v_drop_dump_user=true +else + v_drop_dump_user=false +fi + +v_pattern_cnt=`awk -F" " '{print NF-1}' <<< "${v_pattern}"` +[ ${v_pattern_cnt} -ne 0 ] && exitError "Pattern \"${v_output}\" must not have any spaces. Eg: ${v_example}" + +v_thisdir="$(cd "$(dirname "$0")"; pwd)" + +v_zip="${v_pattern}.zip" + +######################## +# Define dump username # +######################## + +echo "Checking if common user. Please wait.." +v_common_user=$($ORACLE_HOME/bin/sqlplus -L -S "${DB_EXP_CONN}" @${v_thisdir}/get_user_prefix.sql) && v_ret=$? || v_ret=$? + +if [ $v_ret -ne 0 ] +then + echoError "Failed to get required information." + exitError "${v_common_user}" +fi + +if [ "$v_def_dump_user_name" = "$DB_EXP_USER" ] +then + [ -n "${v_common_user}" ] && DB_EXP_USER="${v_common_user}${DB_EXP_USER}" +fi + +############## +# Start Code # +############## + +v_thisdir_bkp="${v_thisdir}" # REMOVE_IF_ZIP + +v_thisdir="${v_thisdir_bkp}/../adb_load_bugs_fixed" # REMOVE_IF_ZIP +v_file=bugs_${v_pattern}.txt +sh "${v_thisdir}/bugsGet.sh" "${v_file}" && v_bugs_ret=$? || v_bugs_ret=$? +if ! ${DB_EXP_IGNORE_ERROR} && [ ${v_bugs_ret} -ne 0 ] +then + exitError "OPatch returned ${v_bugs_ret}." +fi +! ${DB_EXP_MERGE_DUMP} && zip -m "${v_zip}" "${v_file}" + +v_thisdir="${v_thisdir_bkp}/../adb_load_filechksum" # REMOVE_IF_ZIP +v_file=sha256sum_${v_pattern}.chk +sh "${v_thisdir}/chksumGet.sh" "${v_file}" +! ${DB_EXP_MERGE_DUMP} && zip -m "${v_zip}" "${v_file}" + +if ! ${DB_EXP_INTERNAL_ONLY} +then + v_thisdir="${v_thisdir_bkp}/../adb_load_txtcollection_files" # REMOVE_IF_ZIP + v_file=txtcol_${v_pattern}.tar.gz + sh "${v_thisdir}/fileGet.sh" "${v_file}" + ! ${DB_EXP_MERGE_DUMP} && zip -m "${v_zip}" "${v_file}" + + v_thisdir="${v_thisdir_bkp}/../adb_load_symbols" # REMOVE_IF_ZIP + v_file=symbols_${v_pattern}.csv + sh "${v_thisdir}/symbolGet.sh" "${v_file}" + ! ${DB_EXP_MERGE_DUMP} && zip -m "${v_zip}" "${v_file}" +fi + +v_thisdir="${v_thisdir_bkp}" # REMOVE_IF_ZIP +sh "${v_thisdir}/schemaCreate.sh" "${DB_EXP_USER}" "${v_drop_dump_user}" + +if ${DB_EXP_MERGE_DUMP} +then + if [ ${v_bugs_ret} -eq 0 ] + then + v_thisdir="${v_thisdir_bkp}/../adb_load_bugs_fixed" # REMOVE_IF_ZIP + v_file="bugs_${v_pattern}.txt" + sh "${v_thisdir}/bugsLoad.sh" "${DB_EXP_USER}" "${v_file}" + rm -f "${v_file}" + fi + + v_thisdir="${v_thisdir_bkp}/../adb_load_filechksum" # REMOVE_IF_ZIP + v_file="sha256sum_${v_pattern}.chk" + sh "${v_thisdir}/chksumLoad.sh" "${DB_EXP_USER}" "${v_file}" + rm -f "${v_file}" + + if ! ${DB_EXP_INTERNAL_ONLY} + then + v_thisdir="${v_thisdir_bkp}/../adb_load_txtcollection_files" # REMOVE_IF_ZIP + v_file="txtcol_${v_pattern}.tar.gz" + sh "${v_thisdir}/fileLoad.sh" "${DB_EXP_USER}" "${v_file}" + rm -f "${v_file}" + + v_thisdir="${v_thisdir_bkp}/../adb_load_symbols" # REMOVE_IF_ZIP + v_file="symbols_${v_pattern}.csv" + sh "${v_thisdir}/symbolLoad.sh" "${DB_EXP_USER}" "${v_file}" + rm -f "${v_file}" + fi +fi + +v_thisdir="${v_thisdir_bkp}" # REMOVE_IF_ZIP +sh "${v_thisdir}/dictionaryGet.sh" "${DB_EXP_USER}" + +if ${DB_EXP_GEN_DUMP} +then + sh "${v_thisdir}/dumpCreate.sh" "${DB_EXP_USER}" "tables_${v_pattern}.dmp" "${v_drop_dump_user}" + set +e + zip -m "${v_zip}" "tables_${v_pattern}.dmp" "tables_${v_pattern}.log" + v_ret=$? + set -eo pipefail + if [ $v_ret -ne 0 ] + then + echoError "Script failed to zip tables_${v_pattern}.dmp in ${v_zip}". + v_file_user=$(stat -c '%U' tables_${v_pattern}.dmp) + echoError "1 - Try to rerun as '${v_file_user}' user." + echoError "2 - Check file 'tables_${v_pattern}.dmp' permissions, make it readeable and run:". + echoError "$ zip ${v_zip} tables_${v_pattern}.dmp" + exit $v_ret + fi +fi + +echo "Script Finished." + +exit 0 \ No newline at end of file diff --git a/user_scripts_old/odbfcl/sh_extractor.2024Dez/get_db_version.sql b/user_scripts_old/odbfcl/sh_extractor.2024Dez/get_db_version.sql new file mode 100644 index 0000000..2c37868 --- /dev/null +++ b/user_scripts_old/odbfcl/sh_extractor.2024Dez/get_db_version.sql @@ -0,0 +1,13 @@ +WHENEVER SQLERROR EXIT FAILURE ROLLBACK +SET SERVEROUT ON ECHO OFF FEED OFF +DECLARE + V_RESULT NUMBER; +BEGIN + SELECT SUBSTR(VERSION,1,INSTR(VERSION,'.',1,1)-1) INTO V_RESULT FROM (SELECT VERSION FROM V$INSTANCE); + DBMS_OUTPUT.PUT_LINE(V_RESULT); +EXCEPTION + WHEN OTHERS THEN + NULL; +END; +/ +EXIT \ No newline at end of file diff --git a/user_scripts_old/odbfcl/sh_extractor.2024Dez/get_user_prefix.sql b/user_scripts_old/odbfcl/sh_extractor.2024Dez/get_user_prefix.sql new file mode 100644 index 0000000..49aa656 --- /dev/null +++ b/user_scripts_old/odbfcl/sh_extractor.2024Dez/get_user_prefix.sql @@ -0,0 +1,13 @@ +WHENEVER SQLERROR EXIT FAILURE ROLLBACK +SET SERVEROUT ON ECHO OFF FEED OFF +DECLARE + V_RESULT NUMBER; +BEGIN + select 1 INTO V_RESULT from dual where SYS_CONTEXT('USERENV', 'CON_ID')=1; + DBMS_OUTPUT.PUT_LINE('c##'); +EXCEPTION + WHEN OTHERS THEN + NULL; +END; +/ +EXIT \ No newline at end of file diff --git a/user_scripts_old/odbfcl/sh_extractor.2024Dez/schemaCreate.sh b/user_scripts_old/odbfcl/sh_extractor.2024Dez/schemaCreate.sh new file mode 100644 index 0000000..8ed9fa5 --- /dev/null +++ b/user_scripts_old/odbfcl/sh_extractor.2024Dez/schemaCreate.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Script to collect dictionary tables + +set -eo pipefail + +echoError () +{ + (>&2 echo "$1") +} + +exitError () +{ + echoError "$1" + exit 1 +} + +v_dump_user_name="$1" +v_drop_dump_user="$2" + +[ -z "$ORACLE_HOME" ] && exitError "\$ORACLE_HOME is unset." +[ -z "$ORACLE_SID" ] && exitError "\$ORACLE_SID is unset." + +[ -z "${v_dump_user_name}" ] && exitError "1st parameter is the DB Schema and cannot be null." +[ -z "${v_drop_dump_user}" ] && exitError "2nd parameter is if DB Schema can be dropped and cannot be null." + +# If DB_EXP_USER_PASS is exported, use it. +[ -z "$DB_EXP_USER_PASS" ] && DB_EXP_USER_PASS='HhAaSsHh..135' + +# If DB_EXP_USER_TBS is exported, use it. +[ -z "$DB_EXP_USER_TBS" ] && DB_EXP_USER_TBS='USERS' + +# If DB_EXP_USER_TEMP is exported, use it. +[ -z "$DB_EXP_USER_TEMP" ] && DB_EXP_USER_TEMP='TEMP' + +# If DB_EXP_CONN is exported, use it as the credentials. +[ -z "$DB_EXP_CONN" ] && DB_EXP_CONN='/ as sysdba' + +v_thisdir="$(cd "$(dirname "$0")"; pwd)" +cd "${v_thisdir}" + +echo "Creating export user. Please wait.." + +cd "${v_thisdir}"/../ # REMOVE_IF_ZIP +$ORACLE_HOME/bin/sqlplus "${DB_EXP_CONN}" <