環境參數:Linux:Centos6.5 Grid和Oracle:11.2.0.4
1、環境配置
1.配置Node1和Node2兩個節點之間的網卡
Node1:
- [root@rac1 network-scripts]# cat ifcfg-eth0
- DEVICE=eth0
- HWADDR=08:00:27:E6:6A:DF
- TYPE=Ethernet
- UUID=543aef46-94aa-442f-9259-8584588c5e66
- ONBOOT=yes
- NM_CONTROLLED=yes
- BOOTPROTO=none
- IPADDR=192.168.8.221
- NETMASK=255.255.255.0
- GATEWAY=192.168.8.1
- DNS1=221.228.255.1
-
- [root@rac1 network-scripts]# cat ifcfg-eth1
- DEVICE=eth1
- HWADDR=08:00:27:72:5A:8F
- TYPE=Ethernet
- ONBOOT=yes
- NM_CONTROLLED=yes
- BOOTPROTO=none
- IPADDR=172.168.1.18
Node2:
- [root@rac2 network-scripts]# cat ifcfg-eth0
- DEVICE=eth0
- HWADDR=08:00:27:1B:D9:5A
- TYPE=Ethernet
- UUID=543aef46-94aa-442f-9259-8584588c5e66
- ONBOOT=yes
- NM_CONTROLLED=yes
- BOOTPROTO=none
- IPADDR=192.168.8.223
- NETMASK=255.255.255.0
- GATEWAY=192.168.8.1
- DNS1=221.228.255.1
-
- [root@rac2 network-scripts]# cat ifcfg-eth1
- DEVICE=eth1
- HWADDR=08:00:27:39:5F:8C
- TYPE=Ethernet
- ONBOOT=yes
- NM_CONTROLLED=yes
- BOOTPROTO=none
- IPADDR=172.168.1.19
2.配置/etc/hosts主機文件
- [root@rac1 network-scripts]# cat /etc/hosts
-
- 127.0.0.1 localhost
- ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
-
- #node1
- 192.168.8.221 rac1 rac1.oracle.com
- 192.168.8.222 rac1-vip
- 172.168.1.18 rac1-priv
-
- #node2
- 192.168.8.223 rac2 rac2.oracle.com
- 192.168.8.224 rac2-vip
- 172.168.1.19 rac2-priv
-
- #scan-ip
- 192.168.8.225 rac-cluster rac-cluster-scan
3.配置DNS(略,能夠暫時不配置)
4.關閉防火牆css
- service iptables stop
- chkconfig iptables off
5.關閉Selinux
- vim /etc/selinux/config
-
- SELINUX=disabled
6.建立用戶和組node
- groupadd -g 1000 oinstall
- groupadd -g 1200 asmadmin
- groupadd -g 1201 asmdba
- groupadd -g 1202 asmoper
- groupadd -g 1300 dba
- groupadd -g 1301 oper
- useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper grid
- useradd -u 1101 -g oinstall -G dba,oper,asmdba oracle
- passwd grid
- passwd oracle
7.配置用戶的環境變量linux
Node1:c++
- export PATH
- export TMP=/tmp
- export TMPDIR=$TMP
- export ORACLE_SID=+ASM1
- export ORACLE_BASE=/u01/grid
- export ORACLE_HOME=/u01/app/grid/11.2.0
- export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
- export TNS_ADMIN=$ORACLE_HOME/network/admin
- export PATH=/usr/sbin:$PATH
- export PATH=$ORACLE_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 LANG=en_US
- export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
- umask 022
- export PATH
- export TMP=/tmp
- export TMPDIR=$TMP
- export ORACLE_HOSTNAME=rac1
- export ORACLE_SID=orcl1
- export ORACLE_BASE=/u01/oracle
- export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
- export ORACLE_UNQNAME=orcl
- export TNS_ADMIN=$ORACLE_HOME/network/admin
- #export ORACLE_TERM=xterm
- export PATH=/usr/sbin:$PATH
- export PATH=$ORACLE_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 LANG=en_US
- export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
- export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
- umask 022
Node2:
- export PATH
- export TMP=/tmp
- export TMPDIR=$TMP
- export ORACLE_SID=+ASM2
- export ORACLE_BASE=/u01/grid
- export ORACLE_HOME=/u01/app/grid/11.2.0
- export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
- export TNS_ADMIN=$ORACLE_HOME/network/admin
- export PATH=/usr/sbin:$PATH
- export PATH=$ORACLE_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 LANG=en_US
- export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
- umask 022
- export PATH
- export TMP=/tmp
- export TMPDIR=$TMP
- export ORACLE_HOSTNAME=rac2
- export ORACLE_SID=orcl2
- export ORACLE_BASE=/u01/oracle
- export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
- export ORACLE_UNQNAME=orcl
- export TNS_ADMIN=$ORACLE_HOME/network/admin
- #export ORACLE_TERM=xterm
- export PATH=/usr/sbin:$PATH
- export PATH=$ORACLE_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 LANG=en_US
- export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
- export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
- umask 022
8.建立所需目錄
- mkdir -p /u01/grid
- mkdir -p /u01/app/grid/11.2.0
- mkdir -p /u01/oracle
- chown -R oracle:oinstall /u01
- chown -R grid:oinstall /u01/grid
- chown -R grid:oinstall /u01/app/grid/11.2.0
- chmod -R 775 /u01
9.配置limits.conf增長如配置
- vim /etc/security/limits.conf
-
- oracle soft nofile 1024
- oracle hard nofile 65536
- oracle soft nproc 2047
- oracle hard nproc 16384
- oracle soft stack 10240
- oracle hard stack 32768
- grid soft nofile 1024
- grid hard nofile 65536
- grid soft nproc 2047
- grid hard nproc 16384
- grid soft stack 10240
- grid hard stack 32768
10.修改內核參數
- vim /etc/sysctl.conf
- fs.aio-max-nr = 1048576
- fs.file-max = 6815744
- kernel.shmall = 1073741824
- kernel.shmmax = 4398046511104
- kernel.shmmni = 4096
- 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
-
- sysctl -p
11.中止NTP服務sql
- service ntpd stop
- chkconfig ntpd off
- mv /etc/ntp.conf /etc/ntp.conf.bak
11.安裝相關軟件包數據庫
yum install gcc compat-libstdc++-33 elfutils-libelf-devel glibc-devel glibc-headers gcc-c++ libaio-devel libstdc++-devel pdksh compat-libcap1-*vim
12.配置共享存儲網絡
for i in b c d e f g ;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules
doneoracle
--執行
/sbin/start_udevapp
13.上傳並解壓grid和oracle安裝包(略)
2、Grid軟件安裝
1.安裝grid,以grid用戶登陸,並執行./runInstaller進入安裝界面
2.進入界面選擇跳過軟件更新,點擊Next
![](http://static.javashuo.com/static/loading.gif)
2.選擇Grid Infrastructure,點擊Next:
![](http://static.javashuo.com/static/loading.gif)
3.選擇高級安裝,點擊Next
![](http://static.javashuo.com/static/loading.gif)
4.默認Englist,點擊Next
![](http://static.javashuo.com/static/loading.gif)
5.去掉Configure GNS選項,點擊Next
![](http://static.javashuo.com/static/loading.gif)
6.點擊Add選項,輸入對應參數,參考/etc/hosts文件中配置
![](http://static.javashuo.com/static/loading.gif)
7.點擊SSH Connectivity,輸入grid的密碼,點擊Setup等待配置完成,而後點擊Next
![](http://static.javashuo.com/static/loading.gif)
8.確認網絡接口,eth0爲Public,eth1爲Private
![](http://static.javashuo.com/static/loading.gif)
9.選擇Oracle ASM,點擊Next
![](http://static.javashuo.com/static/loading.gif)
10.輸入Disk Group Name,點擊Change Discovery Path,在彈出的對話框中輸入磁盤的路徑,點擊OK
![](http://static.javashuo.com/static/loading.gif)
11.選擇ASM磁盤,點擊Next
![](http://static.javashuo.com/static/loading.gif)
11.輸入口令密碼,點擊Next
![](http://static.javashuo.com/static/loading.gif)
12.選擇不使用IPMI,點擊Next
![](http://static.javashuo.com/static/loading.gif)
13.默認選擇,點擊Next
![](http://static.javashuo.com/static/loading.gif)
14.確認Grid的安裝路徑,其中Grid軟件的ORACLE_HOME不能是ORACLE_BASE的子目錄
![](http://static.javashuo.com/static/loading.gif)
15.默認Inverntory,點擊Next
![](http://static.javashuo.com/static/loading.gif)
16.該錯誤能夠從Grid的安裝文件的rpm目錄下獲取,Node1和Node2都安裝便可,Device Checks for ASM可忽略
![](http://static.javashuo.com/static/loading.gif)
17.進入安裝Grid安裝前的概要信息界面,點擊Install進行安裝
![](http://static.javashuo.com/static/loading.gif)
18.根據紅框中信息,如今Node1節點執行2個腳本,Node1節點所有執行完畢後,再在Node2上分別執行2個腳本,所有執行完畢後,點擊OK,執行下一步
![](http://static.javashuo.com/static/loading.gif)
腳本執行結果以下
Node1:
- [root@rac1 rpm]# /u01/app/oraInventory/orainstRoot.sh
- Changing permissions of /u01/app/oraInventory.
- Adding read,write permissions for group.
- Removing read,write,execute permissions for world.
-
- Changing groupname of /u01/app/oraInventory to oinstall.
- The execution of the script is complete.
- [root@rac1 rpm]# /u01/app/11.2.0/grid/root.sh
- Performing root user operation for Oracle 11g
-
- The following environment variables are set as:
- ORACLE_OWNER= grid
- ORACLE_HOME= /u01/app/11.2.0/grid
-
- Enter the full pathname of the local bin directory: [/usr/local/bin]:
- Copying dbhome to /usr/local/bin ...
- Copying oraenv to /usr/local/bin ...
- Copying coraenv to /usr/local/bin ...
-
-
- Creating /etc/oratab file...
- Entries will be added to the /etc/oratab file as needed by
- Database Configuration Assistant when a database is created
- Finished running generic part of root script.
- Now product-specific root actions will be performed.
- Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
- Creating trace directory
- User ignored Prerequisites during installation
- Installing Trace File Analyzer
- OLR initialization - successful
- root wallet
- root wallet cert
- root cert export
- peer wallet
- profile reader wallet
- pa wallet
- peer wallet keys
- pa wallet keys
- peer cert request
- pa cert request
- peer cert
- pa cert
- peer root cert TP
- profile reader root cert TP
- pa root cert TP
- peer pa cert TP
- pa peer cert TP
- profile reader pa cert TP
- profile reader peer cert TP
- peer user cert
- pa user cert
- Adding Clusterware entries to upstart
- CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1'
- CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded
- CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1'
- CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded
- CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1'
- CRS-2672: Attempting to start 'ora.gipcd' on 'rac1'
- CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded
- CRS-2676: Start of 'ora.gipcd' on 'rac1' succeeded
- CRS-2672: Attempting to start 'ora.cssd' on 'rac1'
- CRS-2672: Attempting to start 'ora.diskmon' on 'rac1'
- CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded
- CRS-2676: Start of 'ora.cssd' on 'rac1' succeeded
-
- ASM created and started successfully.
-
- Disk Group SYSTEMDG created successfully.
-
- clscfg: -install mode specified
- Successfully accumulated necessary OCR keys.
- Creating OCR keys for user 'root', privgrp 'root'..
- Operation successful.
- CRS-4256: Updating the profile
- Successful addition of voting disk 03bd9e6851cf4fb4bf4c92e24a3d71cc.
- Successful addition of voting disk 362f2cfb5b3d4f29bf319c668e0efbe4.
- Successful addition of voting disk 57659c53f4284fbdbfeabafb20c3fbdd.
- Successfully replaced voting disk group with +SYSTEMDG.
- CRS-4256: Updating the profile
- CRS-4266: Voting file(s) successfully replaced
- ## STATE File Universal Id File Name Disk group
- 1. ONLINE 03bd9e6851cf4fb4bf4c92e24a3d71cc (/dev/asm-diskb) [SYSTEMDG]
- 2. ONLINE 362f2cfb5b3d4f29bf319c668e0efbe4 (/dev/asm-diskc) [SYSTEMDG]
- 3. ONLINE 57659c53f4284fbdbfeabafb20c3fbdd (/dev/asm-diskd) [SYSTEMDG]
- Located 3 voting disk(s).
- CRS-2672: Attempting to start 'ora.asm' on 'rac1'
- CRS-2676: Start of 'ora.asm' on 'rac1' succeeded
- CRS-2672: Attempting to start 'ora.SYSTEMDG.dg' on 'rac1'
- CRS-2676: Start of 'ora.SYSTEMDG.dg' on 'rac1' succeeded
- Configure Oracle Grid Infrastructure for a Cluster ... succeeded
Node2:
- [root@rac2 grid]# /u01/app/oraInventory/orainstRoot.sh
- Changing permissions of /u01/app/oraInventory.
- Adding read,write permissions for group.
- Removing read,write,execute permissions for world.
-
- Changing groupname of /u01/app/oraInventory to oinstall.
- The execution of the script is complete.
- [root@rac2 grid]# /u01/app/11.2.0/grid/root.sh
- Performing root user operation for Oracle 11g
-
- The following environment variables are set as:
- ORACLE_OWNER= grid
- ORACLE_HOME= /u01/app/11.2.0/grid
-
- Enter the full pathname of the local bin directory: [/usr/local/bin]:
- Copying dbhome to /usr/local/bin ...
- Copying oraenv to /usr/local/bin ...
- Copying coraenv to /usr/local/bin ...
-
-
- Creating /etc/oratab file...
- Entries will be added to the /etc/oratab file as needed by
- Database Configuration Assistant when a database is created
- Finished running generic part of root script.
- Now product-specific root actions will be performed.
- Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
- Creating trace directory
- User ignored Prerequisites during installation
- Installing Trace File Analyzer
- OLR initialization - successful
- Adding Clusterware entries to upstart
- CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node rac1, number 1, and is terminating
- An active cluster was found during exclusive startup, restarting to join the cluster
- Configure Oracle Grid Infrastructure for a Cluster ... succeeded
19.臨近執行完畢時,報了一個INS-20802的這種錯誤,致使這個錯誤的緣由是在/etc/hosts中配置了SCAN的地址,嘗試ping這個地址信息,若是能夠成功,則這個錯誤能夠忽略。
![](http://static.javashuo.com/static/loading.gif)
20.最後單擊Close,完成Grid軟件在Node1和Node2的安裝操做
3、安裝Oracle軟件
1.安裝oracle,以oracle用戶登陸,並執行./runInstaller進入安裝界面
2.直接點擊Next
![](http://static.javashuo.com/static/loading.gif)
3.選擇跳過軟件更新,點擊Next
![](http://static.javashuo.com/static/loading.gif)
4.選則只安裝數據庫軟件,點擊Next
![](http://static.javashuo.com/static/loading.gif)
5.點擊SSH Connectivity,輸入Oracle的密碼,點擊setup,有以下提示,說明成功
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
6.默認English,點擊Next
![](http://static.javashuo.com/static/loading.gif)
7.選擇Enterprise Edition
![](http://static.javashuo.com/static/loading.gif)
8.默認路徑,點擊Next
![](http://static.javashuo.com/static/loading.gif)
9.選擇Oracle用戶組,默認選擇,點擊Next
![](http://static.javashuo.com/static/loading.gif)
10.Swap size錯誤增大便可,SCAN錯誤前面說過,選擇Ignore all,點擊Next
![](http://static.javashuo.com/static/loading.gif)
11.Oracle安裝概要信息,點擊Next
![](http://static.javashuo.com/static/loading.gif)
12.分別在Node1和Node2執行腳本
![](http://static.javashuo.com/static/loading.gif)
13.最後點擊Close安裝完成
4、建立ASM磁盤組
1.以grid用戶登陸,輸入asmca命令,彈出ASM配置界面,點擊Create
![](http://static.javashuo.com/static/loading.gif)
2.輸入Disk Group Name,點擊OK,會提示建立成功
![](http://static.javashuo.com/static/loading.gif)
3.建立成功後,會發現多出來一行記錄,可是在state只顯示MOUNTED(1of2)
![](http://static.javashuo.com/static/loading.gif)
4.點擊Mount ALL,成功後state顯示MOUNTED(2of2),點擊Exit退出
![](http://static.javashuo.com/static/loading.gif)
5、安裝數據庫實例
1.使用Oracle用戶登陸,執行dbca命令,彈出以下界面,選擇第一項,點擊Next
![](http://static.javashuo.com/static/loading.gif)
2.點擊建立數據庫選項,點擊Next
![](http://static.javashuo.com/static/loading.gif)
3.根據工做中的實際狀況選擇對應的模板,這裏以默認模板爲例
![](http://static.javashuo.com/static/loading.gif)
4.選擇rac1和rac2,輸入orcl實例名,點擊Next
![](http://static.javashuo.com/static/loading.gif)
5.根據實際狀況選擇是否配置EM,點擊Next
![](http://static.javashuo.com/static/loading.gif)
6.配置Oracle相關密碼,點擊Next
![](http://static.javashuo.com/static/loading.gif)
7.選擇存儲ASM,默認選擇以前建立的磁盤組,點擊Next
![](http://static.javashuo.com/static/loading.gif)
8.根據實際狀況選擇是否啓用閃回恢復區,若是啓用,須要在asmca中配置閃回區或放入到DATADG中,這裏不配置
![](http://static.javashuo.com/static/loading.gif)
9.根據實際選擇,這裏不選擇,點擊Next
![](http://static.javashuo.com/static/loading.gif)
10.這裏着重注意下配置正確的字符集,根據實際生產要求,點擊Next
![](http://static.javashuo.com/static/loading.gif)
11.默認選擇數據庫存儲信息,點擊Next
![](http://static.javashuo.com/static/loading.gif)
12.點擊Finish,開始建立數據庫
![](http://static.javashuo.com/static/loading.gif)
13.最後完成數據庫建立
![](http://static.javashuo.com/static/loading.gif)