CentOS7.2安裝oracle 12c RAC
一、基礎結構:
二、存儲規劃:
1、 GRID集群組件磁盤組
+dggrid: 1個,由三個10G磁盤組成normal
2、 數據庫安裝磁盤組
+dgsystem:用於數據庫基本表空間,控制文件,參數文件等
+dgrecovery:用於歸檔與閃回日誌空間
+dgdata:用戶數據庫業務表空間
三、IP規劃:
oraclenode1:
publicip : bond0 :192.168.10.103
vip:192.168.10.105
privateip :bond2 :192.168.14.3
oraclenode2:
publicip : bond0 :192.168.10.104
vip:192.168.10.106
privateip :bond2 :192.168.14.4
scanip :192.168.10.107
四、軟件版本:
操作系統:CentOS 7.2
數據庫:ORACLE12c R1
集群管理軟件:ORACLEGRID 12.0.1.2
五、系統環境配置:
註意:如下配置除非特別說明,否則兩個節點都需要操作
1、安裝軟件依賴
yum install binutilscompat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 gcc gcc-c++ glibc glibc.i686 glibc-develglibc-devel.i686 ksh libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libaiolibaio.i686 libaio-devel libaio-devel.i686 libXext libXext.i686 libXtst libXtst.i686 libX11libX11.i686 libXau libXau.i686 libxcb libxcb.i686 libXi libXi.i686 make sysstat unixODBCunixODBC-devel readline libtermcap-devel pdksh -y
2、修改host文件
#在兩臺主機修改host文件,添加如下內容: vim /etc/hosts #public ip bond0 192.168.10.103 oraclenode1 192.168.10.104 oraclenode2 #private ip bond2 192.168.14.3 oraclenode1pri 192.168.14.4 oraclenode2pri #vip ip 192.168.10.105 oraclenode1vip 192.168.10.106 oraclenode2vip #scan ip 192.168.10.107 oraclenodescan
3、關閉selinux和配置防火墻
setenforce 0 firewall-cmd --set-defaults-zone=trusted
4、添加組與用戶
#在兩個節點增加用戶與組: groupadd -g 60001 oinstall groupadd -g 60002 dba groupadd -g 60003 oper groupadd -g 60004 backupdba groupadd -g 60005 dgdba groupadd -g 60006 kmdba groupadd -g 60007 asmdba groupadd -g 60008 asmoper groupadd -g 60009 asmadmin useradd -u 61001 -g oinstall -G asmadmin,asmdba,dba,asmoper grid useradd -u 61002 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin,oper,asmdba oracle echo "grid" | passwd --stdin grid echo "oracle" | passwd --stdin oracle
5、添加目錄
mkdir -p /data/oracle/app/grid mkdir -p /data/oracle/app/12.1.0.2/grid chown -R grid:oinstall /data/oracle mkdir -p /data/oracle/app/oraInventory chown -R grid:oinstall /data/oracle/app/oraInventory mkdir -p /data/oracle/app/oracle chown -R oracle:oinstall /data/oracle/app/oracle chmod -R 775 /data/oracle
6、修改操作系統參數
vim/etc/security/limits.conf #ORACLE SETTING grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 grid soft stack 10240 grid hard stack 32768 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 vim/etc/security/limits.d/20-nproc.conf # Change this * soft nproc 1024 # To this * - nproc 16384 vim/etc/pam.d/login #ORACLE SETTING session required pam_limits.so MEMTOTAL=$(free -b | sed -n ‘2p‘ | awk ‘{print $2}‘) SHMMAX=$(expr $MEMTOTAL \*4 / 5) SHMMNI=4096 SHMALL=$(expr $MEMTOTAL /\( 4 \* 1024 \)) cp /etc/sysctl.conf /etc/sysctl.conf.bak cat >> /etc/sysctl.conf << EOF fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmax = $SHMMAX kernel.shmall = $SHMALL kernel.shmmni = $SHMMNI kernel.sem = 250 32000 100 128 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 kernel.panic_on_oops = 1 EOF # kernel.shmmax大於共享內存區,小於物理內存 # kernel.shmall物理內存/4K 讓配置生效: sysctl –p #使用centos 7.2 安裝grid時,需要修改這個參數,不然會報錯 vim /etc/systemd/logind.conf RemoveIPC=no systemctldaemon-reload systemctlrestart systemcd-logind
7、配置用戶環境變量
su - grid #grid用戶的環境變量如下: vim~/.bash_profile PS1="[`whoami`@`hostname`:"‘$PWD]$‘ export PS1 umask 022 export TMP=/tmp exportLANG=en_US export TMPDIR=$TMP exportORACLE_HOSTNAME=oraclenode1 ORACLE_SID=+ASM1;export ORACLE_SID ORACLE_TERM=xterm;export ORACLE_TERM ORACLE_BASE=/data/oracle/app/grid;export ORACLE_BASE ORACLE_HOME=/data/oracle/app/12.1.0.2/grid;export ORACLE_HOME NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"; export NLS_DATE_FORMAT PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin;export PATH THREADS_FLAG=native;export THREADS_FLAG 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 su - oracle #oracle用戶的環境變量如下: vim~/.bash_profile PS1="[`whoami`@`hostname`:"‘$PWD]$‘ export PS1 export TMP=/tmp exportLANG=en_US exportTMPDIR=$TMP export ORACLE_HOSTNAME=oraclenode1 exportORACLE_UNQNAME=orcldb ORACLE_BASE=/data/oracle/app/oracle;export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1;export ORACLE_HOME ORACLE_SID=orcldb1;export ORACLE_SID ORACLE_TERM=xterm;export ORACLE_TERM NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"; export NLS_DATE_FORMAT NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;exportNLS_LANG PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/12.1.0.2/db_1/bin:$ORACLE_HOME/bin;export PATH THREADS_FLAG=native;export THREADS_FLAG 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 #節點二: su - grid #grid的環境變量 vim~./bash_profile PS1="[`whoami`@`hostname`:"‘$PWD]$‘ export PS1 umask 022 export TMP=/tmp exportLANG=en_US exportTMPDIR=$TMP exportORACLE_HOSTNAME=oraclenode2 ORACLE_SID=+ASM2;export ORACLE_SID ORACLE_TERM=xterm;export ORACLE_TERM ORACLE_BASE=/data/oracle/app/grid;export ORACLE_BASE ORACLE_HOME=/data/oracle/app/12.1.0.2/grid;export ORACLE_HOME NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"; export NLS_DATE_FORMAT PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin;export PATH THREADS_FLAG=native;export THREADS_FLAG 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 su - oracle vim~/.bash_profile PS1="[`whoami`@`hostname`:"‘$PWD]$‘ export PS1 export TMP=/tmp exportLANG=en_US exportTMPDIR=$TMP exportORACLE_HOSTNAME=oraclenode2 exportORACLE_UNQNAME=orcldb ORACLE_BASE=/data/oracle/app/oracle;export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1;export ORACLE_HOME ORACLE_SID=orcldb2;export ORACLE_SID ORACLE_TERM=xterm;export ORACLE_TERM NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"; export NLS_DATE_FORMAT NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;exportNLS_LANG PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/12.1.0.2/db_1/bin:$ORACLE_HOME/bin;export PATH THREADS_FLAG=native;export THREADS_FLAG 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
8、配置ssh無密登錄(兩節點)
su - grid ssh-keygen ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] su - oracle ssh-keygen ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
9、配置共享存儲
存儲劃分以下卷: grid01 10G grid02 10G grid03 10G system 300G recovery 800G data 4T 配置多路徑wwid和別名: 前提:服務器已經連接到存儲,並識別到LUN a、 配置/etc/multipath.conf文件 defaults { polling_interval 10 path_selector "round-robin0" path_grouping_policy multibus prio alua path_checker readsector0 rr_min_io 100 max_fds 8192 rr_weight priorities failback immediate no_path_retry fail user_friendly_names yes find_multipaths yes } blacklist { devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" devnode "^sd[a]" } b、 執行如下命令 modprobe dm-multipath multipath -F multipath dm-multipath multipath dm-round-robin 執行完成上述命令之後,會在/etc/multipath目錄下生成一個bindings這的一個文件,包含了存儲的uuid和別名 mpatha 36000d310036222000000000000000003 mpathb 36000d310036222000000000000000004 mpathc 36000d310036222000000000000000008 mpathd 36000d310036222000000000000000007 mpathe 36000d310036222000000000000000006 mpathf 36000d310036222000000000000000005 mpathg 36000d310036222000000000000000009 c、 修改別名方便識別 multipaths { multipath { wwid 36000d310036222000000000000000004 alias dgdata path_grouping_policy multibus } multipath { wwid 36000d310036222000000000000000005 alias dggrid1 path_grouping_policy multibus } multipath { wwid 36000d310036222000000000000000006 alias dggrid2 path_grouping_policy multibus } multipath { wwid 36000d310036222000000000000000009 alias dgrecovery path_grouping_policy multibus } multipath { wwid 36000d310036222000000000000000007 alias dggrid3 path_grouping_policy multibus } multipath { wwid 36000d310036222000000000000000008 alias dgsystem path_grouping_policy multibus } } 重啟服務生效 systemctl reload multipath d、 修改udev權限 vim /etc/udev/rules/ 12-mulitpath-privs.rules ENV{DM_NAME}=="dg*",OWNER:="grid", GROUP:="asmadmin", MODE:="660" 重啟服務器生效,並檢查重啟後權限、別名是否正常
10、安裝cvuqdisk包並驗證
解壓安裝包 unzip linuxamd64_12102_grid_1of2.zip unzip linuxamd64_12102_grid_2of2.zip cd /soft/grid/rpm export CVUQDISK_GRP=oinstall rpm -ivh cvuqdisk-1.0.9-1.rpm su - grid ./runcluvfy.shstage -pre crsinst -n oraclenode1,oraclenode2 -fixup -verbose ./runcluvfy.sh stage-post hwos -n oraclenode1,oraclenode2 -verbose #檢查不通過的配置
11、安裝grid
#遠程調用圖形界面安裝vnc ./runInstaller
圖形化界面安裝,按照前面規劃填寫相關配置,值得註意的是硬盤位置需要修改:使用多路徑修改為/dev/mapper/dg*
grid安裝完成,使用crs_stat-t查看集群狀態,使用ocrcheck、crsctl query css votedisk查看ocr磁盤狀態
12、創建asm磁盤組
su - grid asmca #按照自己的規劃,添加相應的磁盤組,並和存儲卷關聯
數據庫軟件的安裝和實例創建,可以參考http://ld0381.blog.51cto.com/3318114/1923076上的內容,集群的配置和單實例步驟基本上是一致的。
本文出自 “ld0381的學習之旅” 博客,請務必保留此出處http://ld0381.blog.51cto.com/3318114/1923207
CentOS7.2安裝oracle 12c RAC