다음에 나오는 사이트를 참고했습니다.
Oracle 10g RAC On Linux Using VMware Server
http://www.oracle-base.com/articles/10g/OracleDB10gR2RACInstallationOnCentos4UsingVMware.php
RPM 패키지 설치 확인
전체 설치를 했으면 기본적으로 추가 설치는 필요가 없습니다.
설치가 필요한 경우는 -q 옵션 명령으로 확인하고 없으면 -Uvh 옵션으로 설치합니다.
CD에 iso가 그대로 있다면 /media/RHEL_5.3 i386 DVD/Server 에 가면 RedHat5에서 제공하는 rpm 들이 있습니다.
확인 : rpm -q 패키지명
설치 : rpm -Uvh 패키지명
필요한 패키지들은 다음과 같습니다.
rpm -q gcc glibc-devel glibc-headers glibc-kernheaders cpp compat-libstdc++ openmotif
glibc-kernheaders 와 compat-libstdc++ 가 설치안되었다고 나오는데 일단 넘어갑니다.
/etc/hosts 파일 편집
127.0.0.1 rac1 localhost.localdomain localhost
#Public Network - (eth0)
192.168.89.101 rac1
192.168.89.102 rac2
#Private Interconnect - (eth1)
192.168.206.101 rac1-priv
192.168.206.102 rac2-priv
#Public virtual IP (VIP) addresses for - (eth0)
192.168.89.111 rac1-vip
192.168.89.112 rac2-vip
/etc/sysctl.conf 파일에 추가
#--------------------
# SHARED MEMORY
#kernel.shmmax = 2147483648
kernel.shmmax = 4589934590
kernel.shmall = 2097152
kernel.shmmni = 4096
#--------------------
# SEMAPHORES : SEMMSL_value, SEMMNS_value, SEMOPM_value, SEMMNI_value
kernel.sem = 250 32000 100 128
#--------------------
# FILE HANDLES : 512M (32768), 1G (65536), 2G (131072), 4G (262144)
#fs.file-max = 65536
fs.file-max = 327679
#--------------------
# Default setting in bytes of the socket receive buffer
#net.core.rmem_default=262144
net.core.rmem_default=1048576
#--------------------
# Default setting in bytes of the socket send buffer
net.core.wmem_default=262144
#--------------------
# Maximum socket erceive buffer size which may be set by using
#net.core.rmem_max=262144
net.core.rmem_max=1048576
#--------------------
# Maximum socket send buffer suze which may be set by using
# the SO_SNDBUF socket option
net.core.wmem_max=262144
net.ipv4.ip_local_port_range = 1024 65000
변경사항 반영 및 확인
반영 : /sbin/sysctl -p
확인
[root@rac1 home]# cat /proc/sys/fs/file-max
327679
[root@rac1 home]# cat /proc/sys/fs/file-nr
3520 0 327679
oracle 사용자 계정의 Shell Limit 설정
- /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle 사용자 계정의 Shell Limit 설정
- /etc/pam.d/login
session required /lib/security/pam_limits.so
SELINUX flag 가 disable로 되어있는지 확인
- /etc/selinux/config
SELINUX=disabled
hangcheck_timer 설정
- 모듈 검사
find /lib/modules -name "hangcheck-timer.ko"
- /etc/modprobe.conf
options sbp2 exclusive_login=0
alias scsi_hostadapter sbp2
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
- 수동 시작
- /etc/rc.local
# +-------------------------------------------------------+
# | HANGCHECK TIMER |
# | (I do not believe this is required, but doesn't hurt) |
# +-------------------------------------------------------+
/sbin/modprobe hangcheck-timer
- 설정 확인
modprobe -v hangcheck-timer
grep Hangcheck /var/log/messages | tail -2
Oracle User/Group 생성
linux 설치시 생성한 user가 있으면 삭제합니다.
userdel <생성한 user id>
mkdir -p /oracle/app
groupadd -g 500 dba
useradd -u 500 -g 500 -d /oracle/app/oracle -s /bin/bash -c "Oracle Software Owner" -p oracle oracle
chown -R oracle:dba /oracle
passwd oracle
chown oracle:dba -R /oracle
su - oracle
oracle 계정으로 .bash_profile 에 추가합니다.
# User specific environment and startup programs
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1
export ORACLE_PATH=$ORACLE_BASE/common/oracle/sq1:.:$ORACLE_HOME/rdbms/admin
# Each RAC node must have a unique ORACLE_SID. (i.e. orcl1, orcl2, ...)
export ORACLE_SID=ORCL1
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
#export TEMP=/tmp
#export TMPDIR=/tmp
export DISPLAY=192.168.89.101:0.0
export ORACLE_OWNER=oracle
export NLS_LANG=AMERICAN_AMERICA.KO16KSC5601
export LANG=C
# prompt
PS1="`/bin/hostname -s `-> "
# alias set
alias dba='sqlplus "/as sysdba"'
alias t='tail -f /oracle/app/oracle/admin/${ORACLE_SID}/bdump/*.log'
# sqlplus backspace
stty erase ^H
File System 디렉토리 생성
root로 생성
mkdir -p /u01
chown oracle:dba /u01
oracle유저로 재로그인한 후
mkdir -p $ORACLE_HOME/admin
mkdir -p $ORACLE_HOME
mkdir -p $ORA_CRS_HOME
mkdir -p /u01/oradata/rac1
Package 설치 여부 확인 - 전체설치를 하였으면 설치가 되어 있다.
cd /media/RHEL_5.3\ i386\ DVD/Server/
rpm -Uvh libaio-0.3.106-3.2.i386.rpm
rpm -Uvh openmotif22-2.2.3-18.i386.rpm
Shared Disk 생성 (raw 디바이스)
호스트 윈도우에서 D:\VMware\rac\shared 에 생성한 두 개의 disk를 fdisk로 분할합니다.
root 계정으로 작업합니다.
raw 시스템으로 생성하며,
Clusterware에서 사용하는 voting (200MB), OCR (200MB) 을 만들고,
control (200MB X 4), redo (300MB X 6), data (2GB X 5) 를 만들겁니다.
각각 만들어진 파티션에는 하나의 tablespace만이 들어갈 수 있습니다.
반드시 나중을 위해서 어떤 파이션에 어떤 tablespace가 있는지 엑셀로 따로 정리를 해 두어야 합니다.
# cd /dev
# ls sd*
sda sda1 sda2 sdb sdc
sdb, sdc가 두개의 Shared Disk 입니다.
fdisk로 분할합니다. sdb는 13개로 분할하고, sdc는 5개로 분할합니다. (disk당 최대 15개까지 가능)
[root@rac1 dev]# fdisk /dev/sdb
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): +200M
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 25 200781 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
n : 새로 파티션을 만듭니다.
1 : 1번 파티션
+200M : 200MB로 생성
p 또는 e : primary 또는 extended
w : 저장
전부 4개의 파티션을 만들 수 있는데 extended를 사용하려면
마지막 4번째의 파티션을 extended로 전체 할당하고, 4번째 파티션을 다시 10개로 나눕니다. (최대 12개까지 가능)
이렇게 sdb를 13개의 파티션으로 나눕니다. ( P 200M, P 200M, P 200M, E 나머지전체 ( 200M, 200M, 200M, 300M, 300M, 300M, 300M, 300M, 300M, 나머지전체 ) )
sdc는 5개로 나눕니다. (2G, 2G, 2G, 2G, 2G)
종료전에 w로 저장을 꼭 해야합니다.
[root@rac1 dev]# fdisk -l
Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 6527 52323705 8e Linux LVM
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 25 200781 83 Linux
/dev/sdb2 26 50 200812+ 83 Linux
/dev/sdb3 51 75 200812+ 83 Linux
/dev/sdb4 76 1305 9879975 5 Extended
/dev/sdb5 76 100 200812 83 Linux
/dev/sdb6 101 125 200812 83 Linux
/dev/sdb7 126 150 200812 83 Linux
/dev/sdb8 151 187 297202 83 Linux
/dev/sdb9 188 224 297202 83 Linux
/dev/sdb10 225 261 297202 83 Linux
/dev/sdb11 262 298 297202 83 Linux
/dev/sdb12 299 335 297202 83 Linux
/dev/sdb13 336 372 297202 83 Linux
/dev/sdb14 373 1305 7494322 83 Linux
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 244 1959898+ 83 Linux
/dev/sdc2 245 488 1959930 83 Linux
/dev/sdc3 489 732 1959930 83 Linux
/dev/sdc4 733 1305 4602622+ 5 Extended
/dev/sdc5 733 976 1959898+ 83 Linux
/dev/sdc6 977 1305 2642661 83 Linux
raw 디바이스 바인딩
/etc/udev/rules.d/60-raw.rules 에 추가
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdb3", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdb6", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdb7", RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add", KERNEL=="sdb8", RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add", KERNEL=="sdb9", RUN+="/bin/raw /dev/raw/raw8 %N"
ACTION=="add", KERNEL=="sdb10", RUN+="/bin/raw /dev/raw/raw9 %N"
ACTION=="add", KERNEL=="sdb11", RUN+="/bin/raw /dev/raw/raw10 %N"
ACTION=="add", KERNEL=="sdb12", RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add", KERNEL=="sdb13", RUN+="/bin/raw /dev/raw/raw12 %N"
ACTION=="add", KERNEL=="sdb14", RUN+="/bin/raw /dev/raw/raw13 %N"
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw14 %N"
ACTION=="add", KERNEL=="sdc2", RUN+="/bin/raw /dev/raw/raw15 %N"
ACTION=="add", KERNEL=="sdc3", RUN+="/bin/raw /dev/raw/raw16 %N"
ACTION=="add", KERNEL=="sdc5", RUN+="/bin/raw /dev/raw/raw17 %N"
ACTION=="add", KERNEL=="sdc6", RUN+="/bin/raw /dev/raw/raw18 %N"
/etc/udev/rules.d/65-raw-permissions.rules 생성
# cat /etc/udev/rules.d/65-raw-permissions.rules
# Set permissions of raw bindings to Oracle Clusterware devices
KERNEL=="raw1", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw2", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw3", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw4", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw5", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw6", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw7", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw8", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw9", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw10", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw11", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw12", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw13", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw14", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw15", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw16", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw17", OWNER="oracle", GROUP="dba", MODE="660"
KERNEL=="raw18", OWNER="oracle", GROUP="dba", MODE="660"
[root@rac1 dev]# start_udev
udev (을)를 시작 중: [ OK ]
[root@rac1 dev]# raw -qa
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2: bound to major 8, minor 18
/dev/raw/raw3: bound to major 8, minor 19
/dev/raw/raw4: bound to major 8, minor 21
/dev/raw/raw5: bound to major 8, minor 22
/dev/raw/raw6: bound to major 8, minor 23
/dev/raw/raw7: bound to major 8, minor 24
/dev/raw/raw8: bound to major 8, minor 25
/dev/raw/raw9: bound to major 8, minor 26
/dev/raw/raw10: bound to major 8, minor 27
/dev/raw/raw11: bound to major 8, minor 28
/dev/raw/raw12: bound to major 8, minor 29
/dev/raw/raw13: bound to major 8, minor 30
/dev/raw/raw14: bound to major 8, minor 33
/dev/raw/raw15: bound to major 8, minor 34
/dev/raw/raw16: bound to major 8, minor 35
/dev/raw/raw17: bound to major 8, minor 37
/dev/raw/raw18: bound to major 8, minor 38
심볼릭 링크 만들기 (oracle 계정으로)
ln -sf /dev/raw/raw1 /u01/oradata/rac1/disk1
ln -sf /dev/raw/raw2 /u01/oradata/rac1/disk2
ln -sf /dev/raw/raw3 /u01/oradata/rac1/disk3
ln -sf /dev/raw/raw4 /u01/oradata/rac1/disk4
ln -sf /dev/raw/raw5 /u01/oradata/rac1/disk5
ln -sf /dev/raw/raw6 /u01/oradata/rac1/disk6
ln -sf /dev/raw/raw7 /u01/oradata/rac1/disk7
ln -sf /dev/raw/raw8 /u01/oradata/rac1/disk8
ln -sf /dev/raw/raw9 /u01/oradata/rac1/disk9
ln -sf /dev/raw/raw10 /u01/oradata/rac1/disk10
ln -sf /dev/raw/raw11 /u01/oradata/rac1/disk11
ln -sf /dev/raw/raw12 /u01/oradata/rac1/disk12
ln -sf /dev/raw/raw13 /u01/oradata/rac1/disk13
ln -sf /dev/raw/raw14 /u01/oradata/rac1/disk14
ln -sf /dev/raw/raw15 /u01/oradata/rac1/disk15
ln -sf /dev/raw/raw16 /u01/oradata/rac1/disk16
ln -sf /dev/raw/raw17 /u01/oradata/rac1/disk17
ln -sf /dev/raw/raw18 /u01/oradata/rac1/disk18
공유 Disk 설정
RAC1을 shutdown하고 RH5Rac1폴더에 Red Hat Linux.vmx 에 다음을 추가합니다.
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
RAC2 Linux 복사본 만들기
RAC2를 만들기 위해서 리눅스를 다시 설치할 필요가 없습니다.
복사만 해주면 되는데 그 전에 해야할 것이 있습니다.
- RAC1 리눅스를 shutdown하고 RH5Rac2 폴더를 만들고 안에 있는 모든 파일을 복사합니다.
- Red Hat Linux.vmx 파일에 displayName만 변경하면 됩니다.
displayName = "RH5Rac2"
- RAC1과 RAC2를 모두 시작합니다.
rac2 네트워크 변경
eth0.bak과 eth1.bak은 삭제합니다.
eth0은 192.168.89.102
eth1은 192.168.206.102로 셋팅합니다. 셋팅후, 비활성화, 활성화를 하여 반영합니다.
DNS 탭에서 호스트명을 rac2로 변경합니다.
저장하고 종료합니다.
rac1과 rac2에서 서로 ping이 되는지 확인합니다.
hostname 변경 적용을 위한 rebooting
SSH사용을 위한 셋팅 (oracle 계정)
clusterware 설치시 서버 통신하기 위해서 셋팅이 필요합니다.
rac1에서
mkdir ~/.ssh
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
rac2에서
mkdir ~/.ssh
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
rac1에서
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
테스트 - 양쪽에서 확인
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
nslookup rac1-vip
nslookup rac2-vip