-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathbefore_install_oracle.sh
162 lines (134 loc) · 5.99 KB
/
before_install_oracle.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
#!/bin/bash
# Script performs non-interactive installation of Oracle XE 10g on Debian
#
# Based on oracle10g-update.sh from HTSQL project:
# https://bitbucket.org/prometheus/htsql
#
# Modified by Mateusz Loskot <mateusz@loskot.net>
# Changes:
# - Add fake swap support (backup /usr/bin/free manually anyway!)
# - Increase Oracle XE's PROCESSES parameter to value from range 100-200.
# Required to prevent random ORA-12520 errors while running tests.
#
# Modified by Peter Butkovic <butkovic@gmail.com> to enable i386 install on amd64 architecture (precise 64)
# based on: http://www.ubuntugeek.com/how-to-install-oracle-10g-xe-in-64-bit-ubuntu.html
#
# Modified by Christian Beikov <christian@blazebit.com>
# Changes:
# - Add oracle-xe-client so we can use the jdbc driver of the package
# - Update to 11.2 with https://github.com/cbandy/travis-oracle
#
# set -ex
export ORACLE_COOKIE=sqldev
export ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
wget 'https://github.com/cbandy/travis-oracle/archive/v2.0.1.tar.gz'
mkdir -p .travis/oracle
tar x -C .travis/oracle --strip-components=1 -f v2.0.1.tar.gz
.travis/oracle/download.sh
.travis/oracle/install.sh
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192
sudo add-apt-repository -y ppa:apt-fast/stable
sudo apt-get update -qq -y
sudo apt-get install -qq -y apt-fast
sudo apt-fast update -qq -y
#
# Utilities
#
free_backup() {
# Multiple copies to be on safe side
sudo cp /usr/bin/free /root
sudo mv /usr/bin/free /usr/bin/free.original
}
free_restore() {
sudo cp /usr/bin/free.original /usr/bin/free
}
# Install fake free
# http://www.axelog.de/2010/02/7-oracle-ee-refused-to-install-into-openvz/
free_backup
sudo tee /usr/bin/free <<EOF > /dev/null
#!/bin/sh
cat <<__eof
total used free shared buffers cached
Mem: 1048576 327264 721312 0 0 0
-/+ buffers/cache: 327264 721312
Swap: 2000000 0 2000000
__eof
exit
EOF
sudo chmod 755 /usr/bin/free
#
# ok, bc, is the dependency that is required by DB2 as well => let's remove it from oracle xe dependencies and provide 64bit one only
#
# Install the Oracle 10g dependant packages
sudo apt-fast install -qq -y --force-yes libc6:i386
# travis needs the "apt-transport-https" to enable https transport
sudo apt-fast install -qq -y bc apt-transport-https
# add Oracle repo + key (please note https is a must here, otherwise "apt-get update" fails for this repo with the "Undetermined error")
sudo bash -c 'echo "deb https://oss.oracle.com/debian/ unstable main non-free" >/etc/apt/sources.list.d/oracle.list'
wget -q https://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
sudo apt-fast update -qq -y
# only download the package, to manually install afterwards
sudo apt-fast install -qq -y --force-yes -d oracle-xe-client:i386
# The server is now installed differently
#sudo apt-fast install -qq -y --force-yes -d oracle-xe-universal:i386
sudo apt-fast install -qq -y --force-yes libaio:i386
# remove key + repo (to prevent failures on next updates)
sudo apt-key del B38A8516
sudo bash -c 'rm -rf /etc/apt/sources.list.d/oracle.list'
sudo apt-fast update -qq -y
sudo apt-get autoremove -qq
# remove bc from the dependencies of the oracle-xe-client package (to keep 64bit one installed)
mkdir /tmp/oracle_client_unpack
dpkg-deb -x /var/cache/apt/archives/oracle-xe-client_10.2.0.1-1.2_i386.deb /tmp/oracle_client_unpack
cd /tmp/oracle_client_unpack
dpkg-deb --control /var/cache/apt/archives/oracle-xe-client_10.2.0.1-1.2_i386.deb
sed -i "s/,\ bc//g" /tmp/oracle_client_unpack/DEBIAN/control
mkdir /tmp/oracle_client_repack
dpkg -b /tmp/oracle_client_unpack /tmp/oracle_client_repack/oracle-xe-client_fixed_10.2.0.1-1.2_i386.deb
# install Oracle 10g with the fixed dependencies, to prevent i386/amd64 conflicts on bc package
sudo dpkg -i --force-architecture /tmp/oracle_client_repack/oracle-xe-client_fixed_10.2.0.1-1.2_i386.deb
# remove bc from the dependencies of the oracle-xe-universal package (to keep 64bit one installed)
#mkdir /tmp/oracle_unpack
#dpkg-deb -x /var/cache/apt/archives/oracle-xe-universal_10.2.0.1-1.1_i386.deb /tmp/oracle_unpack
#cd /tmp/oracle_unpack
#dpkg-deb --control /var/cache/apt/archives/oracle-xe-universal_10.2.0.1-1.1_i386.deb
#sed -i "s/,\ bc//g" /tmp/oracle_unpack/DEBIAN/control
#mkdir /tmp/oracle_repack
#dpkg -b /tmp/oracle_unpack /tmp/oracle_repack/oracle-xe-universal_fixed_10.2.0.1-1.1_i386.deb
# install Oracle 10g with the fixed dependencies, to prevent i386/amd64 conflicts on bc package
#sudo dpkg -i --force-architecture /tmp/oracle_repack/oracle-xe-universal_fixed_10.2.0.1-1.1_i386.deb
# Fix the problem when the configuration script eats the last
# character of the password if it is 'n': replace IFS="\n" with IFS=$'\n'.
sudo sed -i -e s/IFS=\"\\\\n\"/IFS=\$\'\\\\n\'/ /etc/init.d/oracle-xe
# Configure the server; provide the answers for the following questions:
# The HTTP port for Oracle Application Express: 8080
# A port for the database listener: 1521
# The password for the SYS and SYSTEM database accounts: admin
# Start the server on boot: yes
sudo /etc/init.d/oracle-xe configure <<END
8080
1521
admin
admin
y
END
# Load Oracle environment variables so that we could run `sqlplus`.
. $ORACLE_HOME/bin/oracle_env.sh
# Increase the number of connections.
echo "ALTER SYSTEM SET PROCESSES=200 SCOPE=SPFILE;" | \
sqlplus -S -L sys/admin AS SYSDBA
# drop the travis user as it is configure to authenticate without password
echo "DROP USER travis;" | \
sqlplus -S -L sys/admin AS SYSDBA
# need to restart, to apply connection number update
sudo /etc/init.d/oracle-xe restart
# Set Oracle environment variables on login.
# NOTE, mloskot: On Travis CI, fails with Permission denied
#sudo cat <<END >>/root/.bashrc
#. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
#END
free_restore
# Install development toolset for 32-bit for Travis CI 64-bit
sudo apt-fast install -qq -y g++-multilib