-
Notifications
You must be signed in to change notification settings - Fork 0
/
15-apex-install.sh
97 lines (72 loc) · 2.78 KB
/
15-apex-install.sh
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
#!/bin/bash
# set -eux
export APEX_ORDS_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
cd "$APEX_ORDS_DIR"
. ./00-set-apex-ords-env.sh
echo "Criando o script SQL de instalacao do APEX (apex-install.sql) ..."
cat << EOF > "apex-install.sql"
connect sys/${DB_SERVER_PWD}@//${DB_SERVER_IP}:${DB_SERVER_PORT}/${DB_SERVER_SERVICE_NAME} as sysdba
set define off
prompt Executing Apex main installation script: apexins.sql
@apexins.sql "${APEX_TABLESPACE}" "${APEX_TABLESPACE}" "TEMP" "/i/"
prompt Executing Apex REST configuration script: apex_rest_config_core.sql
@apex_rest_config_core.sql @ "${DB_SERVER_APEX_USERS_PWD}" "${DB_SERVER_APEX_USERS_PWD}"
prompt Reset passwords and unlock APEX database users
alter user APEX_230100 identified by "${DB_SERVER_APEX_USERS_PWD}" account unlock;
alter user FLOWS_FILES identified by "${DB_SERVER_APEX_USERS_PWD}" account unlock;
alter user APEX_PUBLIC_USER identified by "${DB_SERVER_APEX_USERS_PWD}" account unlock;
alter user APEX_REST_PUBLIC_USER identified by "${DB_SERVER_APEX_USERS_PWD}" account unlock;
alter user APEX_LISTENER identified by "${DB_SERVER_APEX_USERS_PWD}" account unlock;
prompt Setup Network ACL for APEX database user
begin
for c1 in (
select schema
from sys.dba_registry
where comp_id = 'APEX'
) loop
sys.dbms_network_acl_admin.append_host_ace(
host => '*',
ace => xs\$ace_type(
privilege_list => xs\$name_list('connect'),
principal_name => c1.schema,
principal_type => xs_acl.ptype_db
)
);
end loop;
commit;
end;
/
prompt Setup APEX ADMIN account for its development environment (INTERNAL Workspace)
begin
apex_util.set_workspace(p_workspace => 'internal');
apex_util.create_user(
p_user_name => 'ADMIN'
, p_email_address => 'ADMIN'
, p_web_password => '${APEX_ADMIN_PWD}'
, p_developer_privs => 'ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL'
, p_change_password_on_first_use => 'N'
);
commit;
end;
/
prompt Setup PT-BR language for APEX
@builder/pt-br/load_pt-br.sql
set define on
quit
EOF
echo "Criando o script em batch do Windows que vai fazer a chamada para o script SQL de instalacao do APEX (apex-install.bat) ..."
cat << EOF > "apex-install.bat"
@ECHO OFF
SET "CURDIR=%~dp0"
set "JAVA_HOME=%CURDIR%${JAVA_BASE_NAME}"
set "PATH=%JAVA_HOME%\bin;%CURDIR%\sqlcl\bin;%PATH%"
cd "%CURDIR%${APEX_BASE_NAME}\apex"
sql -S /nolog @"%CURDIR%apex-install.sql"
echo.
echo Oracle APEX instalado com sucesso!
echo.
pause
exit
EOF
start "" "apex-install.bat"
exit