-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sql
More file actions
172 lines (139 loc) · 4.31 KB
/
Copy pathinstall.sql
File metadata and controls
172 lines (139 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
--
-- Core Installation
--
-- Capture output
spool install
-- Shared Setup Script
@common_setup.sql
WHENEVER SQLERROR exit SQL.SQLCODE
begin
if USER not in ('SYS','SYSTEM')
then
raise_application_error (-20000,
'Not logged in as SYS or SYSTEM');
end if;
end;
/
WHENEVER SQLERROR continue
-- Create the schema owner.
create user &schema_owner. identified by &schema_owner.
default tablespace users
temporary tablespace temp;
grant connect, resource to &schema_owner.;
begin
for buff in (select p.value PLSQL_CCFLAGS
from dual d
left join v$parameter p
on p.name in 'plsql_ccflags')
loop
dbms_output.put_line('PLSQL_CCFLAGS Before: ' || buff.PLSQL_CCFLAGS);
end loop;
end;
/
-- This block is IDEMPOTENT. It can run more than once and give
-- the same result.
declare
C_FLAG CONSTANT varchar2(100) := 'WTPLSQL_ENABLE:';
parm_value v$parameter.value%TYPE;
procedure set_plsql_ccflags (in_value in varchar2) is begin
execute immediate 'alter system set PLSQL_CCFLAGS = ''' ||
in_value || ''' scope=BOTH';
end set_plsql_ccflags;
begin
select value into parm_value
from v$parameter
where name in 'plsql_ccflags';
if nvl(length(parm_value),0) = 0
then
-- No Flags have been set
set_plsql_ccflags(C_FLAG || 'TRUE');
elsif instr(parm_value, C_FLAG) = 0
then
-- C_FLAG is not already present
set_plsql_ccflags(C_FLAG || 'TRUE, ' || parm_value);
end if;
end;
/
begin
for buff in (select p.value PLSQL_CCFLAGS
from dual d
left join v$parameter p
on p.name in 'plsql_ccflags')
loop
dbms_output.put_line('PLSQL_CCFLAGS After: ' || buff.PLSQL_CCFLAGS);
end loop;
end;
/
-- Public Synonyms
create or replace public synonym wt_test_runs_seq for &schema_owner..wt_test_runs_seq;
create or replace public synonym wt_test_runs for &schema_owner..wt_test_runs;
create or replace public synonym wt_results for &schema_owner..wt_results;
create or replace public synonym wt_dbout_profiles for &schema_owner..wt_dbout_profiles;
create or replace public synonym wt_not_executable for &schema_owner..wt_not_executable;
create or replace public synonym plsql_profiler_runs for &schema_owner..plsql_profiler_runs;
create or replace public synonym plsql_profiler_units for &schema_owner..plsql_profiler_units;
create or replace public synonym plsql_profiler_data for &schema_owner..plsql_profiler_data;
--create or replace public synonym ut_assert for &schema_owner..wt_assert;
create or replace public synonym wt_assert for &schema_owner..wt_assert;
create or replace public synonym wt_profiler for &schema_owner..wt_profiler;
create or replace public synonym wt_result for &schema_owner..wt_result;
create or replace public synonym wt_text_report for &schema_owner..wt_text_report;
create or replace public synonym wt_wtplsql for &schema_owner..wtplsql;
create or replace public synonym wtplsql for &schema_owner..wtplsql;
WHENEVER SQLERROR exit SQL.SQLCODE
-- Connect as SCHEMA_OWNER
connect &schema_owner./&schema_owner.
begin
if USER != upper('&schema_owner')
then
raise_application_error (-20000,
'Not logged in as &schema_owner');
end if;
end;
/
WHENEVER SQLERROR continue
--
-- Run Oracle's Profiler Table Installation
-- Note1: Tables converted to Global Temporary
-- Note2: Includes "Drop Table" and "Drop Sequence" statements
--
@proftab.sql
--
create index plsql_profiler_runs_idx1
on plsql_profiler_runs (run_date);
grant select, insert, delete on plsql_profiler_runs to public;
grant select, insert, delete on plsql_profiler_units to public;
grant select, insert, delete on plsql_profiler_data to public;
-- Core Tables
@wt_test_runs.tab
@wt_results.tab
@wt_dbout_profiles.tab
@wt_test_data.tab
-- Package Specifications
@wtplsql.pks
/
grant execute on wtplsql to public;
@wt_result.pks
/
grant execute on wt_result to public;
@wt_assert.pks
/
grant execute on wt_assert to public;
@wt_profiler.pks
/
grant execute on wt_profiler to public;
@wt_text_report.pks
/
grant execute on wt_text_report to public;
-- Package Bodies
@wtplsql.pkb
/
@wt_result.pkb
/
@wt_assert.pkb
/
@wt_profiler.pkb
/
@wt_text_report.pkb
/
spool off