본문 바로가기

Linux(OS)

오라클 설치를 위한 리눅스 설정(Oracle12cR2 on RAC OEL7)

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
오라클 설치를 위한 리눅스 사전 설정
(Oracle Enterprise Linux 7.2)
ORACLE Linux 설치 후, 진행 순서
 
* Install the VMtools.
./vmware-tools.pl -default
 
1. 불필요한 서비스 disable(firewall)
# systemctl disable firewalld
# systemctl stop firewalld
 
2. hostname 조회 및 설정
[root@oracle12c1 ~]# hostname
oracle12c1
[root@oracle12c1 ~]# hostnamectl set-hostname oracle12c1
 
3. hosts 파일 설정(3node)
# vi /etc/hosts
127.0.0.1       localhost
192.168.10.51   oracle12cr2-1
192.168.10.52   oracle12cr2-2
192.168.10.53   oracle12cr2-3
10.10.10.10     oracle12cr2-1-priv
10.10.10.20     oracle12cr2-2-priv
10.10.10.30     oracle12cr2-3-priv
192.168.10.54   oracle12cr2-1-vip
192.168.10.55   oracle12cr2-2-vip
192.168.10.56   oracle12cr2-3-vip
192.168.10.57   oracle12cr2-scan
 
4. Kernel parameter setting
# vi /etc/sysctl.conf
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.wmem_max = 1048576
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
fs.file-max = 6815744
fs.aio-max-nr = 1048576
 
5. vi /etc/security/limits.conf
grid   soft nproc  2047
grid   hard nproc  16384
grid   soft nofile 1024
grid   hard nofile 65536
oracle soft nproc  2047
oracle hard nproc  16384
oracle soft nofile 1024
oracle hard nofile 65536
 
vi /etc/security/limits.d/20-nproc.conf
4096 ---> 16384 변경
 
7. pam.d 설정
# vi /etc/pam.d/login
session    required     pam_limits.so
 
8. modprobe 설정
# vi /etc/modprobe.d/modprobe.conf
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
    
# modprobe -v hangcheck-timer
 
# vi /etc/rc.local
/sbin/modprobe hangcheck-timer
rdate -203.248.240.140
 
9. profile 설정
# vi /etc/profile
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
            if [ $SHELL = "/bin/ksh" ]; then
                      ulimit -16384
                      ulimit -65536
            else
                      ulimit -16384 -65536
            fi
            umask 022
     fi
 
10. 주요 패키지 설치
yum install ntp -y
yum install oracle* -y
yum install -y ftp*
yum install kmod-oracle* -y
 
다운로드 후, 설치
rpm -ivh cvuqdisk-1.0.9-1.rpm
rpm -ivh lrzsz-0.12.20-27.1.el6.x86_64.rpm
rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm
rpm -ivh p7zip-plugins-9.20.1-2.el6.x86_64.rpm
rpm -ivh rlwrap-0.37-1.el6.x86_64.rpm
 
11. user, group 추가
1) grid user 추가
[root@oracle12c1 ~]# useradd grid
[root@oracle12c1 ~]# passwd grid
Changing password for user grid.
New password: oracle <--- 보이지 않음
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: oracle <--- 보이지 않음
passwd: all authentication tokens updated successfully.
 
2) 그룹 추가
# groupadd -g 54321 oinstall
# groupadd -g 54322 dba
# groupadd -g 54323 oper
# groupadd -g 54325 backupdba
# groupadd -g 54326 dgdba
# groupadd -g 54327 kmdba
# groupadd -g 54328 asmdba
# groupadd -g 54329 asmoper
# groupadd -g 54330 asmadmin
 
3) 그룹에 유저 추가
# usermod -g oinstall -G dba,backupdba,dgdba,kmdba,oper,asmdba,asmadmin oracle
# usermod -g oinstall -G asmdba,asmoper,asmadmin grid
 
* kernel update
[root@oracle12c1 ~]# uname -r
3.8.13-98.7.1.el7uek.x86_64
[root@oracle12c1 ~]# yum update kernel
 
11. grid와 database를 설치할 폴더 생성
# mkdir -p /u01/app/oracle/product/12.2.0/
# mkdir -p /u01/grid/12.2
# mkdir -p /u01/app/oraInventory
 
[ 소유권 변경 ]
# chmod -R 755 /u01
# chown -R oracle.oinstall /u01/app/oracle
# chown -R grid.oinstall /u01
# chown -R grid.oinstall /u01/app/oraInventory
 
12. Selinux 설정 해제
# vi /etc/selinux/config
SELINUX=disabled
 
13. ntpd 서비스 중지
[root@oracle12c1 ~]# systemctl stop ntpd
[root@oracle12c1 ~]# systemctl disable ntpd
[root@oracle12c1 ~]# mv /etc/ntp.conf /etc/ntp.conf.orig
[root@oracle12c1 ~]# rm /var/run/ntpd.pid
rm: cannot remove ‘/var/run/ntpd.pid’: No such file or directory
 
13. 각 유저 .bash_profile 설정
[양 노드 모두 확인]
1) root
PATH=$PATH:$HOME/bin:/u01/grid/12.2/bin
export PATH
export LANG=C
export GRID_HOME=/u01/grid/12.2
export PS1='[`hostname -s`@$ORACLE_SID:$PWD] '
 
2) grid
PATH=$PATH:$HOME/bin:/u01/app/oracle/product/12.2.0/db_1/bin:/u01/grid/12.1/bin:/u01/grid/12.2/OPatch
export PATH
export LANG=C
export ORACLE_SID=+ASM1
export GRID_HOME=/u01/grid/12.2
export ORACLE_HOME=$GRID_HOME
export PS1='[`hostname -s`@$ORACLE_SID:$PWD] '
alias cmd='rlwrap asmcmd -p'
 
3) oracle
PATH=$PATH:$HOME/bin:$ORACLE_BASE/product/12.1.0/db_1/bin:$ORACLE_HOME/OPatch
stty erase ^H
stty erase ^?
umask 022
export EDITOR=vi
export LANG=C
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=oracle12c1
export ORACLE_UNQNAME=RAC
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export GRID_HOME=/u01/grid/12.1
export ORACLE_SID=RACDB1
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH:$ORACLE_HOME/OPatch:$ORACLE_HOME/bin:$GRID_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export ORACLE_OWNER=oracle
export NLS_DATE_FORMAT='YYYY.MM.DD HH24:MI:SS'
export PS1='[`hostname -s`@$ORACLE_SID:$PWD] '
export NLS_LANG=AMERICAN_AMERICA.KO16MSWIN949
export TNS_ADMIN=$ORACLE_HOME/network/admin
 
# Alias
alias sqlplus='rlwrap sqlplus / as sysdba'
alias rman='rlwrap rman target sys/oracle'
alias dblog='tail -f /u01/app/oracle/diag/rdbms/racdb/RACDB1/trace/alert_RACDB1.log'
alias clog='tail -f /u01/11.2.0/grid/log/ora11g1/alertora11g1.log'
alias asmlog='tail -f /u01/app/oracle/diag/asm/+asm/+ASM1/trace/alert_+ASM1.log'
alias dbs='cd $ORACLE_HOME/dbs'
 
14. ohasd.service 서비스 등록.
# vi /etc/systemd/system/ohasd.service
 
다음 내용을 기술합니다.
[Unit]
Description=Oracle High Availability Services
After=syslog.target
 
[Service]
ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
Restart=always
 
[Install]
WantedBy=multi-user.target
 
서비스 실행
systemctl daemon-reload
systemctl enable ohasd.service
systemctl start ohasd.service
 
systemctl disable avahi-daemon.service
 
*설정이 완료되었다면 서버 종료 후, 물리적인 디스크 추가 작업
16. VMX 파일 공유 설정
# RAC Shared Storage Setting
disk.Locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
scsi1.sharedBus = "virtual"
 
scsi1:0.present = "TRUE"
scsi1:0.fileName = "================================="
scsi1:0.mode = "independent-persistent"
scsi1:0.deviceType = "disk"       <--- 타이핑
scsi1:0.redo = ""
 
17. Shared Storage 설정(VM Setting)
ocr디스크를 제외한 다른 그룹의 개수는 임의로 설정
* normal redundancy를 위해 3개 이상으로 설정
* 향후 공간이 부족할 경우, 디스크 추가를 통해 확장 가능
OCR   1GB * 3
DATA 20GB * 3
FRA  10GB * 3
 
18. 추가된 HDD를 fdisk로 설정
fdisk /dev/sdb
 
19. asmdisk 설정.
oracleasm configure -i
Configuring the Oracle ASM library driver.
 
Default user to own the driver interface [grid]: grid
Default group to own the driver interface [asmadmin]: asmadmin
Start Oracle ASM library driver on boot (y/n) [y]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
 
cs