diff --git a/.travis/install.sh b/.travis/install.sh index 909361a5a..4a319d5bc 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -8,12 +8,18 @@ pwd set feedback off set verify off -@../source/create_utplsql_owner.sql $UT3_OWNER $UT3_OWNER_PASSWORD $UT3_TABLESPACE +--@../source/create_utplsql_owner.sql $UT3_OWNER $UT3_OWNER_PASSWORD $UT3_TABLESPACE +@../source/install_headless.sql + +set feedback on +--change the deafult password +alter user $UT3_OWNER identified by $UT3_OWNER_PASSWORD; --needed for Mystats script to work grant select any dictionary to $UT3_OWNER; --Needed for testing a coverage outside ut3_owner. grant create any procedure, execute any procedure to $UT3_OWNER; +set feedback off @../source/create_utplsql_owner.sql $UT3_USER $UT3_USER_PASSWORD $UT3_TABLESPACE cd .. @@ -23,10 +29,10 @@ cd .. --@ut_debug_enable.sql --cd .. -cd source -@install.sql $UT3_OWNER -@create_synonyms_and_grants_for_user.sql $UT3_OWNER $UT3_USER -cd .. +--cd source +--@install.sql $UT3_OWNER +--@create_synonyms_and_grants_for_user.sql $UT3_OWNER $UT3_USER +--cd .. cd development conn $UT3_OWNER/$UT3_OWNER_PASSWORD@//$CONNECTION_STR diff --git a/source/core/coverage/proftab.sql b/source/core/coverage/proftab.sql index d8d2d915b..ad0caa458 100644 --- a/source/core/coverage/proftab.sql +++ b/source/core/coverage/proftab.sql @@ -1,4 +1,12 @@ -create table plsql_profiler_runs +declare + l_tab_exist number; +begin + select count(*) into l_tab_exist from + (select table_name from all_tables where table_name = 'PLSQL_PROFILER_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA') + union all + select synonym_name from all_synonyms where synonym_name = 'PLSQL_PROFILER_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA')); + if l_tab_exist = 0 then + execute immediate q'[create table plsql_profiler_runs ( runid number primary key, -- unique run identifier, -- from plsql_profiler_runnumber @@ -11,12 +19,23 @@ create table plsql_profiler_runs run_system_info varchar2(2047), -- currently unused run_comment1 varchar2(2047), -- additional comment spare1 varchar2(256) -- unused -); +)]'; + execute immediate q'[comment on table plsql_profiler_runs is + 'Run-specific information for the PL/SQL profiler']'; + dbms_output.put_line('PLSQL_PROFILER_RUNS table created'); + end if; +end; +/ -comment on table plsql_profiler_runs is - 'Run-specific information for the PL/SQL profiler'; - -create table plsql_profiler_units +declare + l_tab_exist number; +begin + select count(*) into l_tab_exist from + (select table_name from all_tables where table_name = 'PLSQL_PROFILER_UNITS' and owner = sys_context('USERENV','CURRENT_SCHEMA') + union all + select synonym_name from all_synonyms where synonym_name = 'PLSQL_PROFILER_UNITS' and owner = sys_context('USERENV','CURRENT_SCHEMA')); + if l_tab_exist = 0 then + execute immediate q'[create table plsql_profiler_units ( runid number references plsql_profiler_runs, unit_number number, -- internally generated library unit # @@ -31,12 +50,23 @@ create table plsql_profiler_units spare2 number, -- unused -- primary key (runid, unit_number) -); - -comment on table plsql_profiler_units is - 'Information about each library unit in a run'; +)]'; + execute immediate q'[comment on table plsql_profiler_units is + 'Information about each library unit in a run']'; + dbms_output.put_line('PLSQL_PROFILER_UNITS table created'); + end if; +end; +/ -create table plsql_profiler_data +declare + l_tab_exist number; +begin + select count(*) into l_tab_exist from + (select table_name from all_tables where table_name = 'PLSQL_PROFILER_DATA' and owner = sys_context('USERENV','CURRENT_SCHEMA') + union all + select synonym_name from all_synonyms where synonym_name = 'PLSQL_PROFILER_DATA' and owner = sys_context('USERENV','CURRENT_SCHEMA')); + if l_tab_exist = 0 then + execute immediate q'[create table plsql_profiler_data ( runid number, -- unique (generated) run identifier unit_number number, -- internally generated library unit # @@ -52,10 +82,25 @@ create table plsql_profiler_data -- primary key (runid, unit_number, line#), foreign key (runid, unit_number) references plsql_profiler_units -); - -comment on table plsql_profiler_data is - 'Accumulated data from all profiler runs'; +)]'; + execute immediate q'[comment on table plsql_profiler_data is + 'Accumulated data from all profiler runs']'; + dbms_output.put_line('PLSQL_PROFILER_DATA table created'); + end if; +end; +/ -create sequence plsql_profiler_runnumber start with 1 nocache; +declare + l_seq_exist number; +begin + select count(*) into l_seq_exist from + (select sequence_name from all_sequences where sequence_name = 'PLSQL_PROFILER_RUNNUMBER' and sequence_owner = sys_context('USERENV','CURRENT_SCHEMA') + union all + select synonym_name from all_synonyms where synonym_name = 'PLSQL_PROFILER_RUNNUMBER' and owner = sys_context('USERENV','CURRENT_SCHEMA')); + if l_seq_exist = 0 then + execute immediate q'[create sequence plsql_profiler_runnumber start with 1 nocache]'; + dbms_output.put_line('Sequence PLSQL_PROFILER_RUNNUMBER created'); + end if; +end; +/ diff --git a/source/install.sql b/source/install.sql index 0ccf2a078..c4907d8f4 100644 --- a/source/install.sql +++ b/source/install.sql @@ -87,12 +87,7 @@ alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(5004,5018,6000,6001,6 @@install_component.sql 'core/ut_expectation_processor.pkb' prompt Installing PLSQL profiler objects into &&ut3_owner schema -prompt You will see "ORA-00955" errors if they already exist -prompt &&line_separator -whenever sqlerror continue -set feedback on @@core/coverage/proftab.sql -whenever sqlerror exit failure rollback @@install_component.sql 'core/ut_file_mapper.pks' @@install_component.sql 'core/ut_file_mapper.pkb' diff --git a/source/install_headless.sql b/source/install_headless.sql index 69513fcd3..36fe8f6a3 100644 --- a/source/install_headless.sql +++ b/source/install_headless.sql @@ -21,5 +21,3 @@ define ut3_tablespace = users @@create_utplsql_owner.sql &&ut3_owner &&ut3_password &&ut3_tablespace @@install.sql &&ut3_owner @@create_synonyms_and_grants_for_public.sql &&ut3_owner - -exit