From 9bb79ab0d371ba6c261a9a532ed046bffcdacf9c Mon Sep 17 00:00:00 2001 From: Peter Ocelka Date: Fri, 4 May 2018 17:39:14 +0200 Subject: [PATCH 1/6] In situation when user uninstalls older version of utPLSQL table is not dropped. Then when new version is installed manually without user creation, this script failed as table already exists in the schema. --- source/core/ut_dbms_output_cache.sql | 61 +++++++++++++++++----------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/source/core/ut_dbms_output_cache.sql b/source/core/ut_dbms_output_cache.sql index a81f6acbe..91aba0ba5 100644 --- a/source/core/ut_dbms_output_cache.sql +++ b/source/core/ut_dbms_output_cache.sql @@ -1,23 +1,38 @@ -create global temporary table ut_dbms_output_cache( - /* - utPLSQL - Version 3 - Copyright 2016 - 2017 utPLSQL Project - 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. - */ - /* - * This table is not a global temporary table as it needs to allow cross-session data exchange - * It is used however as a temporary table with multiple writers. - * This is why it has very high initrans and has nologging - */ - seq_no number(20,0) not null, - text varchar2(4000), - constraint ut_dbms_output_cache_pk primary key(seq_no) -) on commit preserve rows; +/* +utPLSQL - Version 3 +Copyright 2016 - 2017 utPLSQL Project +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. +*/ +/* +* This table is not a global temporary table as it needs to allow cross-session data exchange +* It is used however as a temporary table with multiple writers. +* This is why it has very high initrans and has nologging +*/ +declare + l_tab_exist number; +begin + select count(*) into l_tab_exist from + (select table_name from all_tables where table_name = 'UT_DBMS_OUTPUT_CACHE' and owner = sys_context('USERENV','CURRENT_SCHEMA') + union all + select synonym_name from all_synonyms where synonym_name = 'UT_DBMS_OUTPUT_CACHE' and owner = sys_context('USERENV','CURRENT_SCHEMA')); + if l_tab_exist = 0 then + + execute immediate q'[create global temporary table ut_dbms_output_cache + ( + seq_no number(20,0) not null, + text varchar2(4000), + constraint ut_dbms_output_cache_pk primary key(seq_no) + ) on commit preserve rows + ]'; + + end if; +end; +/ From 27e842e0707409b85af63977b5725884554f9222 Mon Sep 17 00:00:00 2001 From: Peter Ocelka Date: Fri, 4 May 2018 19:41:23 +0200 Subject: [PATCH 2/6] #658 file split to two --- .../create_synonyms_and_grants_for_user.sql | 178 ------------------ 1 file changed, 178 deletions(-) delete mode 100644 source/create_synonyms_and_grants_for_user.sql diff --git a/source/create_synonyms_and_grants_for_user.sql b/source/create_synonyms_and_grants_for_user.sql deleted file mode 100644 index 3044cb32f..000000000 --- a/source/create_synonyms_and_grants_for_user.sql +++ /dev/null @@ -1,178 +0,0 @@ -/* - utPLSQL - Version 3 - Copyright 2016 - 2017 utPLSQL Project - - 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. - -Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework -*/ - -@@define_ut3_owner_param.sql - -column 2 new_value 2 noprint -select null as "2" from dual where 1=0; -spool params.sql.tmp -select - case - when '&&2' is null then q'[ACCEPT ut3_user CHAR PROMPT 'Provide schema name where synonyms for the utPLSQL v3 should be created ']' - else 'define ut3_user=&&2' - end -from dual; -spool off -set termout on -@params.sql.tmp -set termout off -/* cleanup temporary sql files */ ---try running on windows -$ del params.sql.tmp ---try running on linux/unix -! rm params.sql.tmp -set termout on - -set echo off -set feedback on -set heading off -set verify off - -prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to user &&ut3_user - -whenever sqlerror exit failure rollback -whenever oserror exit failure rollback - -alter session set current_schema = &&ut3_owner; - -grant execute on &&ut3_owner..ut_be_between to &ut3_user; -grant execute on &&ut3_owner..ut_be_empty to &ut3_user; -grant execute on &&ut3_owner..ut_be_false to &ut3_user; -grant execute on &&ut3_owner..ut_be_greater_or_equal to &ut3_user; -grant execute on &&ut3_owner..ut_be_greater_than to &ut3_user; -grant execute on &&ut3_owner..ut_be_less_or_equal to &ut3_user; -grant execute on &&ut3_owner..ut_be_less_than to &ut3_user; -grant execute on &&ut3_owner..ut_be_like to &ut3_user; -grant execute on &&ut3_owner..ut_be_not_null to &ut3_user; -grant execute on &&ut3_owner..ut_be_null to &ut3_user; -grant execute on &&ut3_owner..ut_be_true to &ut3_user; -grant execute on &&ut3_owner..ut_equal to &ut3_user; -grant execute on &&ut3_owner..ut_have_count to &ut3_user; -grant execute on &&ut3_owner..ut_match to &ut3_user; -grant execute on &&ut3_owner..ut to &ut3_user; -grant execute on &&ut3_owner..ut_runner to &ut3_user; -grant execute on &&ut3_owner..ut_teamcity_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_xunit_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_junit_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_tfs_junit_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_documentation_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_coverage_html_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_coverage_sonar_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_coveralls_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_coverage_cobertura_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_reporters to &ut3_user; -grant execute on &&ut3_owner..ut_varchar2_list to &ut3_user; -grant execute on &&ut3_owner..ut_varchar2_rows to &ut3_user; -grant execute on &&ut3_owner..ut_integer_list to &ut3_user; -grant execute on &&ut3_owner..ut_reporter_base to &ut3_user; -grant execute on &&ut3_owner..ut_output_reporter_base to &ut3_user; -grant execute on &&ut3_owner..ut_coverage_reporter_base to &ut3_user; -grant execute on &&ut3_owner..ut_console_reporter_base to &ut3_user; -grant execute on &&ut3_owner..ut_coverage to &ut3_user; -grant execute on &&ut3_owner..ut_coverage_options to &ut3_user; -grant execute on &&ut3_owner..ut_coverage_helper to &ut3_user; -grant execute on &&ut3_owner..ut_output_buffer_base to &ut3_user; -grant execute on &&ut3_owner..ut_output_table_buffer to &ut3_user; -grant execute on &&ut3_owner..ut_file_mappings to &ut3_user; -grant execute on &&ut3_owner..ut_file_mapping to &ut3_user; -grant execute on &&ut3_owner..ut_file_mapper to &ut3_user; -grant execute on &&ut3_owner..ut_key_value_pairs to &ut3_user; -grant execute on &&ut3_owner..ut_key_value_pair to &ut3_user; -grant select, insert, delete on &&ut3_owner..ut_compound_data_tmp to &ut3_user; -grant select, insert, delete on &&ut3_owner..ut_compound_data_diff_tmp to &ut3_user; -grant execute on &&ut3_owner..ut_sonar_test_reporter to &ut3_user; -grant execute on &&ut3_owner..ut_annotations to &ut3_user; -grant execute on &&ut3_owner..ut_annotation to &ut3_user; -grant execute on &&ut3_owner..ut_annotation_manager to &ut3_user; -grant execute on &&ut3_owner..ut_annotated_object to &ut3_user; -grant execute on &&ut3_owner..ut_annotated_objects to &ut3_user; -grant select on &&ut3_owner..ut_annotation_cache_info to &ut3_user; -grant select on &&ut3_owner..ut_annotation_cache to &ut3_user; -grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user; -grant execute on &&ut3_owner..ut_annotation_parser to &ut3_user; -grant execute on &&ut3_owner..ut_annotation_objs_cache_info to &ut3_user; -grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &ut3_user; -begin - $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then - execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_blocks to &ut3_user'; - execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_runs to &ut3_user'; - execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_units to &ut3_user'; - $else - null; - $end -end; -/ - - -prompt Creating synonyms for UTPLSQL objects in &&ut3_owner schema to user &&ut3_user - -create or replace synonym &ut3_user..be_between for &&ut3_owner..be_between; -create or replace synonym &ut3_user..be_empty for &&ut3_owner..be_empty; -create or replace synonym &ut3_user..be_false for &&ut3_owner..be_false; -create or replace synonym &ut3_user..be_greater_or_equal for &&ut3_owner..be_greater_or_equal; -create or replace synonym &ut3_user..be_greater_than for &&ut3_owner..be_greater_than; -create or replace synonym &ut3_user..be_less_or_equal for &&ut3_owner..be_less_or_equal; -create or replace synonym &ut3_user..be_less_than for &&ut3_owner..be_less_than; -create or replace synonym &ut3_user..be_like for &&ut3_owner..be_like; -create or replace synonym &ut3_user..be_not_null for &&ut3_owner..be_not_null; -create or replace synonym &ut3_user..be_null for &&ut3_owner..be_null; -create or replace synonym &ut3_user..be_true for &&ut3_owner..be_true; -create or replace synonym &ut3_user..equal for &&ut3_owner..equal; -create or replace synonym &ut3_user..have_count for &&ut3_owner..have_count; -create or replace synonym &ut3_user..match for &&ut3_owner..match; -create or replace synonym &ut3_user..ut for &&ut3_owner..ut; -create or replace synonym &ut3_user..ut_runner for &&ut3_owner..ut_runner; -create or replace synonym &ut3_user..ut_teamcity_reporter for &&ut3_owner..ut_teamcity_reporter; -create or replace synonym &ut3_user..ut_xunit_reporter for &&ut3_owner..ut_xunit_reporter; -create or replace synonym &ut3_user..ut_junit_reporter for &&ut3_owner..ut_junit_reporter; -create or replace synonym &ut3_user..ut_tfs_junit_reporter for &&ut3_owner..ut_tfs_junit_reporter; -create or replace synonym &ut3_user..ut_documentation_reporter for &&ut3_owner..ut_documentation_reporter; -create or replace synonym &ut3_user..ut_coverage_html_reporter for &&ut3_owner..ut_coverage_html_reporter; -create or replace synonym &ut3_user..ut_coverage_sonar_reporter for &&ut3_owner..ut_coverage_sonar_reporter; -create or replace synonym &ut3_user..ut_coveralls_reporter for &&ut3_owner..ut_coveralls_reporter; -create or replace synonym &ut3_user..ut_coverage_cobertura_reporter for &&ut3_owner..ut_coverage_cobertura_reporter; -create or replace synonym &ut3_user..ut_reporters for &&ut3_owner..ut_reporters; -create or replace synonym &ut3_user..ut_varchar2_list for &&ut3_owner..ut_varchar2_list; -create or replace synonym &ut3_user..ut_varchar2_rows for &&ut3_owner..ut_varchar2_rows; -create or replace synonym &ut3_user..ut_integer_list for &&ut3_owner..ut_integer_list; -create or replace synonym &ut3_user..ut_reporter_base for &&ut3_owner..ut_reporter_base; -create or replace synonym &ut3_user..ut_output_reporter_base for &&ut3_owner..ut_output_reporter_base; -create or replace synonym &ut3_user..ut_coverage for &&ut3_owner..ut_coverage; -create or replace synonym &ut3_user..ut_coverage_options for &&ut3_owner..ut_coverage_options; -create or replace synonym &ut3_user..ut_coverage_helper for &&ut3_owner..ut_coverage_helper; -create or replace synonym &ut3_user..ut_output_buffer_base for &&ut3_owner..ut_output_buffer_base; -create or replace synonym &ut3_user..ut_output_table_buffer for &&ut3_owner..ut_output_table_buffer; -create or replace synonym &ut3_user..ut_file_mappings for &&ut3_owner..ut_file_mappings; -create or replace synonym &ut3_user..ut_file_mapping for &&ut3_owner..ut_file_mapping; -create or replace synonym &ut3_user..ut_file_mapper for &&ut3_owner..ut_file_mapper; -create or replace synonym &ut3_user..ut_key_value_pairs for &&ut3_owner..ut_key_value_pairs; -create or replace synonym &ut3_user..ut_key_value_pair for &&ut3_owner..ut_key_value_pair; -create or replace synonym &ut3_user..ut_compound_data_tmp for &&ut3_owner..ut_cursor_data; -create or replace synonym &ut3_user..ut_compound_data_diff_tmp for &&ut3_owner..ut_compound_data_diff_tmp; -create or replace synonym &ut3_user..ut_sonar_test_reporter for &&ut3_owner..ut_sonar_test_reporter; -begin - $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then - execute immediate 'create or replace synonym &ut3_user..dbmspcc_blocks for &&ut3_owner..dbmspcc_blocks'; - execute immediate 'create or replace synonym &ut3_user..dbmspcc_runs for &&ut3_owner..dbmspcc_runs'; - execute immediate 'create or replace synonym &ut3_user..dbmspcc_units for &&ut3_owner..dbmspcc_units'; - $else - null; - $end -end; -/ From f33dd276510c9d494c6838943f84fc0617f7358d Mon Sep 17 00:00:00 2001 From: Peter Ocelka Date: Fri, 4 May 2018 19:41:49 +0200 Subject: [PATCH 3/6] added for #658 --- source/create_user_grants.sql | 120 ++++++++++++++++++++++++++++++++ source/create_user_synonyms.sql | 109 +++++++++++++++++++++++++++++ 2 files changed, 229 insertions(+) create mode 100644 source/create_user_grants.sql create mode 100644 source/create_user_synonyms.sql diff --git a/source/create_user_grants.sql b/source/create_user_grants.sql new file mode 100644 index 000000000..76406ece9 --- /dev/null +++ b/source/create_user_grants.sql @@ -0,0 +1,120 @@ +/* + utPLSQL - Version 3 + Copyright 2016 - 2017 utPLSQL Project + + 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. + +Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework +*/ + +@@define_ut3_owner_param.sql + +column 2 new_value 2 noprint +select null as "2" from dual where 1=0; +spool params.sql.tmp +select + case + when '&&2' is null then q'[ACCEPT ut3_user CHAR PROMPT 'Provide schema to which should be granted the utPLSQL v3 ']' + else 'define ut3_user=&&2' + end +from dual; +spool off +set termout on +@params.sql.tmp +set termout off +/* cleanup temporary sql files */ +--try running on windows +$ del params.sql.tmp +--try running on linux/unix +! rm params.sql.tmp +set termout on + +set echo off +set feedback on +set heading off +set verify off + +prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to user &&ut3_user + +whenever sqlerror exit failure rollback +whenever oserror exit failure rollback + +alter session set current_schema = &&ut3_owner; + +grant execute on &&ut3_owner..ut_be_between to &ut3_user; +grant execute on &&ut3_owner..ut_be_empty to &ut3_user; +grant execute on &&ut3_owner..ut_be_false to &ut3_user; +grant execute on &&ut3_owner..ut_be_greater_or_equal to &ut3_user; +grant execute on &&ut3_owner..ut_be_greater_than to &ut3_user; +grant execute on &&ut3_owner..ut_be_less_or_equal to &ut3_user; +grant execute on &&ut3_owner..ut_be_less_than to &ut3_user; +grant execute on &&ut3_owner..ut_be_like to &ut3_user; +grant execute on &&ut3_owner..ut_be_not_null to &ut3_user; +grant execute on &&ut3_owner..ut_be_null to &ut3_user; +grant execute on &&ut3_owner..ut_be_true to &ut3_user; +grant execute on &&ut3_owner..ut_equal to &ut3_user; +grant execute on &&ut3_owner..ut_have_count to &ut3_user; +grant execute on &&ut3_owner..ut_match to &ut3_user; +grant execute on &&ut3_owner..ut to &ut3_user; +grant execute on &&ut3_owner..ut_runner to &ut3_user; +grant execute on &&ut3_owner..ut_teamcity_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_xunit_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_junit_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_tfs_junit_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_documentation_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_coverage_html_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_coverage_sonar_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_coveralls_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_coverage_cobertura_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_reporters to &ut3_user; +grant execute on &&ut3_owner..ut_varchar2_list to &ut3_user; +grant execute on &&ut3_owner..ut_varchar2_rows to &ut3_user; +grant execute on &&ut3_owner..ut_integer_list to &ut3_user; +grant execute on &&ut3_owner..ut_reporter_base to &ut3_user; +grant execute on &&ut3_owner..ut_output_reporter_base to &ut3_user; +grant execute on &&ut3_owner..ut_coverage_reporter_base to &ut3_user; +grant execute on &&ut3_owner..ut_console_reporter_base to &ut3_user; +grant execute on &&ut3_owner..ut_coverage to &ut3_user; +grant execute on &&ut3_owner..ut_coverage_options to &ut3_user; +grant execute on &&ut3_owner..ut_coverage_helper to &ut3_user; +grant execute on &&ut3_owner..ut_output_buffer_base to &ut3_user; +grant execute on &&ut3_owner..ut_output_table_buffer to &ut3_user; +grant execute on &&ut3_owner..ut_file_mappings to &ut3_user; +grant execute on &&ut3_owner..ut_file_mapping to &ut3_user; +grant execute on &&ut3_owner..ut_file_mapper to &ut3_user; +grant execute on &&ut3_owner..ut_key_value_pairs to &ut3_user; +grant execute on &&ut3_owner..ut_key_value_pair to &ut3_user; +grant select, insert, delete on &&ut3_owner..ut_compound_data_tmp to &ut3_user; +grant select, insert, delete on &&ut3_owner..ut_compound_data_diff_tmp to &ut3_user; +grant execute on &&ut3_owner..ut_sonar_test_reporter to &ut3_user; +grant execute on &&ut3_owner..ut_annotations to &ut3_user; +grant execute on &&ut3_owner..ut_annotation to &ut3_user; +grant execute on &&ut3_owner..ut_annotation_manager to &ut3_user; +grant execute on &&ut3_owner..ut_annotated_object to &ut3_user; +grant execute on &&ut3_owner..ut_annotated_objects to &ut3_user; +grant select on &&ut3_owner..ut_annotation_cache_info to &ut3_user; +grant select on &&ut3_owner..ut_annotation_cache to &ut3_user; +grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user; +grant execute on &&ut3_owner..ut_annotation_parser to &ut3_user; +grant execute on &&ut3_owner..ut_annotation_objs_cache_info to &ut3_user; +grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &ut3_user; +begin + $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then + execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_blocks to &ut3_user'; + execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_runs to &ut3_user'; + execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_units to &ut3_user'; + $else + null; + $end +end; +/ diff --git a/source/create_user_synonyms.sql b/source/create_user_synonyms.sql new file mode 100644 index 000000000..729ba4002 --- /dev/null +++ b/source/create_user_synonyms.sql @@ -0,0 +1,109 @@ +/* + utPLSQL - Version 3 + Copyright 2016 - 2017 utPLSQL Project + + 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. + +Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework +*/ + +@@define_ut3_owner_param.sql + +column 2 new_value 2 noprint +select null as "2" from dual where 1=0; +spool params.sql.tmp +select + case + when '&&2' is null then q'[ACCEPT ut3_user CHAR PROMPT 'Provide schema name where synonyms for the utPLSQL v3 should be created ']' + else 'define ut3_user=&&2' + end +from dual; +spool off +set termout on +@params.sql.tmp +set termout off +/* cleanup temporary sql files */ +--try running on windows +$ del params.sql.tmp +--try running on linux/unix +! rm params.sql.tmp +set termout on + +set echo off +set feedback on +set heading off +set verify off + +prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to user &&ut3_user + +whenever sqlerror exit failure rollback +whenever oserror exit failure rollback + +alter session set current_schema = &&ut3_owner; + +prompt Creating synonyms for UTPLSQL objects in &&ut3_owner schema to user &&ut3_user + +create or replace synonym &ut3_user..be_between for &&ut3_owner..be_between; +create or replace synonym &ut3_user..be_empty for &&ut3_owner..be_empty; +create or replace synonym &ut3_user..be_false for &&ut3_owner..be_false; +create or replace synonym &ut3_user..be_greater_or_equal for &&ut3_owner..be_greater_or_equal; +create or replace synonym &ut3_user..be_greater_than for &&ut3_owner..be_greater_than; +create or replace synonym &ut3_user..be_less_or_equal for &&ut3_owner..be_less_or_equal; +create or replace synonym &ut3_user..be_less_than for &&ut3_owner..be_less_than; +create or replace synonym &ut3_user..be_like for &&ut3_owner..be_like; +create or replace synonym &ut3_user..be_not_null for &&ut3_owner..be_not_null; +create or replace synonym &ut3_user..be_null for &&ut3_owner..be_null; +create or replace synonym &ut3_user..be_true for &&ut3_owner..be_true; +create or replace synonym &ut3_user..equal for &&ut3_owner..equal; +create or replace synonym &ut3_user..have_count for &&ut3_owner..have_count; +create or replace synonym &ut3_user..match for &&ut3_owner..match; +create or replace synonym &ut3_user..ut for &&ut3_owner..ut; +create or replace synonym &ut3_user..ut_runner for &&ut3_owner..ut_runner; +create or replace synonym &ut3_user..ut_teamcity_reporter for &&ut3_owner..ut_teamcity_reporter; +create or replace synonym &ut3_user..ut_xunit_reporter for &&ut3_owner..ut_xunit_reporter; +create or replace synonym &ut3_user..ut_junit_reporter for &&ut3_owner..ut_junit_reporter; +create or replace synonym &ut3_user..ut_tfs_junit_reporter for &&ut3_owner..ut_tfs_junit_reporter; +create or replace synonym &ut3_user..ut_documentation_reporter for &&ut3_owner..ut_documentation_reporter; +create or replace synonym &ut3_user..ut_coverage_html_reporter for &&ut3_owner..ut_coverage_html_reporter; +create or replace synonym &ut3_user..ut_coverage_sonar_reporter for &&ut3_owner..ut_coverage_sonar_reporter; +create or replace synonym &ut3_user..ut_coveralls_reporter for &&ut3_owner..ut_coveralls_reporter; +create or replace synonym &ut3_user..ut_coverage_cobertura_reporter for &&ut3_owner..ut_coverage_cobertura_reporter; +create or replace synonym &ut3_user..ut_reporters for &&ut3_owner..ut_reporters; +create or replace synonym &ut3_user..ut_varchar2_list for &&ut3_owner..ut_varchar2_list; +create or replace synonym &ut3_user..ut_varchar2_rows for &&ut3_owner..ut_varchar2_rows; +create or replace synonym &ut3_user..ut_integer_list for &&ut3_owner..ut_integer_list; +create or replace synonym &ut3_user..ut_reporter_base for &&ut3_owner..ut_reporter_base; +create or replace synonym &ut3_user..ut_output_reporter_base for &&ut3_owner..ut_output_reporter_base; +create or replace synonym &ut3_user..ut_coverage for &&ut3_owner..ut_coverage; +create or replace synonym &ut3_user..ut_coverage_options for &&ut3_owner..ut_coverage_options; +create or replace synonym &ut3_user..ut_coverage_helper for &&ut3_owner..ut_coverage_helper; +create or replace synonym &ut3_user..ut_output_buffer_base for &&ut3_owner..ut_output_buffer_base; +create or replace synonym &ut3_user..ut_output_table_buffer for &&ut3_owner..ut_output_table_buffer; +create or replace synonym &ut3_user..ut_file_mappings for &&ut3_owner..ut_file_mappings; +create or replace synonym &ut3_user..ut_file_mapping for &&ut3_owner..ut_file_mapping; +create or replace synonym &ut3_user..ut_file_mapper for &&ut3_owner..ut_file_mapper; +create or replace synonym &ut3_user..ut_key_value_pairs for &&ut3_owner..ut_key_value_pairs; +create or replace synonym &ut3_user..ut_key_value_pair for &&ut3_owner..ut_key_value_pair; +create or replace synonym &ut3_user..ut_compound_data_tmp for &&ut3_owner..ut_cursor_data; +create or replace synonym &ut3_user..ut_compound_data_diff_tmp for &&ut3_owner..ut_compound_data_diff_tmp; +create or replace synonym &ut3_user..ut_sonar_test_reporter for &&ut3_owner..ut_sonar_test_reporter; +begin + $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then + execute immediate 'create or replace synonym &ut3_user..dbmspcc_blocks for &&ut3_owner..dbmspcc_blocks'; + execute immediate 'create or replace synonym &ut3_user..dbmspcc_runs for &&ut3_owner..dbmspcc_runs'; + execute immediate 'create or replace synonym &ut3_user..dbmspcc_units for &&ut3_owner..dbmspcc_units'; + $else + null; + $end +end; +/ From 312138276b6de17d55f979bf75f6d690c391c13a Mon Sep 17 00:00:00 2001 From: Peter Ocelka Date: Fri, 4 May 2018 19:42:48 +0200 Subject: [PATCH 4/6] updated section for other users due to changes introduced in #658 --- docs/userguide/install.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/userguide/install.md b/docs/userguide/install.md index 88e2a2e63..fdc91b08c 100644 --- a/docs/userguide/install.md +++ b/docs/userguide/install.md @@ -135,12 +135,13 @@ Example invocation: cd source sqlplus admin/admins_password@database @create_synonyms_and_grants_for_public.sql ut3 ``` -To grant utPLSQL to an individual user, execute script `source/create_synonyms_and_grants_for_user.sql`, provide `schema_name` where utPLSQL is installed and `user_name` to grant access for. +To grant utPLSQL to an individual user, execute scripts `source/create_user_grants.sql` and `source/create_user_synonyms.sql`, provide `schema_name` where utPLSQL is installed and `user_name` to grant access for. Example invocation: ```bash cd source -sqlplus admin/admins_password@database @create_synonyms_and_grants_for_user.sql ut3 hr +sqlplus admin/admins_password@database @create_user_grants.sql ut3 hr +sqlplus user/user_password@database @create_user_synonyms.sql ut3 hr ``` The following tools that support the SQL*Plus commands can be used to run the installation script: From f43b76e29b54346b47357f1a51839aafe7e7ca24 Mon Sep 17 00:00:00 2001 From: Peter Ocelka Date: Fri, 4 May 2018 19:43:41 +0200 Subject: [PATCH 5/6] Added missing objects to avoid errors when new installation is not performed also with new user creation; Added purge for UT_OUTPUT_BUFFER_TMP$ to drop also overflow segment table --- source/uninstall.sql | 77 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/source/uninstall.sql b/source/uninstall.sql index 6da0e4fd9..7d717dae8 100644 --- a/source/uninstall.sql +++ b/source/uninstall.sql @@ -242,7 +242,7 @@ drop type ut_output_buffer_base force; drop view ut_output_buffer_tmp; -drop table ut_output_buffer_tmp$; +drop table ut_output_buffer_tmp$ purge; drop view ut_output_buffer_info_tmp; @@ -276,6 +276,16 @@ drop type ut_varchar2_list force; drop type ut_varchar2_rows force; +drop package ut_coverage_profiler; + +drop package ut_compound_data_helper; + +drop package ut_coverage_helper_profiler; + +drop type ut_have_count; + +drop type ut_compound_data_value; + set echo off set feedback off declare @@ -306,6 +316,71 @@ begin dbms_output.put_line(i||' synonyms dropped'); end; / + +declare + i integer := 0; +begin + dbms_output.put_line('Dropping synonyms pointing to PL/SQL code coverage objects on 12.2 ' || upper('&&ut3_owner')); + for syn in ( + select + case when owner = 'PUBLIC' then 'public synonym ' + else 'synonym ' || owner || '.' + end || synonym_name as syn_name, + table_owner || '.' || table_name as for_object + from all_synonyms s + where 1 = 1 + and table_owner = upper('&&ut3_owner') + and synonym_name in ('DBMSPCC_BLOCKS','DBMSPCC_RUNS','DBMSPCC_UNITS') + ) + loop + + begin + + execute immediate 'drop '||syn.syn_name; + sys.dbms_output.put_line('Dropped '||syn.syn_name||' for object '||syn.for_object); + + i := i + 1; + exception + when others then + sys.dbms_output.put_line('FAILED to drop '||syn.syn_name||' for object '||syn.for_object); + end; + end loop; + sys.dbms_output.put_line('&&line_separator'); + sys.dbms_output.put_line(i||' synonyms dropped'); +end; +/ + +declare + i integer := 0; +begin + sys.dbms_output.put_line('Dropping packages created for 12.2+ ' || upper('&&ut3_owner')); + + for pkg in (select object_name, owner + from all_objects + where 1 = 1 + and owner = upper('&&ut3_owner') + and object_type = 'PACKAGE' + and object_name in ('UT_COVERAGE_HELPER_BLOCK','UT_COVERAGE_BLOCK')) + loop + + begin + execute immediate 'drop package ' || pkg.owner || '.' || pkg.object_name; + + sys.dbms_output.put_line('Dropped '|| pkg.object_name); + i := i + 1; + + exception + when others then + dbms_output.put_line('FAILED to drop ' || pkg.object_name); + end; + + end loop; + + sys.dbms_output.put_line('&&line_separator'); + sys.dbms_output.put_line(i || ' packages dropped'); +end; +/ + begin dbms_output.put_line('&&line_separator'); dbms_output.put_line('Uninstall complete'); From 8e8c3e6e117b2595847fd67558d7172bc19a3c5e Mon Sep 17 00:00:00 2001 From: Peter Ocelka Date: Fri, 4 May 2018 21:47:29 +0200 Subject: [PATCH 6/6] changed user to execute user grants --- docs/userguide/install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/install.md b/docs/userguide/install.md index fdc91b08c..994aa14c0 100644 --- a/docs/userguide/install.md +++ b/docs/userguide/install.md @@ -140,7 +140,7 @@ To grant utPLSQL to an individual user, execute scripts `source/create_user_gran Example invocation: ```bash cd source -sqlplus admin/admins_password@database @create_user_grants.sql ut3 hr +sqlplus ut3_user/ut3_password@database @create_user_grants.sql ut3 hr sqlplus user/user_password@database @create_user_synonyms.sql ut3 hr ```