Redhat5.7oracle11gR2forLinux安装平台软件名称版本备注LinuxRedhat5.7(x86_64)oracle11gr2注:#开头的命令对应root用户执行,$开始的命令对应grid和oracle用户创建用户&用户组创建四个组oinstall,dba,asmadmin,asmdba:#groupadd-g1000oinstall#groupadd-g1100dba#groupadd-g1200asmadmin#groupadd-g1300asmdba再创建两个用户grid和oracle:#useradd-u1001-goinstall-Gasmdba,asmadmin,dbagrid#passwdgrid#useradd-u1002-goinstall-Gdba,asmdba,asmadminoracle#passwdoracle创建目录和授权:#mkdir-p/usr/app/grid#grid基目录#mkdir-p/usr/app/grid/grid_home#grid安装目录#chown-Rgrid:oinstall/usr/app/grid#mkdir-p/usr/app/oracle#oracle基目录#mkdir-p/usr/app/oracle/oracle_home#oracle安装目录#chown-Roracle:oinstall/usr/app/oracle安装所需包rpm-ivhpdksh-5.2.14-30.6.x86_64.rpm---------------------------------------yum-yinstalllibXpyum-yinstallbinutilsyum-yinstallcompat-libstdc++yum-yinstallelfutils-libelfyum-yinstallelfutils-libelf-develyum-yinstallglibcyum-yinstallglibc-commonyum-yinstallglibc-develyum-yinstallgccyum-yinstallgcc-c++yum-yinstalllibaio-develyum-yinstalllibaioyum-yinstalllibgccyum-yinstalllibstdc++yum-yinstalllibstdc++-develyum-yinstallmakeyum-yinstallsysstatyum-yinstallunixODBCyum-yinstallunixODBC-develyum-yinstallcompat-libstdc++-33编辑环境变量设置系统参数编辑grid和oracle用户的.bash_profile,设置环境变量:1.grid用户的.bash_profile#vi/home/grid/.bash_profileexportORACLE_BASE=/usr/app/gridexportORACLE_HOME=/usr/app/grid/grid_homeexportORACLE_SID=+ASM--ASM实例名exportPATH=$ORACLE_HOME/bin:$PATHexportCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib2.oracle用户的.bash_profile#vi/home/oracle/.bash_profileexportORACLE_BASE=/usr/app/oracleexportORACLE_HOME=$ORACLE_BASE/oracle_homeexportORACLE_SID=JUUGOOexportORACLE_HOSTNAME=rhel54注:rhel54是我的计算机名exportPATH=$ORACLE_HOME/bin:$PATHexportCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib系统参数1.编辑vi/etc/security/limits.conf,添加如下行:gridsoftnproc16384gridhardnproc16384gridsoftnofile65536gridhardnofile65536oraclesoftnproc16384oraclehardnproc16384oraclesoftnofile65536oraclehardnofile65536编辑/etc/sysctl.confvi/etc/sysctl.conf#kernel.shmall=2097152#所有内存大小页,表示系统一次可以使用的共享内存总量(以页为单位)。2097152*4k/页/1024/1024=8G,所以sga无法跨越8G,除非修改这个值变大,如果内存为16g,则:16GB/4KB=16777216KB/4KB=4194304,即kernel.shmall=4194304才符合要求#kernel.shmmax=2147483648#最大共享内存,该参数定义了共享内存段的最大尺寸(以字节为单位),建议是内存的1/2,例如物理内存是1G,则为512*1024*1024=536870912;最好直接设置为内存一样大,例如物理内存是1G:1024*1024*1024=1073741824kernel.shmmni=4096#最小共享内存,设置系统范围内共享内存段的最大数量,该参数的默认值是4096,通常不需要更改。kernel.sem=25032000100128#SEMMSL(每个用户拥有信号量最大数),SEMMNS(系统信号量最大数),SEMOPM(每次semopm系统调用操作数),SEMMNI(系统辛苦量集数最大数)net.ipv4.ip_local_port_range=900065500#分别定义了用作TCP和UDP本地端口的端口范围。第一个参数是第一个端口号,第二个参数是最后一个本地端口号。对于使用率很高的系统,可以修改为:32768到61000。net.core.rmem_default=4194304#默认的接收窗口大小net.core.rmem_max=8388608#设置最大系统接收缓存8MBnet.core.wmem_default=262144#默认的发送窗口大小net.core.wmem_max=8388608#设置最大系统发送缓存8MBfs.file-max=6815744#在linux系统中可以打开的文件数量,每4M内存对应256,例如:内存为128M的机器,该值可以设为8192(128/4=3232*256=8192)。文件服务器或WEB服务器需要打开的文件数目就大fs.aio-max-nr=1048576#是fs.file-max打开文件数目的3到4倍,例如:内存为128M的机器,该值可以设为32768(8192*4=32768)。net.ipv4.tcp_syncookies=1#加强抗SYNFlood能力执行#sysctl–p命令,使设置生效。安装ASM&GRID1.安装asmlib包:去下载asmlib相关的三个包,并上传到服务器上:oracleasm-2.6.18-164.el5PAE-2.0.5-1.el5.i686.rpmoracleasmlib-2.0.4-1.el5.i386.rpmoracleasm-support-2.1.3-1.el5.i386.rpm注:第一个包一定要和操作系统内核的版本相对应用#uname–r查看内核版本:[root@rhel54test]#uname-r2.6.18-164.el5PAE2.安装asmlib包#rpm-Uvhoracleasm*.rpm注意:更新了系统内核,需要重新启动计算机,重新启动后运行:/etc/init.d/oracleasmconfigure安装完asmlib包之后,执行如下命令:#/usr/sbin/oracleasmconfigure-i输入用户grid,输入用户组asmadmin执行#/usr/sbin/oracleasminit命令3.创建asm磁盘,我创建了两个asm磁盘。#fdisk/dev/sdbDevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabelBuildinganewDOSdisklabel.Changeswillremaininmemoryonly,untilyoudecidetowritethem.Afterthat,ofcourse,thepreviouscontentwon'tberecoverable.Thenumberofcylindersforthisdiskissetto1305.Thereisnothingwrongwiththat,butthisislargerthan1024,andcouldincertainsetupscauseproblemswith:1)softwarethatrunsatboottime(e.g.,oldversionsofLILO)2)bootingandpartitioningsoftwarefromotherOSs(e.g.,DOSFDISK,OS/2FDISK)Warning:invalidflag0x0000ofpartitiontable4willbecorrectedbyw(rite)Command(mforhelp):nCommandactioneextendedpprimarypartition(1-4)pPartitionnumber(1-4):1(注意可能不是从1开始)Firstcylinder(1-1305,default1):Usingdefaultvalue1Lastcylinderor+sizeor+sizeMor+sizeK(1-1305,default1305):Usingdefaultvalue1305Command(mforhelp):wThepartitiontablehasbeenaltered!Callingioctl()tore-readpartitiontable.Syncingdisks.操作系统的分区情况如下:[root@rhel54grid]#fdisk-lDisk/dev/sda:440.0GB,440073715712bytes255heads,63sectors/track,53502cylindersUnits=cylindersof16065*512=8225280bytesDeviceBootStartEndBlocksIdSystem/dev/sda1*176496144056183Linux/dev/sda276508171419296582Linuxswap/Solaris/dev/sda3817253502364121257+5Extended/dev/sda58172106622000892683Linux/dev/sda610663131532000892683Linux/dev/sda713154156442000892683Linux#chowngrid:asmadmin/dev/sda3#chowngrid:asmadmin/dev/sda4#/usr/sbin/oracleasmcreatediskXVOL1/dev/sda3#/usr/sbin/oracleasmcreatediskXVOL2/dev/sda4[root@rhel54grid]#/usr/sbin/oracleasmscandisksRel