-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path3_6apexInstall_inner.sh
executable file
·267 lines (241 loc) · 9.96 KB
/
3_6apexInstall_inner.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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#!/bin/bash
#
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#################################################################################
#
# File: 3_6apexInstall_inner.sh
#
# Description:
#
#################################################################################
. ~oracle/runTimeStartScript.sh
if test -f /tmp/1/cwallet.sso
then
mkdir /home/oracle/wallet
cp /tmp/1/cwallet.sso /home/oracle/wallet
chmod -R 755 /home/oracle/wallet
fi
cd $ORACLE_HOME/apex
echo apex not preinstalled anymore
ls -l apxremov_con.sql
cd /u01/userhome/oracle
if test -f /tmp/1/apex.zip
then
unzip /tmp/1/apex.zip
cd apex
echo 'shutdown immediate
startup
alter pluggable database all open;'| sqlplus / as sysdba
echo 'spool /tmp/spooltestxxtotierne
alter session set container = orcl;
@apexins.sql SYSAUX SYSAUX TEMP /i/' | $SQL_OR_SQLPLUS / as sysdba
echo "select 'cdb anonymous at least is global' from dual;
set define '&'
--alter session set container = orcl;
--EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_040200');
--EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_PUBLIC_USER');
--EXEC DBMS_UTILITY.compile_schema(schema => 'FLOWS_FILES');
--EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_050000');
--EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_PUBLIC_USER');
--EXEC DBMS_UTILITY.compile_schema(schema => 'FLOWS_FILES');
--anonymous needs to be unlocked?? SELECT username, account_status FROM dba_users;
alter user anonymous identified by oracle container=all;
alter user anonymous account unlock;
--ALTER USER APEX_050000 identified by oracle;
--ALTER USER APEX_PUBLIC_USER identified by oracle;
--ALTER USER FLOWS_FILES identified by oracle;
--ALTER USER APEX_050000 ACCOUNT UNLOCK;
--ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
--ALTER USER FLOWS_FILES ACCOUNT UNLOCK;
"|$SQL_OR_SQLPLUS / as sysdba
echo "select 'pdb' from dual;
set define '&'
--alter session set container = orcl;
EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_040200');
EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_PUBLIC_USER');
EXEC DBMS_UTILITY.compile_schema(schema => 'FLOWS_FILES');
EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_050000');
EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_PUBLIC_USER');
EXEC DBMS_UTILITY.compile_schema(schema => 'FLOWS_FILES');
EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_050100');
EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_PUBLIC_USER');
EXEC DBMS_UTILITY.compile_schema(schema => 'FLOWS_FILES');
column totupapex new_val totupapex
--APEX_180100 check
select username totupapex from all_users where username like 'APEX_0%' or username like 'APEX_1%' or username like 'APEX_2%' order by totupapex asc;
clear column
EXEC DBMS_UTILITY.compile_schema(schema => '&totupapex');
EXEC DBMS_UTILITY.compile_schema(schema => 'APEX_PUBLIC_USER');
EXEC DBMS_UTILITY.compile_schema(schema => 'FLOWS_FILES');
--anonymous needs to be unlocked should be unlocked at pdb level might error?? SELECT username, account_status FROM dba_users;
alter user anonymous identified by oracle;
alter user anonymous account unlock;
ALTER USER APEX_050000 identified by oracle;
ALTER USER APEX_050100 identified by oracle;
ALTER USER &totupapex identified by oracle;
ALTER USER APEX_PUBLIC_USER identified by oracle;
ALTER USER FLOWS_FILES identified by oracle;
ALTER USER APEX_050000 ACCOUNT UNLOCK;
ALTER USER APEX_050100 ACCOUNT UNLOCK;
ALTER USER &totupapex ACCOUNT UNLOCK;
ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
ALTER USER FLOWS_FILES ACCOUNT UNLOCK;
"|$SQL_OR_SQLPLUS sys/oracle@localhost:1521/orcl as sysdba
echo "alter session set container = orcl;
@apex_epg_config.sql /u01/userhome/oracle"|$SQL_OR_SQLPLUS / as sysdba
echo leave 8080 for ords
echo "alter session set container = orcl;
@apxconf
exit" > doapxconf.sql
echo '#!/usr/bin/expect
spawn sqlplus / as sysdba @doapxconf
expect -regexp "Enter the administrator.s username .ADMIN." { send "ADMIN\r" }
expect -regexp "Enter ADMIN.s email .ADMIN." {send "\r"}
expect -regexp "Enter ADMIN.s password .." {send "1Oracle:\r"}
expect -regexp "Enter a port for the XDB HTTP listener " {send "8081\r"}
expect -regexp "something the WiLl Never Happen" {send "jingle bella\r"}
interact' > ~/bin/xp.sh
chmod 755 ~/bin/xp.sh
~/bin/xp.sh
rm ~/bin/xp.sh
#echo "ADMIN
#
#1Oracle:
#8081"| sqlplus / as sysdba @doapxconf
#$SQL_OR_SQLPLUS sys/oracle as sysdba @doapxconf ***********????????
cp apex_rest_config_cdb.sql apex_rest_config_cdb.sql.SAV
cat apex_rest_config_cdb.sql.SAV|sed 's/--P'"'"'[^'"'"']*'"'"'/--poracle/g'> apex_rest_config_cdb.sql
cp apex_rest_config_nocdb.sql apex_rest_config_nocdb.sql.SAV
cat apex_rest_config_nocdb.sql.SAV|sed 's/^accept PASSWD1.*$/define PASSWD1=oracle/g' |sed 's/^accept PASSWD2.*$/define PASSWD2=oracle/g'> apex_rest_config_nocdb.sql
echo "alter session set container = orcl;
@apex_rest_config.sql" > doapex_rest_config.sql
echo "exit" | $SQL_OR_SQLPLUS / as sysdba @doapex_rest_config.sql
#better undo -P .SAV change above
cp apex_rest_config_cdb.sql.SAV apex_rest_config_cdb.sql
cp apex_rest_config_nocdb.sql.SAV apex_rest_config_nocdb.sql
#. /tmp/1/apexx2.sh - missing file included rather than recreate file
echo one of these will work depending on apex being included
echo "whenever sqlerror exit 1
alter session set current_schema = APEX_050000;
PROMPT <<--------------- Setting Instance Settings --------------->>
begin
wwv_flow_security.g_security_group_id := 10;
wwv_flow_security.g_user := 'ADMIN';
wwv_flow.g_import_in_progress := true;
for c1 in (select user_id
from wwv_flow_fnd_user
where security_group_id = wwv_flow_security.g_security_group_id
and user_name = wwv_flow_security.g_user
) loop
APEX_UTIL.edit_user
( p_user_id => c1.user_id
, p_user_name => wwv_flow_security.g_user
, p_web_password => 'oracle'
, p_new_password => 'oracle'
,p_change_password_on_first_use => 'N',
p_first_password_use_occurred => 'Y' );
end loop;
wwv_flow.g_import_in_progress := false;
APEX_INSTANCE_ADMIN.SET_PARAMETER('PASSWORD_HISTORY_DAYS',0);
APEX_INSTANCE_ADMIN.SET_PARAMETER('STRONG_SITE_ADMIN_PASSWORD','N');
APEX_INSTANCE_ADMIN.SET_PARAMETER('ACCOUNT_LIFETIME_DAYS',36500);
end;
/
commit;
" | sqlplus sys/oracle@localhost:1521/orcl as sysdba
echo "whenever sqlerror exit 1
alter session set current_schema = APEX_050100;
PROMPT <<--------------- Setting Instance Settings --------------->>
begin
wwv_flow_security.g_security_group_id := 10;
wwv_flow_security.g_user := 'ADMIN';
wwv_flow.g_import_in_progress := true;
for c1 in (select user_id
from wwv_flow_fnd_user
where security_group_id = wwv_flow_security.g_security_group_id
and user_name = wwv_flow_security.g_user
) loop
APEX_UTIL.edit_user
( p_user_id => c1.user_id
, p_user_name => wwv_flow_security.g_user
, p_web_password => 'oracle'
, p_new_password => 'oracle'
,p_change_password_on_first_use => 'N',
p_first_password_use_occurred => 'Y' );
end loop;
wwv_flow.g_import_in_progress := false;
APEX_INSTANCE_ADMIN.SET_PARAMETER('PASSWORD_HISTORY_DAYS',0);
APEX_INSTANCE_ADMIN.SET_PARAMETER('STRONG_SITE_ADMIN_PASSWORD','N');
APEX_INSTANCE_ADMIN.SET_PARAMETER('ACCOUNT_LIFETIME_DAYS',36500);
end;
/
commit;
" | sqlplus sys/oracle@localhost:1521/orcl as sysdba
echo "whenever sqlerror exit 1
column totupapex new_val totupapex
--APEX_180100 check
select username totupapex from all_users where username like 'APEX_0%' or username like 'APEX_1%' or username like 'APEX_2%' order by totupapex asc;
clear column
alter session set current_schema = &totupapex;
PROMPT <<--------------- Setting Instance Settings --------------->>
begin
wwv_flow_security.g_security_group_id := 10;
wwv_flow_security.g_user := 'ADMIN';
wwv_flow.g_import_in_progress := true;
for c1 in (select user_id
from wwv_flow_fnd_user
where security_group_id = wwv_flow_security.g_security_group_id
and user_name = wwv_flow_security.g_user
) loop
APEX_UTIL.edit_user
( p_user_id => c1.user_id
, p_user_name => wwv_flow_security.g_user
, p_web_password => 'oracle'
, p_new_password => 'oracle'
,p_change_password_on_first_use => 'N',
p_first_password_use_occurred => 'Y' );
end loop;
wwv_flow.g_import_in_progress := false;
APEX_INSTANCE_ADMIN.SET_PARAMETER('PASSWORD_HISTORY_DAYS',0);
APEX_INSTANCE_ADMIN.SET_PARAMETER('STRONG_SITE_ADMIN_PASSWORD','N');
APEX_INSTANCE_ADMIN.SET_PARAMETER('ACCOUNT_LIFETIME_DAYS',36500);
end;
/
commit;
" | sqlplus sys/oracle@localhost:1521/orcl as sysdba
echo "
column totupapex new_val totupapex
--APEX_180100 check
select username totupapex from all_users where username like 'APEX_0%' or username like 'APEX_1%' or username like 'APEX_2%' order by totupapex asc;
clear column
BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => '*',
ace => xs"'$'"ace_type(privilege_list => xs"'$'"name_list('connect'),
principal_name => '&totupapex',
principal_type => xs_acl.ptype_db));
END;
/
commit;
"| sqlplus sys/oracle@localhost:1521/orcl as sysdba
else
~oracle/buildTimeReportSkippingFile.sh apex.zip
if test -f /tmp/1/ords.zip
then
echo PROGRESS: APEX - may be a prerequisite for this installations ords config file ie APEX_PUBLIC_USER
fi
fi
. ~oracle/buildTimeEnd.sh