Oracle RAC集群环境部署
一. 安装前准备
(1) Linux系统版本
SUSE Linux Enterprise Server 11 (x86_64)
(2) Oracle database和Grid安装包
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
linux.x64_11gR2_grid.zip
(3) ASMlib安装包
oracleasm-support-2.1.8-1.SLE11.x86_64.rpm
oracleasmlib-2.0.4-1.sle11.x86_64.rpm
oracleasm-2.0.5-7.37.3.x86_64.rpm
oracleasm-kmp-default-2.0.5_3.0.76_0.11-7.37.3.x86_64.rpm
(4) 依赖软件包
gcc gcc-c++ gcc-32bit glibc-devel glibc-devel-32bit libaio libaio-devel libaio-devel-32bit libstdc++43-devel-32bit libstdc++43-devel sysstat libstdc++-devel libcap1 libcap1-32bit libcap2 libcap2-32bit compat* libgomp unixODBC unixODBC-devel |
(5) 磁盘分区
分区 |
容量 |
|||||||
/ |
/dev/sda |
100G |
||||||
Swap |
4G |
|||||||
CRS1 |
/dev/sdb1 |
2G |
||||||
CRS2 |
/dev/sdb2 |
CRS3 |
/dev/sdb3 |
DATA1 |
/dev/sdb5 |
REC1 |
/dev/sdb6 |
100G |
(6) IP地址划分
Hostname |
Node name |
IP |
Device |
Type |
hmracdb1 |
hmracdb1 |
192.168.6.154 |
eth1 |
Public |
hmracdb1-vip |
192.168.6.54 |
VIP |
||
hmracdb1-priv |
10.17.81.154 |
eth0 |
Private |
|
hmracdb2 |
@H_999_403@192.168.6.155 |
eth1 |
Public |
|
192.168.6.55 |
VIP |
|||
10.17.81.155 |
eth0 |
Private |
||
Rac-scan |
@H_999_403@192.168.6.66 |
二. 系统环境配置
(1) 主机hosts文件解析配置,两台主机使用相同配置
# public ip 192.168.6.154 hmracdb1 192.168.6.155 hmracdb2 # private ip 10.17.81.154 hmracdb1-priv 10.17.81.155 hmracdb2-priv # vip 192.168.6.54 hmracdb1-vip 192.168.6.55 hmracdb2-vip # scan ip 192.168.6.66 hmracdb-scan |
(2) 创建oracle、grig用户和组
1. 创建组和用户 /usr/sbin/groupadd -g 501 oinstall /usr/sbin/groupadd -g 502 dba /usr/sbin/groupadd -g 503 oper /usr/sbin/groupadd -g 504 asmadmin /usr/sbin/groupadd -g 505 asmdba /usr/sbin/groupadd -g 506 asmoper /usr/sbin/useradd -u 501 -g oinstall -Gdba,oper,asmdba,asmadmin oracle -m /usr/sbin/useradd -u 502 -g oinstall -Gdba,asmadmin,asmoper,oper grid -m 2. 创建密码 echo oracle | passwd --stdin oracle echo oracle | passwd --stdin grid # id oracle uid=501(oracle)gid=501(oinstall)groups=502(dba),503(oper),504(asmadmin),505(asmdba),501(oinstall) # id grid |
(3) 创建安装目录
mkdir -p /u01/app/{grid,oracle} chown -R grid:oinstall /u01/ chown -R grid:oinstall /u01/app/grid/ chown -R oracle:oinstall /u01/app/oracle/ chmod -R 775 /u01/ ls -l /u01/app/ total 8 drwxrwxr-x 2 grid oinstall 4096 Nov 16 19:09 grid drwxrwxr-x 2 oracle oinstall 4096 Nov 16 19:09 oracle |
(4) 配置grid、oracle用户环境变量
------------------------------------------------------------------------------------------------------- 1. 配置hmracdb1节点grid用户的profile,ORACLE_SID为+ASM1,hmracdb2节点改为+ASM2 export ORACLE_SID=+ASM1 export ORACLE_BASE=/u01/app/oracle exportORACLE_HOME=/u01/app/grid/product/11.2.0 export PATH=$PATH:$ORACLE_HOME/bin export TMP=/tmp export TMPDIR=$TMP export NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS" export THREADS_FLAG=native export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export CVUQDISK GRP=oinstall 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 2. 配置节点oracle用户的profile,ORACLE_SID为rac1,hmracdb2节点改为rac2 export ORACLE_SID=rac1 exportORACLE_HOME=$ORACLE_BASE/product/11.2.0 exportPATH=$ORACLE_HOME/bin:/usr/sbin:$PATH export ORACLE_TERM=xterm exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64 exportCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK umask 022 fi |
(5) 修改内核参数配置
1. 修改/etc/sysctl.conf配置 # vim /etc/sysctl.conf kernel.shmmax = 68719476736 kernel.shmall = 4294967296 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 net.ipv4.ip_local_port_range = 9000 65500 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 # sysctl �Cp 2. 修改/etc/security/limits.conf # vim /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc16384 oracle soft nofile 1024 oracle hard nofile 65536 grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hardnofile 65536 # vim /etc/pam.d/login session required pam_limits.so |
配置NTP时间同步
1. 同步时间 # sntp -P no -r 10.10.0.2 &&hwclock �Cw 2. 配置hmracdb1为上层NTP服务器 hmracdb1:~ # vim /etc/ntp.conf #添加以下配置 restrict hmracdb1 mask 255.255.255.0 nomodify notrap noquery server hmracdb1 server 127.127.1.0 3. 配置hmracdb2节点NTP服务 hmracdb2:~ # vim /etc/ntp.conf 4. 两个节点修改如下配置,并重启ntp服务 # vim /etc/sysconfig/ntp #修改以下配置 NTPD_OPTIONS="-x -g -u ntp:ntp" # service ntp restart |
(6) 配置oracle、grid用户ssh密钥
su - grid grid@hmracdb1:~> ssh-keygen -t rsa grid@hmracdb2:~> ssh-keygen -t rsa grid@hmracdb1:~> ssh-copy-id -i~/.ssh/id_rsa.pub grid@hmracdb1 grid@hmracdb1:~> ssh-copy-id -i~/.ssh/id_rsa.pub grid@hmracdb2 grid@hmracdb2:~> ssh-copy-id -i~/.ssh/id_rsa.pub grid@hmracdb1 grid@hmracdb2:~> ssh-copy-id -i~/.ssh/id_rsa.pub grid@hmracdb2 su - oracle oracle@hmracdb1:~> ssh-keygen -t rsa oracle@hmracdb2:~> ssh-keygen -t rsa oracle@hmracdb1:~> ssh-copy-id -i~/.ssh/id_rsa.pub oracle@hmracdb1 oracle@hmracdb1:~> ssh-copy-id -i~/.ssh/id_rsa.pub oracle@hmracdb2 oracle@hmracdb2:~> ssh-copy-id -i~/.ssh/id_rsa.pub oracle@hmracdb1 oracle@hmracdb2:~> ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@hmracdb2 |
三. 配置ASM磁盘
(1 )安装ASM软件(两个节点都安装)
# zypper in -y oracleasmoracleasm-kmp-default # zypper inoracleasmlib-2.0.4-1.sle11.x86_64.rpm # zypper in oracleasm-support-2.1.8-1.SLE11.x86_64.rpm |
创建ASM分区(只需在节点1上创建)
hmracdb1:~#fdisk/dev/sdb DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabel BuildinganewDOSdisklabelwithdiskidentifier0xd60a0f97. Changeswillremaininmemoryonly,untilyoudecidetowritethem. Afterthat,ofcourse,theprevIoUscontentwon'tberecoverable. Warning:invalidflag0x0000ofpartitiontable4willbecorrectedbyw(rite) Command(mforhelp):n Commandaction eextended pprimarypartition(1-4) p Partitionnumber(1-4,default1): Usingdefaultvalue1 Firstsector(2048-419430399,default2048): Usingdefaultvalue2048 Lastsector,+sectorsor+size{K,M,G}(2048-419430399,default419430399):+2G Command(mforhelp):n Commandaction eextended pprimarypartition(1-4) p Partitionnumber(1-4,default2): Usingdefaultvalue2 Firstsector(4196352-419430399,default4196352): Usingdefaultvalue4196352 Lastsector,G}(4196352-419430399,default3): Usingdefaultvalue3 Firstsector(8390656-419430399,default8390656): Usingdefaultvalue8390656 Lastsector,G}(8390656-419430399,default419430399):+2G Command(mforhelp):n Commandaction eextended pprimarypartition(1-4) e Selectedpartition4 Firstsector(12584960-419430399,default12584960): Usingdefaultvalue12584960 Lastsector,G}(12584960-419430399,default419430399): Usingdefaultvalue419430399 Command(mforhelp):n Firstsector(12587008-419430399,default12587008): Usingdefaultvalue12587008 Lastsector,G}(12587008-419430399,default419430399):+100G Command(mforhelp):n Firstsector(222304256-419430399,default222304256): Usingdefaultvalue222304256 Lastsector,G}(222304256-419430399,default419430399): Usingdefaultvalue419430399 Command(mforhelp):p Disk/dev/sdb:214.7GB,214748364800bytes 255heads,63sectors/track,26108cylinders,total419430400sectors Units=sectorsof1*512=512bytes Sectorsize(logical/physical):512bytes/512bytes I/Osize(minimum/optimal):512bytes/512bytes Diskidentifier:0xd60a0f97 DeviceBootStartEndBlocksIdSystem /dev/sdb120484196351209715283Linux /dev/sdb241963528390655209715283Linux /dev/sdb3839065612584959209715283Linux /dev/sdb4125849604194303992034227205Extended /dev/sdb51258700822230220710485760083Linux /dev/sdb622230425641943039898563071+83Linux Command(mforhelp):w Thepartitiontablehasbeenaltered! Callingioctl()tore-readpartitiontable. Syncingdisks. 在节点2上查看: hmracdb2:/usr/local/src#fdisk-l/dev/sdb Disk/dev/sdb:214.7GB,total419430400sectors Units=sectorsof1*512=512bytes Sectorsize(logical/physical):512bytes/512bytes I/Osize(minimum/optimal):512bytes/512bytes Diskidentifier:0xd60a0f97 DeviceBootStartEndBlocksIdSystem /dev/sdb120484196351209715283Linux /dev/sdb241963528390655209715283Linux /dev/sdb3839065612584959209715283Linux /dev/sdb4125849604194303992034227205Extended /dev/sdb51258700822230220710485760083Linux /dev/sdb622230425641943039898563071+83Linux
(3) 初始化ASM配置(两个节点都执行)
1.加载asm内核模块 hmracdb1:~#oracleasminit Creating/dev/oracleasmmountpoint:/dev/oracleasm Loadingmodule"oracleasm":oracleasm Configuring"oracleasm"tousedevicephysicalblocksize MountingASMlibdriverfilesystem:/dev/oracleasm 2.初始化配置 hmracdb1:~#/etc/init.d/oracleasmconfigure ConfiguringtheOracleASMlibrarydriver. Thiswillconfiguretheon-bootpropertiesoftheOracleASMlibrary driver.Thefollowingquestionswilldeterminewhetherthedriveris loadedonbootandwhatpermissionsitwillhave.Thecurrentvalues willbeshowninbrackets('[]').Hitting<ENTER>withouttypingan answerwillkeepthatcurrentvalue.Ctrl-Cwillabort. Defaultusertoownthedriverinterface[]:grid Defaultgrouptoownthedriverinterface[]:asmadmin StartOracleASMlibrarydriveronboot(y/n)[n]:y ScanforOracleASMdisksonboot(y/n)[y]:y WritingOracleASMlibrarydriverconfiguration:done InitializingtheOracleASMLibdriver:done ScanningthesystemforOracleASMLibdisks:done
创建ASM盘(只需在节点1上创建)
1.在节点1上ASM磁盘 hmracdb1:~#oracleasmlistdisks hmracdb1:~#oracleasmcreatediskCRS1/dev/sdb1 Writingdiskheader:done Instantiatingdisk:done hmracdb1:~#oracleasmcreatediskCRS2/dev/sdb2 Writingdiskheader:done Instantiatingdisk:done hmracdb1:~#oracleasmcreatediskCRS3/dev/sdb3 Writingdiskheader:done Instantiatingdisk:done hmracdb1:~#oracleasmcreatediskDATA1/dev/sdb5 Writingdiskheader:done Instantiatingdisk:done hmracdb1:~#oracleasmcreatediskREC1/dev/sdb6 Writingdiskheader:done Instantiatingdisk:done hmracdb1:~#oracleasmlistdisks CRS1 CRS2 CRS3 DATA1 REC1 2.节点2上扫描ASM共享盘 hmracdb2:~#oracleasmscandisks Reloadingdiskpartitions:done CleaninganystaleASMdisks... ScanningsystemforASMdisks... Instantiatingdisk"CRS1" Instantiatingdisk"CRS2" Instantiatingdisk"CRS3" Instantiatingdisk"DATA1" Instantiatingdisk"REC1" hmracdb2:~#oracleasmlistdisks CRS1 CRS2 CRS3 DATA1 REC1 3.检查ASM磁盘路径 hmracdb2:~#oracleasmquerydisk/dev/sdb* Device"/dev/sdb"isnotmarkedasanASMdisk Device"/dev/sdb1"ismarkedanASMdiskwiththelabel"CRS1" Device"/dev/sdb2"ismarkedanASMdiskwiththelabel"CRS2" Device"/dev/sdb3"ismarkedanASMdiskwiththelabel"CRS3" Device"/dev/sdb4"isnotmarkedasanASMdisk Device"/dev/sdb5"ismarkedanASMdiskwiththelabel"DATA1" Device"/dev/sdb6"ismarkedanASMdiskwiththelabel"REC1" hmracdb2:~#ll/dev/oracleasm/disks/ total0 brw-rw----1gridasmadmin8,17Nov2114:19CRS1 brw-rw----1gridasmadmin8,18Nov2114:19CRS2 brw-rw----1gridasmadmin8,19Nov2114:19CRS3 brw-rw----1gridasmadmin8,21Nov2114:19DATA1 brw-rw----1gridasmadmin8,22Nov2114:19REC1 hmracdb2:~#ll-ltr/dev|grep"8,*17" brw-rw----1rootdisk8,17Nov2114:19sdb1 hmracdb2:~#ll-ltr/dev|grep"8,*18" brw-rw----1rootdisk8,18Nov2114:19sdb2 hmracdb2:~#ll-ltr/dev|grep"8,*19" brw-rw----1rootdisk8,19Nov2114:19sdb3 hmracdb2:~#ll-ltr/dev|grep"8,*21" brw-rw----1rootdisk8,21Nov2114:19sdb5 hmracdb2:~#ll-ltr/dev|grep"8,*22" brw-rw----1rootdisk8,22Nov2114:19sdb6
安装oracle依赖软件包
hmracdb1:~ # for i in "gcc gcc-c++gcc-32bit glibc-devel glibc-devel-32bit libaio libaio-devel libaio-devel-32bitlibstdc++43-devel-32bit libstdc++43-devel sysstat libstdc++-devel libcap1libcap1-32bit libcap2 libcap2-32bit compat* libgomp unixODBC unixODBC-devel";dorpm -q $i;done hmracdb1:~ # zypper in gcc gcc-c++ gcc-32bit glibc-develglibc-devel-32bit libaio libaio-devel libaio-devel-32bitlibstdc++43-devel-32bit libstdc++43-devel sysstat libstdc++-devel libcap1libcap1-32bit libcap2 libcap2-32bit compat* libgomp unixODBC unixODBC-devel |
安装cvuqdisk软件
解压grid软件包,安装grid目录里的cvuqdisk-1.0.7-1.rpm软件 hmracdb1:/usr/local/src # cd grid/rpm/ hmracdb1:/usr/local/src/grid/rpm # ls cvuqdisk-1.0.7-1.rpm hmracdb1:/usr/local/src/grid/rpm # rpm -ivh cvuqdisk-1.0.7-1.rpm |
(7) 配置nslookup
1.节点1上配置 hmracdb1:~#mv/usr/bin/nslookup/usr/bin/nslookup.original hmracdb1:~#vim/usr/bin/nslookup #!/bin/bash HOSTNAME=${1} if[[$HOSTNAME="hmracdb-scan"]];then echo"Server:192.168.6.54" echo"Address:192.168.6.54#53" echo"Non-authoritativeanswer:" echo"Name:hmracdb-scan" echo"Address:192.168.6.66" else /usr/bin/nslookup.original$HOSTNAME fi hmracdb1:~#chmod755/usr/bin/nslookup 2.节点2上配置 hmracdb2:~#mv/usr/bin/nslookup/usr/bin/nslookup.original hmracdb2:~#vim/usr/bin/nslookup #!/bin/bash HOSTNAME=${1} if[[$HOSTNAME="hmracdb-scan"]];then echo"Server:192.168.6.55" echo"Address:192.168.6.55#53" echo"Non-authoritativeanswer:" echo"Name:hmracdb-scan" echo"Address:192.168.6.66" else /usr/bin/nslookup.original$HOSTNAME fi hmracdb2:~#chmod755/usr/bin/nslookup 3.测试 hmracdb1:~#nslookuphmracdb-scan Server:192.168.6.54 Address:192.168.6.54#53 Non-authoritativeanswer: Name:hmracdb-scan Address:192.168.6.66
(8) Gird安装先决条件检查
hmracdb1:/usr/local/src # chown -R grid.grid 2. 以grid用户执行安装先决条件检查 grid@hmracdb1:/usr/local/src/grid>./runcluvfy.sh stage -pre crsinst -n hmracdb1,hmracdb2 -fixup -verbose |
四. 图形化界面安装Grid Infrastructure
安装方法:
方法1:使用VNC软件登陆服务器图形界面安装
ln-s/usr/bin/env/bin/ grid@hmracdb1:/usr/local/src/grid>exportDISPLAY=10.18.221.155:0.0 grid@hmracdb1:/usr/local/src/grid>xhost+ accesscontroldisabled,clientscanconnectfromanyhost grid@hmracdb1:/usr/local/src/grid>./runInstaller StartingOracleUniversalInstaller... CheckingTempspace:mustbegreaterthan120MB.Actual83913MBPassed Checkingswapspace:mustbegreaterthan150MB.Actual4094MBPassed Checkingmonitor:mustbeconfiguredtodisplayatleast256colors.Actual16777216Passed Preparing tolaunchOracleUniversalInstallerfrom /tmp/OraInstall2016-11-22_09-16-06AM.Please wait...grid@hmracdb1:/usr/local/src/grid> grid@hmracdb1:/usr/local/src/grid>
安装步骤:
执行脚本
先执行第一个(节点1执行成功后,再到节点2执行),再执行第二个脚本 hmracdb1:~#/u01/app/grid/product/11.2.0/root.sh RunningOracle11groot.shscript... Thefollowingenvironmentvariablesaresetas: ORACLE_OWNER=grid ORACLE_HOME=/u01/app/grid/product/11.2.0 Enterthefullpathnameofthelocalbindirectory:[/usr/local/bin]: Copyingdbhometo/usr/local/bin... Copyingoraenvto/usr/local/bin... Copyingcoraenvto/usr/local/bin... Creating/etc/oratabfile... Entrieswillbeaddedtothe/etc/oratabfileasneededby DatabaseConfigurationAssistantwhenadatabaseiscreated Finishedrunninggenericpartofroot.shscript. Nowproduct-specificrootactionswillbeperformed. 2016-11-2214:18:59:Parsingthehostname 2016-11-2214:18:59:Checkingforsuperuserprivileges 2016-11-2214:18:59:Userhassuperuserprivileges Usingconfigurationparameterfile:/u01/app/grid/product/11.2.0/crs/install/crsconfig_params Creatingtracedirectory LOCALADDMODE CreatingOCRkeysforuser'root',privgrp'root'.. Operationsuccessful. rootwallet rootwalletcert rootcertexport peerwallet profilereaderwallet pawallet peerwalletkeys pawalletkeys peercertrequest pacertrequest peercert pacert peerrootcertTP profilereaderrootcertTP parootcertTP peerpacertTP papeercertTP profilereaderpacertTP profilereaderpeercertTP peerusercert pausercert Addingdaemontoinittab CRS-4123:OracleHighAvailabilityServiceshasbeenstarted. ohasdisstarting ADVM/ACFSisnotsupportedonlsb-release-2.0-1.2.18 CRS-2672:Attemptingtostart'ora.gipcd'on'hmracdb1' CRS-2672:Attemptingtostart'ora.mdnsd'on'hmracdb1' CRS-2676:Startof'ora.mdnsd'on'hmracdb1'succeeded CRS-2676:Startof'ora.gipcd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.gpnpd'on'hmracdb1' CRS-2676:Startof'ora.gpnpd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.cssdmonitor'on'hmracdb1' CRS-2676:Startof'ora.cssdmonitor'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.cssd'on'hmracdb1' CRS-2672:Attemptingtostart'ora.diskmon'on'hmracdb1' CRS-2676:Startof'ora.diskmon'on'hmracdb1'succeeded CRS-2676:Startof'ora.cssd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.ctssd'on'hmracdb1' CRS-2676:Startof'ora.ctssd'on'hmracdb1'succeeded ASMcreatedandstartedsuccessfully. DiskGroupCRScreatedsuccessfully. clscfg:-installmodespecified SuccessfullyaccumulatednecessaryOCRkeys. CreatingOCRkeysforuser'root',privgrp'root'.. Operationsuccessful. CRS-2672:Attemptingtostart'ora.crsd'on'hmracdb1' CRS-2676:Startof'ora.crsd'on'hmracdb1'succeeded CRS-4256:Updatingtheprofile Successfuladditionofvotingdisk0cabca1797104f01bfc740460efd9665. Successfuladditionofvotingdisk66791219f9f14fc4bf1bb8c8b6bdda6a. Successfuladditionofvotingdisk22e396e1b1594ff3bf6f516303e17f28. Successfullyreplacedvotingdiskgroupwith+CRS. CRS-4256:Updatingtheprofile CRS-4266:Votingfile(s)successfullyreplaced ##STATEFileUniversalIdFileNameDiskgroup ------------------------------------------ 1.ONLINE0cabca1797104f01bfc740460efd9665(ORCL:CRS1)[CRS] 2.ONLINE66791219f9f14fc4bf1bb8c8b6bdda6a(ORCL:CRS2)[CRS] 3.ONLINE22e396e1b1594ff3bf6f516303e17f28(ORCL:CRS3)[CRS] Located3votingdisk(s). CRS-2673:Attemptingtostop'ora.crsd'on'hmracdb1' CRS-2677:Stopof'ora.crsd'on'hmracdb1'succeeded CRS-2673:Attemptingtostop'ora.asm'on'hmracdb1' CRS-2677:Stopof'ora.asm'on'hmracdb1'succeeded CRS-2673:Attemptingtostop'ora.ctssd'on'hmracdb1' CRS-2677:Stopof'ora.ctssd'on'hmracdb1'succeeded CRS-2673:Attemptingtostop'ora.cssdmonitor'on'hmracdb1' CRS-2677:Stopof'ora.cssdmonitor'on'hmracdb1'succeeded CRS-2673:Attemptingtostop'ora.cssd'on'hmracdb1' CRS-2677:Stopof'ora.cssd'on'hmracdb1'succeeded CRS-2673:Attemptingtostop'ora.gpnpd'on'hmracdb1' CRS-2677:Stopof'ora.gpnpd'on'hmracdb1'succeeded CRS-2673:Attemptingtostop'ora.gipcd'on'hmracdb1' CRS-2677:Stopof'ora.gipcd'on'hmracdb1'succeeded CRS-2673:Attemptingtostop'ora.mdnsd'on'hmracdb1' CRS-2677:Stopof'ora.mdnsd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.mdnsd'on'hmracdb1' CRS-2676:Startof'ora.mdnsd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.gipcd'on'hmracdb1' CRS-2676:Startof'ora.gipcd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.gpnpd'on'hmracdb1' CRS-2676:Startof'ora.gpnpd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.cssdmonitor'on'hmracdb1' CRS-2676:Startof'ora.cssdmonitor'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.cssd'on'hmracdb1' CRS-2672:Attemptingtostart'ora.diskmon'on'hmracdb1' CRS-2676:Startof'ora.diskmon'on'hmracdb1'succeeded CRS-2676:Startof'ora.cssd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.ctssd'on'hmracdb1' CRS-2676:Startof'ora.ctssd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.asm'on'hmracdb1' CRS-2676:Startof'ora.asm'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.crsd'on'hmracdb1' CRS-2676:Startof'ora.crsd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.evmd'on'hmracdb1' CRS-2676:Startof'ora.evmd'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.asm'on'hmracdb1' CRS-2676:Startof'ora.asm'on'hmracdb1'succeeded CRS-2672:Attemptingtostart'ora.CRS.dg'on'hmracdb1' CRS-2676:Startof'ora.CRS.dg'on'hmracdb1'succeeded hmracdb12016/11/2214:25:57/u01/app/grid/product/11.2.0/cdata/hmracdb1/backup_20161122_142557.olr ConfigureOracleGridInfrastructureforaCluster...succeeded Updatinginventorypropertiesforclusterware StartingOracleUniversalInstaller... Checkingswapspace:mustbegreaterthan500MB.Actual4094MBPassed Theinventorypointerislocatedat/etc/oraInst.loc Theinventoryislocatedat/u01/app/oraInventory 'UpdateNodeList'wassuccessful.
五. 安装后的检查
检查CRS资源组状态
【节点1】 crs_stat -t -v或者crsctl statusresource -t hmracdb1:~ # su - grid grid@hmracdb1:~> crsctl statusresource -t -------------------------------------------------------------------------------- NAME TARGET STATESERVER STATE_DETAILS Local Resources ora.CRS.dg ONLINE ONLINEhmracdb1 ONLINE ONLINEhmracdb2 ora.LISTENER.lsnr ora.asm ONLINE ONLINEhmracdb1Started ONLINE ONLINEhmracdb2Started ora.eons ora.gsd OFFLINE OFFLINE hmracdb1 OFFLINE OFFLINE hmracdb2 ora.net1.network ora.ons Cluster Resources ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINEhmracdb1 ora.hmracdb1.vip 1 ONLINE ONLINEhmracdb1 ora.hmracdb2.vip 1 ONLINE ONLINEhmracdb2 ora.oc4j 1 OFFLINE OFFLINE ora.scan1.vip 【节点2】 hmracdb2:~ # su - grid grid@hmracdb2:~> crsctl statusresource -t 1 ONLINE ONLINEhmracdb1 |
检查监听状态
grid@hmracdb1:~> lsnrctl status LSNRCTL for Linux: Version 11.2.0.1.0 -Production on 22-NOV-2016 17:47:35 Copyright (c) 1991,2009,Oracle. All rights reserved. Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version11.2.0.1.0 - Production Start Date 22-NOV-2016 17:31:00 Uptime 0 days 0 hr. 16 min. 35 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File/u01/app/grid/product/11.2.0/network/admin/listener.ora Listener Log File/u01/app/oracle/diag/tnslsnr/hmracdb1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.6.154)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.6.54)(PORT=1521))) Services Summary... Service "+ASM" has 1instance(s). Instance "+ASM1",status READY,has 1 handler(s) for thisservice... The command completed successfully |
六. 创建ASM磁盘组(asmca)
创建数据区和快速恢复区ASM磁盘组
DATA --- >/dev/oracleasm/disks/DATA1
REC1 --- > /dev/oracleasm/disks/REC1
以grid用户运行asmca
以同样的方法创建REC磁盘组
七. Oracle Database 软件安装
(1) 解压database软件
hmracdb1:/usr/local/src#unziplinux.x64_11gR2_database_1of2.zip hmracdb1:/usr/local/src#unziplinux.x64_11gR2_database_2of2.zip hmracdb1:/usr/local/src#chown-Roracle.database
(2) 图形安装过程
oracle@hmracdb1:/usr/local/src/database>./runInstaller
执行脚本
hmracdb1:~#/u01/app/oracle/product/11.2.0/root.sh RunningOracle11groot.shscript... Thefollowingenvironmentvariablesaresetas: ORACLE_OWNER=oracle ORACLE_HOME=/u01/app/oracle/product/11.2.0 Enterthefullpathnameofthelocalbindirectory:[/usr/local/bin]: Thefile"dbhome"alreadyexistsin/usr/local/bin.Overwriteit?(y/n) [n]:n Thefile"oraenv"alreadyexistsin/usr/local/bin.Overwriteit?(y/n) [n]:n Thefile"coraenv"alreadyexistsin/usr/local/bin.Overwriteit?(y/n) [n]:n Entrieswillbeaddedtothe/etc/oratabfileasneededby DatabaseConfigurationAssistantwhenadatabaseiscreated Finishedrunninggenericpartofroot.shscript. Nowproduct-specificrootactionswillbeperformed. Finishedproduct-specificrootactions.
八. 创建数据库实例(dbca)
oracle@hmracdb1:~>dbca
表空间可以根据实际情况创建合适的空间
重组日志
九. 集群操作命令
(1) 集群启动与关闭
关闭步骤: hmracdb1:~ # su - oracle oracle@hmracdb1:~> srvctl stopdatabase -d rac 2、关闭oracle集群 hmracdb1:~ #/u01/app/grid/product/11.2.0/bin/crsctl stop cluster -all 启动步骤:(oracle集群默认开机自动启动) 1、 启动oracle集群 hmracdb1:~ #/u01/app/grid/product/11.2.0/bin/crsctl start cluster -all 2、 启动数据库实例 oracle@hmracdb1:~> srvctl startdatabase -d rac |
(2) 检查RAC资源组状态
1. 节点1 grid@hmracdb1:~> crs_stat -t -v 2. 节点2 grid@hmracdb2:~> crs_stat -t -v 3. gsd和oc4j默认不需要启动,设置收到启动并设置自动启动 grid@hmracdb1:~> srvctl enablenodeapps �Cg grid@hmracdb1:~> srvctl start nodeapps grid@hmracdb1:~> srvctl enable oc4j grid@hmracdb1:~> srvctl start oc4j |
(3) 检查RAC运行状态
1.检查RAC节点 grid@hmracdb1:~>olsnodes-n hmracdb11 hmracdb22 2.检查crs集群状态 grid@hmracdb1:~>crsctlcheckcluster CRS-4537:ClusterReadyServicesisonline CRS-4529:ClusterSynchronizationServicesisonline CRS-4533:EventManagerisonline grid@hmracdb1:~>crsctlcheckcrs CRS-4638:OracleHighAvailabilityServicesisonline CRS-4537:ClusterReadyServicesisonline CRS-4529:ClusterSynchronizationServicesisonline CRS-4533:EventManagerisonline 3.检查数据库实例状态 grid@hmracdb1:~>srvctlconfigdatabase-drac-a Databaseuniquename:rac Databasename:rac Oraclehome:/u01/app/oracle/product/11.2.0 Oracleuser:oracle Spfile:+DATA/rac/spfilerac.ora Domain: Startoptions:open Stopoptions:immediate Databaserole:PRIMARY Managementpolicy:AUTOMATIC Serverpools:rac Databaseinstances:rac1,rac2 DiskGroups:DATA,REC Services: Databaseisenabled Databaseisadministratormanaged grid@hmracdb1:~>srvctlstatusdatabase-drac Instancerac1isrunningonnodehmracdb1 Instancerac2isrunningonnodehmracdb2 4.检查ASM磁盘 grid@hmracdb1:~>srvctlconfigasm ASMhome:/u01/app/grid/product/11.2.0 ASMlistener:LISTENER grid@hmracdb1:~>srvctlstatusasm ASMisrunningonhmracdb1,hmracdb2 5.检查监听状态 grid@hmracdb1:~>srvctlstatusasm ASMisrunningonhmracdb1,hmracdb2 grid@hmracdb1:~>srvctlstatuslistener ListenerLISTENERisenabled ListenerLISTENERisrunningonnode(s):hmracdb1,hmracdb2 grid@hmracdb1:~>srvctlconfiglistener Name:LISTENER Network:1,Owner:grid Home:<CRShome> Endpoints:TCP:1521 6.检查VIP状态 grid@hmracdb1:~>srvctlstatusvip-nhmracdb1 VIPhmracdb1-vipisenabled VIPhmracdb1-vipisrunningonnode:hmracdb1 grid@hmracdb1:~>srvctlstatusvip-nhmracdb2 VIPhmracdb2-vipisenabled VIPhmracdb2-vipisrunningonnode:hmracdb2 grid@hmracdb1:~>srvctlconfigvip-nhmracdb1 VIPexists.:hmracdb1 VIPexists.:/hmracdb1-vip/192.168.6.54/255.255.255.0/eth0 grid@hmracdb1:~>srvctlconfigvip-nhmracdb2 VIPexists.:hmracdb2 VIPexists.:/hmracdb2-vip/192.168.6.55/255.255.255.0/eth0 7.检查SCAN grid@hmracdb1:~>srvctlstatusscan SCANVIPscan1isenabled SCANVIPscan1isrunningonnodehmracdb1 grid@hmracdb1:~>srvctlconfigscan SCANname:hmracdb-scan,Network:1/192.168.6.0/255.255.255.0/eth0 SCANVIPname:scan1,IP:/hmracdb-scan/192.168.6.66 8.检查表决磁盘 grid@hmracdb1:~>crsctlquerycssvotedisk ##STATEFileUniversalIdFileNameDiskgroup ------------------------------------------ 1.ONLINE0cabca1797104f01bfc740460efd9665(ORCL:CRS1)[CRS] 2.ONLINE66791219f9f14fc4bf1bb8c8b6bdda6a(ORCL:CRS2)[CRS] 3.ONLINE22e396e1b1594ff3bf6f516303e17f28(ORCL:CRS3)[CRS] Located3votingdisk(s). 9.检查集群注册表 grid@hmracdb1:~>ocrcheck StatusofOracleClusterRegistryisasfollows: Version:3 Totalspace(kbytes):262120 Usedspace(kbytes):2568 Availablespace(kbytes):259552 ID:858387628 Device/FileName:+CRS Device/Fileintegritychecksucceeded Device/Filenotconfigured Device/Filenotconfigured Device/Filenotconfigured Device/Filenotconfigured Clusterregistryintegritychecksucceeded Logicalcorruptioncheckbypassedduetonon-privilegeduser 10.检查ASM磁盘组 grid@hmracdb1:~>asmcmdlsdg StateTypeRebalSectorBlockAUTotal_MBFree_MBReq_mir_free_MBUsable_file_MBOffline_disksVoting_filesName MOUNTEDNORMALN512409610485766144521830924540NCRS/ MOUNTEDEXTERNN51240961048576102400832970832970NDATA/ MOUNTEDEXTERNN5124096104857696253944710944710NREC/
(4) OracleDatabase实例检查(oracle查询语句)
sql>selectinstance_name,statusfromgv$instance; INSTANCE_NAMESTATUS -------------------------------------------------------- rac1OPEN rac2OPEN 1.asm磁盘检查 sql>setlinesize100; sql>selectpathfromv$asm_disk; PATH ---------------------------------------------------------------------------------------------------- ORCL:CRS1 ORCL:CRS2 ORCL:CRS3 ORCL:DATA1 ORCL:REC1 sql>showparameterspfile; NAMETYPEVALUE ---------------------------------------------------------------------------------------- spfilestring+DATA/rac/spfilerac.ora sql>selectpathfromv$asm_disk; PATH ---------------------------------------------------------------------------------------------------- ORCL:CRS1 ORCL:CRS2 ORCL:CRS3 ORCL:DATA1 ORCL:REC1 2.asm磁盘组空间 sql>setlinesize500; sql>selectgroup_number,name,state,type,total_mb,free_mbfromv$asm_diskgroup; sql>selectdisk_number,path,free_mbfromv$asm_diskwheregroup_number=1; 3.查询表空间名 sql>selecttablespace_namefromdba_tablespaces; TABLESPACE_NAME ------------------------------------------------------------ SYSTEM SYSAUX UNDOTBS1 TEMP UNDOTBS2 USERS 6rowsselected. 4.查询指定用户默认表空间 sql>selectdefault_tablespace,temporary_tablespacefromdba_userswhereusername='SYSTEM'; DEFAULT_TABLESPACETEMPORARY_TABLESPACE ------------------------------------------------------------------------------------------------------------------------ SYSTEMTEMP 5.查询表空间使用率 selectff.stablespace_name,ff.btotal,(ff.b-fr.b)usage,fr.bfree,round((ff.b-fr.b)/ff.b*100)||'%'usagep from(selecttablespace_names,sum(bytes)/1024/1024b fromdba_data_files groupbytablespace_name)ff,(selecttablespace_names,sum(bytes)/1024/1024b fromdba_free_space groupbytablespace_name)fr whereff.s=fr.s; 6.查询表空间数据文件 selectnamefromv$datafile; sql>selectnamefromv$datafile; NAME ---------------------------------------------------------------------------------------------------- +DATA/rac/datafile/system.261.928753797 +DATA/rac/datafile/sysaux.262.928753819 +DATA/rac/datafile/undotbs1.263.928753839 +DATA/rac/datafile/undotbs2.265.928753875 +DATA/rac/datafile/users.266.928753895 7.查询日志文件 selectmemberfromv$logfile; sql>selectmemberfromv$logfile; MEMBER ---------------------------------------------------------------------------------------------------- +DATA/rac/onlinelog/group_1.257.928753771 +REC/rac/onlinelog/group_1.257.928753775 +DATA/rac/onlinelog/group_2.258.928753777 +REC/rac/onlinelog/group_2.258.928753781 +DATA/rac/onlinelog/group_5.259.928753783 +REC/rac/onlinelog/group_5.259.928753787 +DATA/rac/onlinelog/group_6.260.928753791 +REC/rac/onlinelog/group_6.260.928753793 +DATA/rac/onlinelog/group_3.267.928756451 +REC/rac/onlinelog/group_3.261.928756455 +DATA/rac/onlinelog/group_4.268.928756459 +REC/rac/onlinelog/group_4.262.928756461 12rowsselected. 8.查询归档日志 sql>showparameterdb_recovery_file_dest_size; NAMETYPEVALUE ---------------------------------------------------------------------------------------- db_recovery_file_dest_sizebiginteger30G原文链接:https://www.f2er.com/oracle/211629.html