1、环境:9jc*jMvx22494861Oracle Linux CentOS 6.4两台8a1v7e,aG(N8A22494861Oracle 11g R21、IP规划127.0.0.1 localhost.localdomain localhost#public ip4Z*QL3sQ*uB2d1y22494861192.168.10.211 rac1ITPUB个人空间7Bw6P192.168.10.212rac2#priv ipL$ x1Yg-x7y2249486110.10.10.211 rac1prvITPUB个人空间8dnLbX)KcV10.10.10.212rac2prv#vip i
2、p+VmB2 E8u22494861192.168.10.213 rac1vipITPUB个人空间64Y$Ob1K&24w;x192.168.10.214rac2vip#scan ipITPUB个人空间b&YC)Fu!V!V U192.168.10.215 racscan2、磁盘规划ITPUB个人空间,Y1u1J,c9&L6q#Y3Z Ot4rp3yc*22494861+CRS 三个2G的盘#G-buR %it22494861+DGDATA 三个10G的盘ITPUB个人空间X Q*?pd+DGRECOVERY 两个5G的盘/usr/sbin/groupadd -g 501 oinstallIT
3、PUB个人空间7D+u:;/usr/sbin/groupadd -g 502 dbaITPUB个人空间2s-iY_/usr/sbin/groupadd -g 503 operITPUB个人空间*D%z_f/usr/sbin/groupadd -g 504 asmadminITPUB个人空间*AkF3v5U/usr/sbin/groupadd -g 505 asmoperITPUB个人空间%jQ1VmxsUy-Q/usr/sbin/groupadd -g 506 asmdba, !iw%os22494861/usr/sbin/useradd -g oinstall -G dba,asmdba,o
4、per oracle4D XOp6V!:G22494861/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba gridrootora1 # id oracle?o!3CMu22494861uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),506(asmdba)ITPUB个人空间Vh_;sbto rootora1 # id gridXri.Jom0e22494861uid=502(grid) gid=501(oinsta
5、ll) groups=501(oinstall),502(dba),503(oper),504(asmadmin),505(asmoper),506(asmdba)mkdir /oracle/app/ITPUB个人空间-cPT/Y/Qchown -R grid:oinstall /oracle/app/ITPUB个人空间jCtq+vchmod -R 775 /oracle/app/mkdir -p /oracle/app/oraInventoryITPUB个人空间6n1miE,vxW*Dchown -R grid:oinstall /oracle/app/oraInventoryITPUB个人
6、空间F4v fO%QxB4Atchmod -R 775 /oracle/app/oraInventorymkdir -p /oracle/app/gridITPUB个人空间$t |%D0Qmkdir -p /oracle/app/oracleITPUB个人空间9J*A*t9y|!chown -R grid:oinstall /oracle/app/gridITPUB个人空间 d/T#jsAy5MKl2Fchown -R oracle:oinstall /oracle/app/oracle?DI:_+BG22494861chmod -R 775 /oracle/app/oracleITPUB个人
7、空间%g y,I.tl9n4Kchmod -R 775 /oracle/app/gridITPUB个人空间_|2l&bHO-&z:Npasswd gridpasswd oracle2、操作系统版本:rootrac1 # lsb_release -aITPUB个人空间rK EY &PELSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarchDistr
8、ibutor ID: CentOSDescription: CentOS release 6.4 (Final)Release: 6.4Codename: Final1K8z wu6Rc R M22494861rootrac1 # uname -a*Yur0h3h-B22494861 Linux MPR.coco 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux ITPUB个人空间 |h&d)EDf-FtBrootrac1 #修改系统参数:P?TlI0v22
9、494861vi /etc/security/limits.conf#ORACLE SETTINGITPUB个人空间BuoJC,Jgrid soft nproc 2047ITPUB个人空间OZ%Nm(WX%ps)Cgrid hard nproc 16384ITPUB个人空间2Jc :ol9BM&zgrid soft nofile 1024,e Snt%g?3E wt22494861grid hard nofile 65536ITPUB个人空间XTQ:J1b,tw.oracle soft nproc 2047ITPUB个人空间9pg%c?3f!Voracle hard nproc 16384IT
10、PUB个人空间vN7I.o*u6c9uboracle soft nofile 1024%q+R-Q7By?Cdm22494861oracle hard nofile 65536Fy5mWkX0r;CER22494861vi /etc/pam.d/login#ORACLE SETTINGITPUB个人空间S$|7F4o7Psession required pam_limits.so# vi /etc/sysctl.confr$dh-A#Dl22494861#ORACLE SETTINGqfiXq22494861fs.aio-max-nr = 1048576ITPUB个人空间7y_P;dM,Z,a
11、Sfs.file-max = 6815744ITPUB个人空间|PZw4GCkernel.shmall = 2097152ITPUB个人空间*a(U.Tx4t-_ umkernel.shmmax = 536870912ITPUB个人空间 u*Fxy?.I)e8ikernel.shmmni = 4096k4wQ!jORp22494861kernel.sem = 250 32000 100 1283O(v6Vyz&?uK22494861net.ipv4.ip_local_port_range = 9000 65500k(sMGRRA6g22494861net.core.rmem_default =
12、 262144ITPUB个人空间I9n,gv,Vr(,%hnet.core.rmem_max = 4194304YL7rs1J_22494861net.core.wmem_default = 262144_9rZYW0C22494861net.core.wmem_max = 1048586|6G.l-gZ B)22494861gird时间同步所需要的设置(11gR2新增检查项)ITPUB个人空间9Q$V-G2RyY#Network Time Protocol SettingITPUB个人空间5xc2lT/sbin/service ntpd stop:E;nKQ YI22494861chkcon
13、fig ntpd off(d3v+Pej8C1UQ Y22494861rm /etc/ntp.conf$A%D2z(R+xSP122494861mv /etc/ntp.conf to /etc/ntp.conf.org/dev/shm 共享内存不足的处理dJ?p3EM%9v?22494861解决方法:%J6Z)gE:mphYEe22494861例如:为了将/dev/shm的大小增加到1GB,修改/etc/fstab的这行:默认的:ITPUB个人空间 84D|;ZBnone /dev/shm tmpfs defaults 0 04xUESw(Tz*22494861改成:Aa*P#rm?g4q A
14、&H M22494861none /dev/shm tmpfs defaults,size=1024m 0 0ITPUB个人空间8d I)dN8nBsize参数也可以用G作单位:size1G。ITPUB个人空间0x.b,zE4ZYK重新mount /dev/shm使之生效:-6W&NoZB8cd;a22494861# mount -o remount /dev/shm,W5bzJl22494861或者:JYw#WN22494861# umount /dev/shmfP.|9R Cb22494861# mount -aITPUB个人空间xQlLcO(Pz马上可以用df -h命令检查变化。ITPU
15、B个人空间3i0bD_ d修改gird、oracle用户的.bash_profile文件:#grid 用户配置文件 ORACLE_HOSTNAME请自行设置-C5HL2Y0P*x22494861TMP=/tmp; export TMPt5JT4Dy0FZ22494861TMPDIR=$TMP; export TMPDIRORACLE_SID=+ASM1; export ORACLE_SIDPUt)V.b22494861ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASEM(n#dWk22494861ORACLE_HOME=/oracle/app/
16、grid/product/11.2.0; export ORACLE_HOME,c.GO%(Z22494861NLS_DATE_FORMAT=yyyy-mm-dd HH24:MI:SS; export NLS_DATE_FORMAT)$B.U.V RDaF7Kg&m:C22494861THREADS_FLAG=native; export THREADS_FLAGPATH=$ORACLE_HOME/bin:$PATH; export PATHw7p j4|2p0L(T-f!o!l22494861THREADS_FLAG=native; export THREADS_FLAGPATH=$ORAC
17、LE_HOME/bin:$PATH; export PATHif $USER = oracle | $USER = grid ; thenITPUB个人空间|G9xx4t,H)H0F,bUK if $SHELL = /bin/ksh ; thenO&B2Us:M22494861 ulimit -p 16384ITPUB个人空间5lY)d$Tt#N3r*T ulimit -n 65536PX6N o%J+e2:#A%w22494861 else7a*f(E4MI$Krc22494861 ulimit -u 16384 -n 65536ITPUB个人空间&C;QGqJSp$n$e fiITPUB个
18、人空间8?1X$AME2o umask 022ITPUB个人空间*7ptb4P5h A)rBzfiITPUB个人空间z-w*e6dhE#oracle用户配置文件 ORACLE_HOSTNAME请自行设置 %V j R22494861# Oracle Settings oracleH+paHg$ure22494861TMP=/tmp; export TMP8Y7_8VF!v9N1H22494861TMPDIR=$TMP; export TMPDIRORACLE_BASE=/oracle/app/oracle; export ORACLE_BASEITPUB个人空间6L)3E!z$N2F| wr
19、wORACLE_HOME=$ORACLE_BASE/product/11.2.0; export ORACLE_HOMEITPUB个人空间lxh2tk7U)BTORACLE_SID=racdb1; export ORACLE_SID+S+yk KT+c H22494861ORACLE_TERM=xterm; export ORACLE_TERMPATH=/usr/sbin:$PATH; export PATH;5|4;i)f_C22494861PATH=$ORACLE_HOME/bin:$PATH; export PATHLD_LIBRARY_PATH=$ORACLE_HOME/lib:/li
20、b:/usr/lib; export LD_LIBRARY_PATHITPUB个人空间?Jz-B3(qzCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATHo)V1|8KO&x+s 22494861NLS_DATE_FORMAT=yyyy-mm-dd HH24:MI:SS; export NLS_DATE_FORMATITPUB个人空间gUW1ANLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANGif $USER = oracl
21、e | $USER = grid ; thenITPUB个人空间x F1p6T b;Z;cH if $SHELL = /bin/ksh ; thenV Q8*Z.bX3|L22494861 ulimit -p 16384W.B.inW V vnp22494861 ulimit -n 65536ITPUB个人空间90(Av;Rc_f5! elseITPUB个人空间ZX.Z:h*pXv ulimit -u 16384 -n 65536ITPUB个人空间|8g;wX9a fi!oDLDE8Q22494861 umask 022XP-%h fiC)v22494861fitW;o4I(d22494861
22、配置信任关系ITPUB个人空间g+J-t*N2f设置SSH,rt;F$u6Me224948611).在主节点RAC1上以grid,oracle用户身份生成用户的公匙和私匙ITPUB个人空间? m!p;O0B2NS# ping rac2-eth0+c!Om GITK,lU22494861# ping rac2-eth1ITPUB个人空间os&dDI|/dV# su - oracleITPUB个人空间1il.q R q7f M$ mkdir /.sshITPUB个人空间d8Ap/BU$ ssh-keygen -t rsaITPUB个人空间 M;1Kw$ ssh-keygen -t dsa2).在副
23、节点RAC2、RAC3上执行相同的操作,确保通信无阻ITPUB个人空间(T!G%f sNP&TN(dUb_# ping rac1-eth01CSzez22494861# ping rac1-eth1L1enZ4IvI9e22494861# su - oracleITPUB个人空间;| Yf9UY$ mkdir /.sshITPUB个人空间n5dC M/7Bmj$ ssh-keygen -t rsa|2 hCd22494861$ ssh-keygen -t dsa3).在主节点RAC1上oracle用户执行以下操作5I&S.jXz#D |;H22494861$ cat /.ssh/id_rsa.
24、pub ./.ssh/authorized_keysKmy_kTE(RbU22494861$ cat /.ssh/id_dsa.pub ./.ssh/authorized_keysITPUB个人空间*E%U +P+bLUSZ f$ ssh rac2 cat /.ssh/id_rsa.pub /.ssh/authorized_keysDhI(l,L6K22494861$ ssh rac2 cat /.ssh/id_dsa.pub /.ssh/authorized_keysITPUB个人空间Xa*C)avj;b$ scp /.ssh/authorized_keys rac2:/.ssh/autho
25、rized_keys4).主节点RAC1上执行检验操作ITPUB个人空间Wo!Q%J4Q$ ssh rac1 dateITPUB个人空间R | rv v+L6M$ ssh rac2 date(v4o#Li?;P22494861$ ssh rac3 dateITPUB个人空间!G+aY4fa!SH$ ssh rac1priv date?8y kj-O2Fx22494861$ ssh rac2priv dateITPUB个人空间:xm5kzE9g$ ssh rac3priv dateITPUB个人空间6C3c e ,ay,e5).在副节点RAC2上执行检验操作ITPUB个人空间Q3H%T 7xm(
26、z$ ssh rac1 date/Ct-vL2I ip%ZT22494861$ ssh rac2 date,A t4w*X7s22494861$ ssh rac3 dateITPUB个人空间+ga_|!j-vN:ikO,$ ssh rac1priv dateITPUB个人空间Y)a;E/q)O2h$ ssh rac2priv dateITPUB个人空间ad/|,o8g*?)tP$ ssh rac3priv dateITPUB个人空间B1q AKM;x+l/_安装ASMoracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm0ZnSg(n;rwI|O224948
27、61oracleasmlib-2.0.4-1.el5.i386.rpmITPUB个人空间;W/IQ)N0id;Joracleasm-support-2.1.3-1.el5.i386.rpm格式化硬盘p(w.ed22494861Disk /dev/sdd: 2147 MB, 2147483648 bytesITPUB个人空间0XW8x$G&o255 heads, 63 sectors/track, 261 cylindersITPUB个人空间(mF$ZV$RRP3WUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start
28、 End Blocks Id System%ZlmQn5XT-JE22494861/dev/sdd1 1 261 2096451 83 LinuxDisk /dev/sde: 2147 MB, 2147483648 bytesITPUB个人空间p6uX+H255 heads, 63 sectors/track, 261 cylindersITPUB个人空间0U! c xN:zWUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id SystemjfTc9L8RQ9d22494861/dev
29、/sde1 1 261 2096451 83 LinuxDisk /dev/sdf: 2147 MB, 2147483648 bytes6F I,fWC(eD22494861255 heads, 63 sectors/track, 261 cylindersITPUB个人空间n;C6WnH!wUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id SystemLS5c )ua22494861/dev/sdf1 1 261 2096451 83 LinuxDisk /dev/sdg: 10.
30、7 GB, 10737418240 bytes9rVgA9q0a/22494861255 heads, 63 sectors/track, 1305 cylinders4)j9MO.aGL,gA22494861Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id SystemITPUB个人空间.mk Wf-|pb/dev/sdg1 1 1305 10482381 83 LinuxDisk /dev/sdh: 10.7 GB, 10737418240 bytesk0VOzZ*Y?#V9O2
31、2494861255 heads, 63 sectors/track, 1305 cylindersITPUB个人空间N5sTRFlUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id SystemITPUB个人空间P?M&r)w2a7d/dev/sdh1 1 1305 10482381 83 LinuxDisk /dev/sdi: 10.7 GB, 10737418240 bytesITPUB个人空间r$E n.R;pR255 heads, 63 sectors/track, 1305
32、 cylinders*W3gk*22494861Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System4_8&zV2f cD22494861/dev/sdi1 1 1305 10482381 83 LinuxDisk /dev/sdj: 5368 MB, 5368709120 bytesITPUB个人空间N&nQM255 heads, 63 sectors/track, 652 cylindersITPUB个人空间8o Abv,!?%UnUnits = cylinders o
33、f 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System7xn*c$ZMvQ6x22494861/dev/sdj1 1 652 5237158+ 83 LinuxDisk /dev/sdk: 5368 MB, 5368709120 bytes(YH#N.D8t22494861255 heads, 63 sectors/track, 652 cylinders25b#X&u&i22494861Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot St
34、art End Blocks Id System&G0p5Ozk+pu!d3cP(e22494861/dev/sdk1 1 652 5237158+ 83 Linux配置ASMITPUB个人空间A$j:Fl1pIITPUB个人空间(qH+aSrootora1 # /etc/init.d/oracleasm configure!Li%C:HYV-c22494861Configuring the Oracle ASM library driver.This will configure the on-boot properties of the Oracle ASM libraryh2QZ$R Q
35、,VR$a22494861driver. The following questions will determine whether the driver is.a%FHrD&Z22494861loaded on boot and what permissions it will have. The current valuesITPUB个人空间2Q|)Z0nwill be shown in brackets (). Hitting without typing anITPUB个人空间w9A+ujanswer will keep that current value. Ctrl-C will
36、 abort.Default user to own the driver interface : gridITPUB个人空间+hz+U2CCE;YDefault group to own the driver interface : asmadminITPUB个人空间#j,c0kYpUStart Oracle ASM library driver on boot (y/n) n: yITPUB个人空间T3jtA2m$L-baScan for Oracle ASM disks on boot (y/n) y: y2D Q2PJUW22494861Writing Oracle ASM libra
37、ry driver configuration: doneITPUB个人空间 X5mQ2bJ5FInitializing the Oracle ASMLib driver: OK M0UbQP8th22494861Scanning the system for Oracle ASMLib disks: OK ITPUB个人空间.rk8&|Duf8yC)f3T7S%n22494861创建asm盘ITPUB个人空间I1shA5_1t,mh0_ITPUB个人空间3? h&eOkd+CRS 三个2G的盘ITPUB个人空间&gHn R A0Es#L+F+DGDATA 三个10G的盘Vk,_w,M2249
38、4861+DGRECOVERY 两个5G的盘/dev/sdd: 2097152YL n5MI6|Y%gw*jn.Y22494861/dev/sde: 2097152ITPUB个人空间vzh/dev/sdf: 2097152cVh-f-ceSf-s22494861/dev/sdg: 10485760ITPUB个人空间?FZOq/dev/sdh: 10485760sNqI#I!x22494861/dev/sdi: 10485760:T I.M5c)A-e&N$t0E;yd t22494861/dev/sdj: 5242880pfSST0ci$D6N22494861/dev/sdk: 5242880
39、rootora2 asm# /etc/init.d/oracleasm createdisk CRS1 /dev/sdd1ITPUB个人空间(wj,B$e$csMarking disk CRS1 as an ASM disk: OK ITPUB个人空间8 ji0dF1U#Ls?rootora2 asm# /etc/init.d/oracleasm createdisk CRS2 /dev/sde1ITPUB个人空间,QSWr!hg1K*eMarking disk CRS2 as an ASM disk: OK %w;FA;Ug22494861rootora2 asm# /etc/init.d/
40、oracleasm createdisk CRS3 /dev/sdf1.U7gx4YB7ZMax22494861Marking disk CRS3 as an ASM disk: OK ITPUB个人空间AqK3j$i.u9c_Lrootora2 asm# /etc/init.d/oracleasm createdisk DATA1 /dev/sdg1&y:6NwR22494861Marking disk DATA1 as an ASM disk: FAILEDeCzs!lcXb22494861rootora2 asm# /etc/init.d/oracleasm createdisk DAT
41、A1 /dev/sdg1ITPUB个人空间4j9EN1S/PSMarking disk DATA1 as an ASM disk: OK |Sl8jih5#l5?d22494861rootora2 asm# /etc/init.d/oracleasm createdisk DATA2 /dev/sdh1ITPUB个人空间t(J.N5UMarking disk DATA2 as an ASM disk: OK :EWPz9(U9Y22494861rootora2 asm# /etc/init.d/oracleasm createdisk DATA3 /dev/sdi1HB;sVk1R8TM22494861Marking disk DATA3 as an ASM disk: