-
Notifications
You must be signed in to change notification settings - Fork 38
/
_validateRCU.sh
executable file
·120 lines (106 loc) · 3.58 KB
/
_validateRCU.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
#!/bin/bash
#
# File: _validateRCU.sh
# Purpose: Valudate the RCU schemas creation of OAS in Docker container
# Author: Gianni Ceresa (gianni.ceresa@datalysis.ch), February 2020
# Absolutely no warranty, use at your own risk
# Please include this header in any copy or reuse of the script you make
#
# env variables set by Dockerfile
# ORACLE_BASE=/opt/oracle
# ORACLE_HOME=/opt/oracle/product/<version>
# DOMAIN_HOME=/opt/oracle/config/domains
#
# set values based on env variables or default values
#
# - BI_CONFIG_RCU_DBSTRING
if [ "$BI_CONFIG_RCU_DBSTRING" == "" ]; then
echo "BI_CONFIG_RCU_DBSTRING not defined, can't validate RCU schemas creation"
exit 1
fi;
# - BI_CONFIG_RCU_USER
if [ "$BI_CONFIG_RCU_USER" == "" ]; then
BI_CONFIG_RCU_USER=sys
echo "BI_CONFIG_RCU_USER not defined, default: $BI_CONFIG_RCU_USER"
fi;
# - BI_CONFIG_RCU_PWD
if [ "$BI_CONFIG_RCU_PWD" == "" ]; then
echo "BI_CONFIG_RCU_PWD not defined, can't validate RCU schemas creation"
exit 1
fi;
# - BI_CONFIG_RCU_DB_PREFIX
if [ "$BI_CONFIG_RCU_DB_PREFIX" == "" ]; then
BI_CONFIG_RCU_DB_PREFIX=$(hostname -f)
# DB prefix must start with a letter: replace first digit with 'G-P' (not hexa chars)
case ${BI_CONFIG_RCU_DB_PREFIX:0:1} in
0)
BI_CONFIG_RCU_DB_PREFIX="g"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
1)
BI_CONFIG_RCU_DB_PREFIX="h"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
2)
BI_CONFIG_RCU_DB_PREFIX="i"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
3)
BI_CONFIG_RCU_DB_PREFIX="j"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
4)
BI_CONFIG_RCU_DB_PREFIX="k"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
5)
BI_CONFIG_RCU_DB_PREFIX="l"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
6)
BI_CONFIG_RCU_DB_PREFIX="m"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
7)
BI_CONFIG_RCU_DB_PREFIX="n"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
8)
BI_CONFIG_RCU_DB_PREFIX="o"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
9)
BI_CONFIG_RCU_DB_PREFIX="p"${BI_CONFIG_RCU_DB_PREFIX:1:11}
;;
esac
echo "BI_CONFIG_RCU_DB_PREFIX not defined, default: $BI_CONFIG_RCU_DB_PREFIX"
fi;
# database connection params
DBCONN_PARAM=""
DBCONN_PARAM="$DBCONN_PARAM -connectString $BI_CONFIG_RCU_DBSTRING"
DBCONN_PARAM="$DBCONN_PARAM -dbUser $BI_CONFIG_RCU_USER"
DBCONN_PARAM="$DBCONN_PARAM -databaseType ORACLE"
DBCONN_PARAM="$DBCONN_PARAM -dbRole SYSDBA"
# components params
COMPONENTS=""
COMPONENTS="$COMPONENTS -component STB"
COMPONENTS="$COMPONENTS -component MDS"
COMPONENTS="$COMPONENTS -component WLS"
COMPONENTS="$COMPONENTS -component OPSS"
COMPONENTS="$COMPONENTS -component BIPLATFORM"
COMPONENTS="$COMPONENTS -component IAU"
COMPONENTS="$COMPONENTS -component IAU_APPEND"
COMPONENTS="$COMPONENTS -component IAU_VIEWER"
# RCU settings
RCU_SETTINGS=""
RCU_SETTINGS="$RCU_SETTINGS -silent"
RCU_SETTINGS="$RCU_SETTINGS -createRepository"
RCU_SETTINGS="$RCU_SETTINGS -schemaPrefix $BI_CONFIG_RCU_DB_PREFIX"
RCU_SETTINGS="$RCU_SETTINGS -useSamePasswordForAllSchemaUsers true"
RCU_SETTINGS="$RCU_SETTINGS $DBCONN_PARAM"
RCU_SETTINGS="$RCU_SETTINGS $COMPONENTS"
# write password in file
(echo $BI_CONFIG_RCU_PWD; echo $BI_CONFIG_RCU_PWD) > $ORACLE_HOME/_tmp_rcu.dat
#
# validate RCU create command and settings
#
$ORACLE_HOME/oracle_common/bin/rcu $RCU_SETTINGS -validate -f < $ORACLE_HOME/_tmp_rcu.dat
if [ $? -ne 0 ]; then
echo "ERROR validating RCU command and settings, can't validate RCU schemas creation"
echo "command: $ORACLE_HOME/oracle_common/bin/rcu $RCU_SETTINGS -validate -f < $ORACLE_HOME/_tmp_rcu.dat"
rm $ORACLE_HOME/_tmp_rcu.dat
exit 1
fi
# remove password file
rm $ORACLE_HOME/_tmp_rcu.dat