-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall-oracle
executable file
·131 lines (113 loc) · 5.58 KB
/
install-oracle
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
#!/bin/bash
#
# Copyright 2010 Jeremy Schneider
#
# This file is part of EC2-RAC-BUILDER.
#
# EC2-RAC-BUILDER is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# EC2-RAC-BUILDER is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EC2-RAC-BUILDER. If not, see <http://www.gnu.org/licenses/>.
#
#
[ -n "$DEBUG" ] && set -x
[ -z "$2" ] && { echo "Usage: install-oracle <cluster#> <#nodes>" && exit 1; }
[ $2 -gt 0 ] || { echo "ERROR: #nodes must be between 1 and 20" && exit 1; };
[ $2 -lt 21 ] || { echo "ERROR: #nodes must be between 1 and 20" && exit 1; };
. $(dirname $0)/env
ADDR=$(cat /tmp/amazon/cluster$1-n1.ip)
N=1
nodecomma="n1"
nodespace="n1"
ipspace="172.17.17.1"
while [ $N -lt $2 ]; do
N=$((N + 1))
nodecomma="$nodecomma,n$N"
nodespace="$nodespace n$N"
ipspace="$ipspace 172.17.17.$N"
done
until ssh $SSH_OPTS root@$ADDR date 2>/dev/null; do sleep 5; done
URLS_11202=(
'https://updates.oracle.com/Orion/Download/process_form/p10098816_112020_LINUX_1of7.zip?file_id=34840499&aru=13149166&[email protected]&[email protected]&patch_password=&patch_file=p10098816_112020_LINUX_1of7.zip'
'https://updates.oracle.com/Orion/Download/process_form/p10098816_112020_LINUX_2of7.zip?file_id=34840557&aru=13149166&[email protected]&[email protected]&patch_password=&patch_file=p10098816_112020_LINUX_2of7.zip'
'https://updates.oracle.com/Orion/Download/process_form/p10098816_112020_LINUX_3of7.zip?file_id=34840558&aru=13149166&[email protected]&[email protected]&patch_password=&patch_file=p10098816_112020_LINUX_3of7.zip'
'https://updates.oracle.com/Orion/Download/process_form/p10098816_112020_LINUX_4of7.zip?file_id=34840559&aru=13149166&[email protected]&[email protected]&patch_password=&patch_file=p10098816_112020_LINUX_4of7.zip'
'https://updates.oracle.com/Orion/Download/process_form/p10098816_112020_LINUX_5of7.zip?file_id=34840562&aru=13149166&[email protected]&[email protected]&patch_password=&patch_file=p10098816_112020_LINUX_5of7.zip'
'https://updates.oracle.com/Orion/Download/process_form/p10098816_112020_LINUX_6of7.zip?file_id=34840571&aru=13149166&[email protected]&[email protected]&patch_password=&patch_file=p10098816_112020_LINUX_6of7.zip'
'https://updates.oracle.com/Orion/Download/process_form/p10098816_112020_LINUX_7of7.zip?file_id=34840572&aru=13149166&[email protected]&[email protected]&patch_password=&patch_file=p10098816_112020_LINUX_7of7.zip')
# 11.2.0.1
URLS=(
'http://download.oracle.com/otn/linux/oracle11g/R2/linux_11gR2_database_1of2.zip'
'http://download.oracle.com/otn/linux/oracle11g/R2/linux_11gR2_database_2of2.zip'
'http://download.oracle.com/otn/linux/oracle11g/R2/linux_11gR2_grid.zip')
echo "$(date +%T) downloading grid software from Oracle support" >&2
ssh $SSH_OPTS root@$ADDR <<EOF 2>&1
mkdir -p /tmp/oracle
cd /tmp/oracle
curl -u $ORACLE_SUPPORT_USERNAME:$ORACLE_SUPPORT_PASSWORD --location-trusted -c /tmp/oracle/cookies -o file3.zip '${URLS[2]}'
EOF
date
echo "$(date +%T) extracting grid software (/tmp/oracle/grid)" >&2
ssh $SSH_OPTS root@$ADDR <<EOF 2>&1
cd /tmp/oracle
unzip file3.zip
EOF
date
echo "$(date +%T) running cluvfy" >&2
ssh $SSH_OPTS oracle@$ADDR <<EOF 2>&1
cd /tmp/oracle/grid
ssh-keyscan -t rsa,dsa $nodespace >>~/.ssh/known_hosts
ssh-keyscan -t rsa,dsa $ipspace >>~/.ssh/known_hosts
for H in n2; do scp ~/.ssh/known_hosts \$H:.ssh/; done
./runcluvfy.sh stage -pre crsinst -n $nodecomma -verbose
EOF
date
echo "$(date +%T) installing grid infrastructure" >&2
scp $SSH_OPTS $(dirname $0)/grid.rsp oracle@$ADDR:
ssh $SSH_OPTS oracle@$ADDR <<EOF 2>&1
cd /tmp/oracle/grid
./runInstaller -responseFile ~/grid.rsp -ignoreSysPrereqs -ignorePrereq -silent -waitforcompletion -loglevel finest -debug
# ./runInstaller -responseFile ~/grid.rsp -ignoreSysPrereqs -ignorePrereq -silent -waitforcompletion
EOF
date
echo "$(date +%T) running root scripts" >&2
ssh $SSH_OPTS root@$ADDR <<EOF 2>&1
/u01/app/oraInventory/orainstRoot.sh
/u01/app/11.2.0/grid/root.sh
EOF
R_PIDS=""
for N in $nodespace; do
[ "$N" == "n1" ] && continue
{
ssh $SSH_OPTS root@$(cat /tmp/amazon/cluster$1-$N.ip) <<EOF 2>&1
/u01/app/oraInventory/orainstRoot.sh
/u01/app/11.2.0/grid/root.sh
EOF
} &
R_PIDS="$R_PIDS $!"
done
until [ -z "$R_PIDS" ] || [ -z "$(ps h $R_PIDS)" ]; do sleep 5; done
echo "$(date +%T) downloading database software from Oracle support" >&2
ssh $SSH_OPTS root@$ADDR <<EOF 2>&1
mkdir -p /tmp/oracle
cd /tmp/oracle
curl -u $ORACLE_SUPPORT_USERNAME:$ORACLE_SUPPORT_PASSWORD --location-trusted -c /tmp/oracle/cookies -o file1.zip '${URLS[0]}'
curl -u $ORACLE_SUPPORT_USERNAME:$ORACLE_SUPPORT_PASSWORD --location-trusted -c /tmp/oracle/cookies -o file2.zip '${URLS[1]}'
EOF
date
echo "$(date +%T) extracting database software (/tmp/oracle/database)" >&2
ssh $SSH_OPTS root@$ADDR <<EOF 2>&1
cd /tmp/oracle
unzip file1.zip
unzip file2.zip
EOF
date
echo "$(date +%T) finished!" >&2