-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sql
More file actions
183 lines (156 loc) · 4.51 KB
/
Copy pathinstall.sql
File metadata and controls
183 lines (156 loc) · 4.51 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
173
174
175
176
177
178
179
180
181
182
183
--
-- Core Installation
--
-- Run as System
--
-- Capture output
spool install
set showmode off
set serveroutput on size unlimited format truncated
-- 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');
end if;
end;
/
WHENEVER SQLERROR continue
-- Create the schema owner.
create user &schema_owner. identified by &schema_owner.
default tablespace users
quota unlimited on users
temporary tablespace temp;
grant create session to &schema_owner.;
grant create type to &schema_owner.;
grant create sequence to &schema_owner.;
grant create table to &schema_owner.;
grant create trigger to &schema_owner.;
grant create view to &schema_owner.;
grant create procedure to &schema_owner.;
grant select on dba_source to &schema_owner.;
-- This MUST be run by SYS.
grant select on dba_objects 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_version for &schema_owner..wt_version;
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_test_run_stats for &schema_owner..wt_test_run_stats;
create or replace public synonym wt_testcase_stats for &schema_owner..wt_testcase_stats;
create or replace public synonym wt_self_test for &schema_owner..wt_self_test;
create or replace public synonym utassert for &schema_owner..wt_assert;
create or replace public synonym wt_assert for &schema_owner..wt_assert;
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.
set serveroutput on size unlimited format truncated
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
@proftab_comments.sql
--
create index plsql_profiler_runs_idx1
on plsql_profiler_runs (run_date);
-- Core Tables
@wt_version.tab
@wt_test_runs.tab
@wt_results.tab
@wt_dbout_profiles.tab
@wt_test_run_stats.tab
@wt_testcase_stats.tab
@wt_self_test.tab
-- Package Specifications
@wtplsql.pks
/
@wt_result.pks
/
@wt_assert.pks
/
@wt_profiler.pks
/
@wt_test_run_stat.pks
/
@wt_text_report.pks
/
grant execute on wtplsql to public;
grant execute on wt_assert to public;
grant execute on wt_text_report to public;
-- Package Bodies
@wtplsql.pkb
/
@wt_result.pkb
/
@wt_assert.pkb
/
@wt_profiler.pkb
/
@wt_test_run_stat.pkb
/
@wt_text_report.pkb
/
set showmode on
spool off