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
| #!/bin/bash
# author: koumm
# desc: RHEL/CentOS/OEL5.8 x64 oracle 10g(10.2.0.5) install script
# date: 2014-07-28
# version: v1.0
# modify:
ORACLE_BASE="/u01/app/oracle"
ORACLE_HOME="/u01/app/oracle/product/10.2.0/db_1"
ORACLE_SID="orcl"
#
cat << EOF
+--------------------------------------------------------------+
| === Welcome to RUN oracle auto configure script === |
| PWD /root/oracle10g_install.sh |
+----------------------Author:koumm----------------------------+
EOF
cd oracle_install/ora_install_rpm
rpm -ivh compat-db-4.2.52-5.1.i386.rpm compat-db-4.2.52-5.1.x86_64.rpm
rpm -ivh libaio-devel-0.3.106-5.x86_64.rpm libaio-devel-0.3.106-5.i386.rpm
rpm -ivh sysstat-7.0.2-11.el5.x86_64.rpm numactl-devel-0.9.8-12.0.1.el5_6.x86_64.rpm
rpm -ivh unixODBC-2.2.11-10.el5.x86_64.rpm unixODBC-devel-2.2.11-10.el5.x86_64.rpm unixODBC-libs-2.2.11-10.el5.x86_64.rpm
rpm -ivh unixODBC-2.2.11-10.el5.i386.rpm unixODBC-devel-2.2.11-10.el5.i386.rpm unixODBC-libs-2.2.11-10.el5.i386.rpm
rpm -ivh libXp-1.0.0-8.1.el5.i386.rpm libXp-1.0.0-8.1.el5.x86_64.rpm
rpm -ivh openmotif22-2.2.3-20.x86_64.rpm openmotif-2.3.1-6.el5.x86_64.rpm
rpm -ivh rlwrap-0.37-1.el5.x86_64.rpm
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 1. oracle rpm package installed successfully. === |
+--------------------------------------------------------------+
EOF
fi
ORACLE_USER=`cat /etc/passwd |grep oracle |awk -F ":" '{print $1}'`
if [ "ORACLE_USER" != "oracle" ]; then
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
echo "abc123" | passwd --stdin oracle
fi
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 2. oracle user group installed successfully. === |
+--------------------------------------------------------------+
EOF
fi
if [ ! -d $ORACLE_HOME ]; then
mkdir -p $ORACLE_HOME
chmod -R 775 /u01/app
chown -R oracle:oinstall /u01
fi
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 3. oracle HOME directory created successfully. === |
+--------------------------------------------------------------+
EOF
fi
# cd root home directory /root/
if [ -e /root/oracle_install/10201_database_linux_x86_64.cpio.gz -a -e /root/oracle_install/p8202632_10205_Linux-x86-64.zip ];then
echo " === now moving database file database,pack to /u01/app ..."
chown oracle:oinstall /root/oracle_install/10201_database_linux_x86_64.cpio.gz
chown oracle:oinstall /root/oracle_install/p8202632_10205_Linux-x86-64.zip
mv /root/oracle_install/10201_database_linux_x86_64.cpio.gz /u01/app/
mv /root/oracle_install/p8202632_10205_Linux-x86-64.zip /u01/app/
cd /u01/app
echo " === now unziping /u01/app/10201_database_linux_x86_64.cpio.gz to /u01/app ..."
gunzip /u01/app/10201_database_linux_x86_64.cpio.gz
cpio -idm < /u01/app/10201_database_linux_x86_64.cpio
echo " === now unziping /u01/app/p8202632_10205_Linux-x86-64.zip to /u01/app ..."
unzip -qo /u01/app/p8202632_10205_Linux-x86-64.zip -d /u01/app
chown -R oracle:oinstall /u01/app/database
chown -R oracle:oinstall /u01/app/Disk1
echo -e "\033[32;49;1m === oracle database unzip successfull ...\033[39;49;0m"
else
echo -e "\033[41;36m no oracle database soft and pack file ... \033[0m"
fi
sed -i '/kernel.shmmax/d' /etc/sysctl.conf
sed -i '/kernel.shmall/d' /etc/sysctl.conf
cat >> /etc/sysctl.conf << EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 359670
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF
sysctl -p
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 4. linux core updated successfully. === |
+--------------------------------------------------------------+
EOF
fi
sleep 1
cat >> /etc/security/limits.conf << EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 5. oracle source limite configured successfully=== |
+--------------------------------------------------------------+
EOF
fi
sleep 1
cat >> /etc/pam.d/login << EOF
session required /lib64/security/pam_limits.so
EOF
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 6. linux login configured successfully. === |
+--------------------------------------------------------------+
EOF
fi
sleep 1
cat >> /etc/profile << EOF
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 7. linux system env configured successfully. === |
+--------------------------------------------------------------+
EOF
fi
sleep 1
cat >> /etc/rc.local << EOF
# Oracle service start
su - oracle -c "lsnrctl start"
su - oracle -c "dbstart"
EOF
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 8. oracle db autostart configured successfully.=== |
+--------------------------------------------------------------+
EOF
fi
sleep 1
cat >> /home/oracle/.bash_profile << EOF
export EDITOR=vi
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=orcl
export PATH=\$ORACLE_HOME/bin:\$PATH
export NLS_LANG="Simplified Chinese_china.ZHS16GBK"
export LANG=en_US
export LC_ALL=en_US
export LD_LIBRARY_PATH=/lib:/usr/lib:\$ORACLE_HOME/lib
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
umask 022
EOF
if [ $? ];then
cat << EOF
+--------------------------------------------------------------+
| === 9. oracle user env configured successfully. === |
+--------------------------------------------------------------+
EOF
fi
sleep 1
cat << EOF
+--------------------------------------------------------------+
| **********************next **************************** |
| # xhost + |
| $ su - oracle |
| $ cd /u01/app/database |
| $ ./runInstaller -ignoresysprereqs |
| ******************************************************* |
+--------------------------------------------------------------+
EOF
|