読者です 読者をやめる 読者になる 読者になる

Oracle Rac On Amazon EC2 その3 Oracle&Gridユーザ&OS事前設定編

•ネットワークの設定(/etc/hosts)
ec2の場合、DHCPなので、ホスト名や/etc/hostsにIPを固定する場合には工夫が必要。
@nkjmさんのページを参考にする。
http://nkjmkzk.net/?p=1919

#vi /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=rac1.s4r.info

#vi /etc/sysconfig/hosts.template

127.0.0.1 localhost.localdomain localhost

1 localhost6.localdomain6 localhost6

#public
192.168.0.11 rac1.s4r.info rac1
192.168.0.12 rac2.s4r.info rac2
#vip
192.168.0.21 rac1-vip.s4r.info rac1-vip
192.168.0.22 rac2-vip.s4r.info rac2-vip
#scan
192.168.0.30 cluster-scan.s4r.info cluster-scan
#private
192.168.100.11 rac1-priv.s4r.local rac1-priv
192.168.100.12 rac2-priv.s4r.local rac2-priv

#vi /etc/rc.local

PRIV_IP=`curl curl http://169.254.169.254/latest/meta-data/local-ipv4`
cp -f /etc/sysconfig/hosts.template /etc/hosts
echo "$PRIV_IP $(hostname)" >> /etc/hosts

openvpniscsiの設定が終わってしまえば後は物理マシンやVMware/Virtual BoxでRACを作るのとほとんど変わりません。

以下を参考に。
http://www.oracle.com/technetwork/articles/hunter-rac11gr2-iscsi-088677.html
http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2011/01/virtualbox-d-10.html

ユーザ/グループの作成
group idあわせたいので既存のものを削除
#userdel -r oracle
#groupdel dba
#groupdel oinstall

Gridユーザの作成
#groupadd -g 1000 oinstall
#groupadd -g 1200 asmadmin
#groupadd -g 1201 asmdba
#groupadd -g 1202 asmoper
#useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid

Oracleユーザの作成
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle

インストール先のディレクトリ作成
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01


グリッドユーザの設定

vi .bashrc

if [ -t 0 ]; then
stty intr ^C
fi

vi .bash_profile

export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_PATH=.:/u01/app/oracle/common/oracle/sql
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/oracm/lib:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib:$CLASSPATH
export NLS_LANG=Japanese_japan.al32utf8
export PATH=.:$ORACLE_HOME/bin:$PATH
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
export TNS_ADMIN=$ORACLE_HOME/network/admin
umask 022


passwd oracle
su - oracle


vi .bashrc

if [ -t 0 ]; then
stty intr ^C
fi

vi .bash_profile

#for Oracle Owner
export ORACLE_SID=ORCL1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_PATH=.:$ORACLE_BASE/common/oracle/sql
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/oracm/lib:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib:$CLASSPATH
export NLS_LANG=Japanese_japan.al32utf8
export PATH=.:$ORACLE_HOME/bin:$PATH
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
export TNS_ADMIN=$ORACLE_HOME/network/admin

export ORACLE_UNQNAME=ORCL
umask 022

カーネルの設定
vi /etc/security/limits.conf
以下を追加

grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240

vi /etc/pam.d/login

session required pam_limits.so

vi /etc/profile

if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi

カーネルパラメータ →構成済み

oracleasmの設定
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.htmlからダウンロード)
rpm -ivh http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el5.x86_64.rpm

/etc/init.d/oracleasm start

# /usr/sbin/oracleasm configure -i

Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets (''). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface : grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

ASMディスク初期化
/usr/sbin/oracleasm createdisk CRSVOL1 /dev/iscsi/crs/part1
/usr/sbin/oracleasm createdisk FRAVOL1 /dev/iscsi/fra/part1
/usr/sbin/oracleasm createdisk DATAVOL1 /dev/iscsi/data/part1

NTP無効化

#/sbin/service ntpd stop
#chkconfig ntpd off
#mv /etc/ntp.conf /etc/ntp.conf.original
#rm /var/run/ntpd.pid

ノード2作成
ノード1からcreate amiを実行してAMIを作成。
そのAMIからノード2を作成する。

AMIを立ち上げ後、以下を変更
vi /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=rac2.s4r.info


#vi /home/grid/.bash_profile

export ORACLE_SID=+ASM2

#vi /home/oracle/.bash_profile

export ORACLE_SID=ORCL2


#vi /etc/openvpn/public.conf

cert /etc/openvpn/easy-rsa/2.0/keys/public2.crt
key /etc/openvpn/easy-rsa/2.0/keys/public2.key


#vi /etc/openvpn/private.conf

cert /etc/openvpn/easy-rsa/2.0/keys/private2.crt
key /etc/openvpn/easy-rsa/2.0/keys/private2.key