########12c rac 多出一個grid的base目錄和須要準備一個40G的盤作GIMR磁盤,其餘大體相同.
linux
########從滿腦子問號rac是什麼開始搞,作以前先百度瞭解rac是什麼,基本架構是怎麼樣的,大概就是下圖這樣子,詳細點的自行百度~c++
########準備好oracle安裝包,Oracle官網下載,包不要錢.數據庫
########p13390677_112040_Linux-x86-64_1of7/p13390677_112040_Linux-x86-64_2of7/p13390677_112040_Linux-x86-64_3of7bash
1.VMware環境:兩臺安裝linux的虛擬機,本次我使用的red hat 6.8,每臺兩個網卡public/private。session
搞幾個共享磁盤出來架構
cmd切換到VMware安裝目錄下,執行建立共享磁盤.oracle
vmware-vdiskmanager.exe -c -s 1G -a lsilogic -t 2 C:\share_disk\ocr01.vmdkapp
vmware-vdiskmanager.exe -c -s 1G -a lsilogic -t 2 C:\share_disk\ocr02.vmdkide
vmware-vdiskmanager.exe -c -s 1G -a lsilogic -t 2 C:\share_disk\ocr03.vmdk測試
vmware-vdiskmanager.exe -c -s 5G -a lsilogic -t 2 C:\share_disk\data.vmdk
vmware-vdiskmanager.exe -c -s 5G -a lsilogic -t 2 C:\share_disk\backup.vmdk
改虛擬機的.vmx文件,文件末尾添加剛纔建立的虛擬磁盤.
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "virtual"
scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.filename = "C:\share_disk\ocr01.vmdk"
scsi1:1.deviceType = "disk"
scsi1:2.present = "TRUE"
scsi1:2.mode = "independent-persistent"
scsi1:2.filename = "C:\share_disk\ocr02.vmdk"
scsi1:2.deviceType = "disk"
scsi1:3.present = "TRUE"
scsi1:3.mode = "independent-persistent"
scsi1:3.filename = "C:\share_disk\ocr03.vmdk"
scsi1:3.deviceType = "disk"
scsi1:4.present = "TRUE"
scsi1:4.mode = "independent-persistent"
scsi1:4.filename = "C:\share_disk\backup.vmdk"
scsi1:4.deviceType = "disk"
scsi1:5.present = "TRUE"
scsi1:5.mode = "independent-persistent"
scsi1:5.filename = "C:\share_disk\data.vmdk"
scsi1:5.deviceType = "disk"
disk.locking = "false"
disk.EnableUUID = "true"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.DataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
2.開機檢查兩臺主機均可以看到剛添加的共享盤,檢查swap空間。
內存 |
Swap |
1 - 2 GB |
內存的1.5倍 |
2-16GB |
和內存相等 |
>16GB |
16 GB |
3.操做系統配置
3.1關閉selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
3.2關閉iptables
rhel6
service iptables stop
chkconfig ip6tables off
chkconfig iptables off
rhel7
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
3.3改IP地址,改hosts文件
cat >> /etc/hosts <<EOF
2.2.2.10 rac1
2.2.2.11 rac1-vip
2.2.2.20 rac2
2.2.2.21 rac2-vip
2.2.2.15 rac-scan
192.168.88.200 rac1-priv
192.168.88.201 rac2-priv
EOF
禁用ntp,oracle rac中會使用ctss來同步集羣時間.
mv /etc/ntp.conf /etc/ntp.conf.bak
3.4內核參數
cat >> /etc/sysctl.conf <<EOF
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF
sysctl -p
3.5Limits
cat >> /etc/security/limits.conf <<EOF
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
EOF
12C:
grid soft stack 10240
oracle soft stack 10240
3.6 pam
echo session required pam_limits.so >> /etc/pam.d/login
3.7 profile
cat >> /etc/profile <<EOF
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
EOF
3.8 新建用戶及更改環境變量.
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/groupadd -g 507 asmoper
/usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper grid
/usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle
##passwd oracle
echo "oracle:oracle" | chpasswd
##passwd grid
echo "grid:grid" | chpasswd
##Oracle Inventory目錄
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory
##Grid Home目錄
mkdir -p /u01/11.2.0/grid
chown -R grid:oinstall /u01/12.2.0/grid
chmod -R 775 /u01/11.2.0/grid
##Oracle Base目錄
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/cfgtoollogs
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
##Oracle Home目錄
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle/product/
chmod -R 775 /u01/app/oracle/product/
12C:grid $ORACLE_BASE
mkdir /u01/grid
chown -R grid:oinstall /u01/grid
chmod -R 775 /u01/grid
##oracle用戶.bash_profile添加
vi /home/oracle/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=jicheng1 ##rac2爲jicheng2
export NLS_LANG=american_america.zhs16gbk
export PATH=.:$PATH:$ORACLE_HOME/bin:/ u01/11.2.0/grid/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
##grid用戶.bash_profile添加
vi /home/grid/.bash_profile
export ORACLE_BASE=/u01/app/oracle
#12C export ORACLE_BASE=/u01/grid
export ORACLE_HOME=/u01/11.2.0/grid
export ORACLE_SID=+ASM1 ##rac2爲ASM2
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
3.9 操做系統配置結束,reboot兩臺機器(改配置文件關selinux重啓生效)
4.ASM盤,能夠使用ASMlib和udev方式來綁定,本次使用udev來綁定ASM磁盤
取共享磁盤ssid,建立文件/etc/udev/rules.d/99-oracle.rules並寫入,往rac2節點拷貝一份,一樣啓動start_udev
rhel6
for i in sdb sdc sdd sde sdf; do UUID=`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$i` ; echo 'KERNEL=="sd*", BUS=="scsi", PROGRAM=="scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="'$UUID'", NAME="asm-'$i'", OWNER="grid", GROUP="asmadmin", MODE="0660"'; done >> /etc/udev/rules.d/99-oracle.rules ; cat /etc/udev/rules.d/99-oracle.rules
start_udev
ll /dev/asm*
scp /etc/udev/rules.d/99-oracle.rules 2.2.2.20:/etc/udev/rules.d/99-oracle.rules
rac2 :
start_udev
ll /dev/asm*
rhel7
for i in b c d e f
do
UUID=`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`
echo 'KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="'$UUID'", SYMLINK+="asm-disk'$i'",OWNER="grid", GROUP="asmadmin",MODE="0660"'
done >> /etc/udev/rules.d/99-oracle.rules
/sbin/udevadm trigger --type=devices --action=change
udevadm control --reload-rules
5.上傳文件,安裝依賴包,圖形界面安裝grid,oracle數據庫軟件,DBCA建庫。
5.1安裝依賴包,配好yum裝吧
yum install -y binutils compat-libstdc++-33 glibc ksh libaio libgcc libstdc++ make compat-libcap1 gcc gcc-c++ glibc-devel libaio-devel libstdc++-devel sysstat elfutils-libelf-devel
5.2圖形界面grid用戶運行 ./runInstaller
installation type 選高級.
添加rac2,配置雙節點grid用戶互信
注意選擇路徑,把剛纔三個ocr磁盤選上
最後安裝檢查會報asm磁盤警告,檢查兩個節點均可以訪問asm磁盤後直接忽略下一步.
dd if=/dev/zero f=/dev/asm-sda bs=1024 count=1
5.3安裝完成運行root腳本,先在第一個節點上執行,而後其餘節點順序執行,不能同時執行
/u01/app/oraInventory/orainstRoot.sh
/u01/11.2.0/grid/root.sh
5.4驗證集羣
[root@rac1]# /oracle/11.2.0/grid/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.cvu ora.cvu.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE rac1
ora.oc4j ora.oc4j.type ONLINE ONLINE rac1
ora.ons ora.ons.type ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora....ry.acfs ora....fs.type ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
5.5圖形界面oracle用戶運行 ./runInstaller
只安裝數據庫軟件
添加rac2,設置oracle用戶互信
5.6一路下一步到安裝完成,一樣執行root腳本
5.7DBCA建庫,圖形界面Oracle用戶執行dbca
選rac數據庫
自定義,定製
選中兩個節點
使用ASM盤存儲數據
後面配置就看需求了,測試環境能夠都試一試.
結束。