11#! /bin/bash
22
3- cd source
43set -ev
4+ SCRIPT_DIR=" $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
5+ cd ${SCRIPT_DIR} /../source
6+
7+ INSTALL_FILE=" install_headless_with_trigger.sql"
8+ if [[ ! -f " ${INSTALL_FILE} " ]]; then
9+ INSTALL_FILE=" install_headless.sql"
10+ fi
511
612# install core of utplsql
713time " $SQLCLI " sys/$ORACLE_PWD @//$CONNECTION_STR AS SYSDBA << -SQL
@@ -11,33 +17,33 @@ set verify off
1117
1218--alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(5004,5018,6000,6001,6003,6009,6010,7206)';
1319alter session set plsql_optimize_level=0;
14- @install_headless_with_trigger.sql $UT3_OWNER $UT3_OWNER_PASSWORD
20+ @${INSTALL_FILE} $UT3_DEVELOP_SCHEMA $UT3_DEVELOP_SCHEMA_PASSWORD
1521SQL
1622
1723# Run this step only on second child job (12.1 - at it's fastest)
18- if [[ " ${TRAVIS_JOB_NUMBER } " =~ \. 2$ ]]; then
24+ if [[ " ${JOB_NUMBER } " =~ \. 2$ ]]; then
1925
2026 # check code-style for errors
21- time " $SQLCLI " $UT3_OWNER / $UT3_OWNER_PASSWORD @//$CONNECTION_STR @../development/utplsql_style_check.sql
27+ time " $SQLCLI " $UT3_DEVELOP_SCHEMA / $UT3_DEVELOP_SCHEMA_PASSWORD @//$CONNECTION_STR @../development/utplsql_style_check.sql
2228
2329 # test install/uninstall process
2430 time " $SQLCLI " sys/$ORACLE_PWD @//$CONNECTION_STR AS SYSDBA << -SQL
2531 set feedback off
2632 set verify off
2733 whenever sqlerror exit failure rollback
2834
29- @uninstall_all.sql $UT3_OWNER
35+ @uninstall_all.sql $UT3_DEVELOP_SCHEMA
3036 whenever sqlerror exit failure rollback
3137 declare
3238 v_leftover_objects_count integer;
3339 begin
3440 select sum(cnt)
3541 into v_leftover_objects_count
3642 from (
37- select count(1) cnt from dba_objects where owner = '$UT3_OWNER '
43+ select count(1) cnt from dba_objects where owner = '$UT3_DEVELOP_SCHEMA '
3844 where object_name not like 'PLSQL_PROFILER%' and object_name not like 'DBMSPCC_%'
3945 union all
40- select count(1) cnt from dba_synonyms where table_owner = '$UT3_OWNER '
46+ select count(1) cnt from dba_synonyms where table_owner = '$UT3_DEVELOP_SCHEMA '
4147 where table_name not like 'PLSQL_PROFILER%' and table_name not like 'DBMSPCC_%'
4248 );
4349 if v_leftover_objects_count > 0 then
5258 set verify off
5359
5460 alter session set plsql_optimize_level=0;
55- @install.sql $UT3_OWNER
56- @install_ddl_trigger.sql $UT3_OWNER
57- @create_synonyms_and_grants_for_public.sql $UT3_OWNER
61+ @install.sql $UT3_DEVELOP_SCHEMA
62+ @install_ddl_trigger.sql $UT3_DEVELOP_SCHEMA
63+ @create_synonyms_and_grants_for_public.sql $UT3_DEVELOP_SCHEMA
5864SQL
5965
6066fi
@@ -65,8 +71,8 @@ set feedback off
6571whenever sqlerror exit failure rollback
6672
6773--------------------------------------------------------------------------------
68- PROMPT Adding back create-trigger privilege to $UT3_OWNER for testing
69- grant administer database trigger to $UT3_OWNER ;
74+ PROMPT Adding back create-trigger privilege to $UT3_DEVELOP_SCHEMA for testing
75+ grant administer database trigger to $UT3_DEVELOP_SCHEMA ;
7076
7177--------------------------------------------------------------------------------
7278PROMPT Creating $UT3_TESTER - Power-user for testing internal framework code
@@ -76,27 +82,27 @@ grant create session, create procedure, create type, create table to $UT3_TESTER
7682
7783grant execute on dbms_lock to $UT3_TESTER ;
7884
79- PROMPT Granting $UT3_OWNER code to $UT3_TESTER
85+ PROMPT Granting $UT3_DEVELOP_SCHEMA code to $UT3_TESTER
8086
8187begin
8288 for i in (
8389 select object_name from all_objects t
8490 where t.object_type in ('PACKAGE','TYPE')
85- and owner = 'UT3 '
91+ and owner = '$UT3_DEVELOP_SCHEMA '
8692 and generated = 'N'
8793 and object_name not like 'SYS%')
8894 loop
89- execute immediate 'grant execute on ut3 ."'||i.object_name||'" to UT3_TESTER';
95+ execute immediate 'grant execute on $UT3_DEVELOP_SCHEMA ."'||i.object_name||'" to $ UT3_TESTER ';
9096 end loop;
9197end;
9298/
9399
94- PROMPT Granting $UT3_OWNER tables to $UT3_TESTER
100+ PROMPT Granting $UT3_DEVELOP_SCHEMA tables to $UT3_TESTER
95101
96102begin
97- for i in ( select table_name from all_tables t where owner = 'UT3 ' and nested = 'NO' and iot_name is null)
103+ for i in ( select table_name from all_tables t where owner = '$UT3_DEVELOP_SCHEMA ' and nested = 'NO' and iot_name is null)
98104 loop
99- execute immediate 'grant select on UT3 .'||i.table_name||' to UT3_TESTER';
105+ execute immediate 'grant select on $UT3_DEVELOP_SCHEMA .'||i.table_name||' to $ UT3_TESTER ';
100106 end loop;
101107end;
102108/
@@ -108,6 +114,25 @@ PROMPT Creating $UT3_USER - minimal privileges user for API testing
108114create user $UT3_USER identified by "$UT3_USER_PASSWORD " default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE ;
109115grant create session, create procedure, create type, create table to $UT3_USER ;
110116
117+ PROMPT Grants for starting a debugging session from $UT3_USER
118+ grant debug connect session to $UT3_USER ;
119+ grant debug any procedure to $UT3_USER ;
120+ begin
121+ \$ if dbms_db_version.version <= 11 \$ then
122+ null; -- no addition action necessary
123+ \$ else
124+ -- necessary on 12c or higher
125+ dbms_network_acl_admin.append_host_ace (
126+ host =>'*',
127+ ace => sys.xs\$ ace_type(
128+ privilege_list => sys.xs\$ name_list('JDWP') ,
129+ principal_name => '$UT3_USER ',
130+ principal_type => sys.xs_acl.ptype_db
131+ )
132+ );
133+ \$ end
134+ end;
135+ /
111136
112137--------------------------------------------------------------------------------
113138PROMPT Creating $UT3_TESTER_HELPER - provides functions to allow min grant test user setup tests.
@@ -119,11 +144,11 @@ PROMPT Grants for testing distributed transactions
119144grant create public database link to $UT3_TESTER_HELPER ;
120145grant drop public database link to $UT3_TESTER_HELPER ;
121146
122- PROMPT Grants for testing coverage outside of main UT3 schema.
147+ PROMPT Grants for testing coverage outside of main $UT3_DEVELOP_SCHEMA schema.
123148grant create any procedure, drop any procedure, execute any procedure, create any type, drop any type, execute any type, under any type,
124149 select any table, update any table, insert any table, delete any table, create any table, drop any table, alter any table,
125150 select any dictionary, create any synonym, drop any synonym,
126- grant any object privilege, grant any privilege
151+ grant any object privilege, grant any privilege, create public synonym, drop public synonym, create any trigger
127152 to $UT3_TESTER_HELPER ;
128153
129154grant create job to $UT3_TESTER_HELPER ;
0 commit comments