Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand All @@ -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
Expand Down
77 changes: 61 additions & 16 deletions source/core/coverage/proftab.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
create table plsql_profiler_runs
declare
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still thinking if we should make scripts rerunable or drop objects on uninstall.
Also, since we modify script provided from Oracle, should we split it into one script per object?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't drop it. Could you explain why do you want to split it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a pattern of one script for one object so this script is the only one breaking the pattern

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but its an oracle object, not our... But I can fix it tonight

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, lets leave it as it is

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 in (user,'PUBLIC')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot have any table with owner = 'PUBLIC'

union all
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_RUNS');
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
Expand All @@ -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 in (user,'PUBLIC')
union all
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_UNITS');
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 #
Expand All @@ -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 in (user,'PUBLIC');
Copy link
Copy Markdown
Member

@jgebal jgebal Jul 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; at the end.

union all
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_DATA');
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 #
Expand All @@ -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 in (user,'PUBLIC');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; at the end

union all
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_RUNNUMBER');
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;
/

5 changes: 0 additions & 5 deletions source/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 0 additions & 2 deletions source/install_headless.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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