Führen Sie die Oracle 11gR2 RAC-Bereitstellung durch 3
Teil 2 DNS-Vorwärts- und Rückwärtsauflösung wurde konfiguriert,Dann müssen wir die Oracle-Cluster-Software einrichten,Oracle-Datenbank Benutzer erstellen,Benutzergruppe,Katalog,Umgebungsvariable,Ändern Sie den Kernel,Ressourcenbeschränkungen usw.。Dann eine freigegebene Festplatte erstellen und formatieren,Linux erkennen lassen。
Benutzer erstellen,Passwort ändern,修改用户配置文件
为node1和node2创建grid和oracle用户环境变量 ,SID , wie folgt:
Knoten1:
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 asmdba
groupadd -g 1202 asmoper
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c “grid Infrastructure Owner” Gitter
Gitter | passwd –stdin grid
Echo “exportiere TMP = / tmp” >> /home/grid/.bash_profile
echo ‘export TMPDIR=$TMP’ >> /home/grid/.bash_profile
Echo “export ORACLE_SID = + ASM1” >> /home/grid/.bash_profile
Echo “export ORACLE_BASE = / u01 / app / grid” >> /home/grid/.bash_profile
Echo “export ORACLE_HOME=/u01/app/11.2.0/grid” >> /home/grid/.bash_profile
Echo “export ORACLE_TERM = xterm” >> /home/grid/.bash_profile
Echo “export NLS_DATE_FORMAT=’yyyy/mm/dd hh24:mich:ss'” >> /home/grid/.bash_profile
echo ‘export TNS_ADMIN=$ORACLE_HOME/network/admin’ >> /home/grid/.bash_profile
echo ‘export PATH=/usr/sbin:$PFAD’ >> /home/grid/.bash_profile
echo ‘export PATH=$ORACLE_HOME/bin:$PFAD’ >> /home/grid/.bash_profile
echo ‘export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr / lib’ >> /home/grid/.bash_profile
echo ‘export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME / jlib:$ORACLE_HOME / rdbms / jlib’ >> /home/grid/.bash_profile
Echo “export EDITOR=vi” >> /home/grid/.bash_profile
Echo “export LANG = en_US” >> /home/grid/.bash_profile
Echo “export NLS_LANG=american_america.AL32UTF8” >> /home/grid/.bash_profile
Echo “umask 022” >> /home/grid/.bash_profile
echo ‘export PS1=”`/bin/hostname -s` -> “‘ >> /home/oracle/.bash_profile
Echo “exportiere TMP = / tmp” >> /home/oracle/.bash_profile
echo ‘export TMPDIR=$TMP’ >> /home/oracle/.bash_profile
Echo “export ORACLE_HOSTNAME=node1.localdomain” >> /home/oracle/.bash_profile
Echo “export ORACLE_SID=devdb1” >> /home/oracle/.bash_profile
Echo “export ORACLE_BASE=/u01/app/oracle” >> /home/oracle/.bash_profile
echo ‘export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1’ >> /home/oracle/.bash_profile
Echo “export ORACLE_UNQNAME=devdb” >> /home/oracle/.bash_profile
echo ‘export TNS_ADMIN=$ORACLE_HOME/network/admin’ >> /home/oracle/.bash_profile
Echo “export ORACLE_TERM = xterm” >> /home/oracle/.bash_profile
echo ‘export PATH=/usr/sbin:$PFAD’ >> /home/oracle/.bash_profile
echo ‘export PATH=$ORACLE_HOME/bin:$PFAD’ >> /home/oracle/.bash_profile
echo ‘export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr / lib’ >> /home/oracle/.bash_profile
echo ‘export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME / jlib:$ORACLE_HOME / rdbms / jlib’ >> /home/oracle/.bash_profile
Echo “export LANG = en_US” >> /home/oracle/.bash_profile
Echo “export NLS_LANG=american_america.AL32UTF8” >> /home/oracle/.bash_profile
Echo “export NLS_DATE_FORMAT=’yyyy/mm/dd hh24:mich:ss'” >> /home/oracle/.bash_profile
Echo “umask 022” >> /home/oracle/.bash_profile
Knoten2:
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 asmdba
groupadd -g 1202 asmoper
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c “grid Infrastructure Owner” Gitter
Echo “Gitter” | passwd –stdin grid
echo ‘export PS1=”`/bin/hostname -s` -> “‘ >> /home/grid/.bash_profile
Echo “exportiere TMP = / tmp” >> /home/grid/.bash_profile
echo ‘export TMPDIR=$TMP’ >> /home/grid/.bash_profile
Echo “export ORACLE_SID = + ASM2” >> /home/grid/.bash_profile
Echo “export ORACLE_BASE = / u01 / app / grid” >> /home/grid/.bash_profile
Echo “export ORACLE_HOME=/u01/app/11.2.0/grid” >> /home/grid/.bash_profile
Echo “export ORACLE_TERM = xterm” >> /home/grid/.bash_profile
Echo “export NLS_DATE_FORMAT=’yyyy/mm/dd hh24:mich:ss'” >> /home/grid/.bash_profile
echo ‘export TNS_ADMIN=$ORACLE_HOME/network/admin’ >> /home/grid/.bash_profile
echo ‘export PATH=/usr/sbin:$PFAD’ >> /home/grid/.bash_profile
echo ‘export PATH=$ORACLE_HOME/bin:$PFAD’ >> /home/grid/.bash_profile
echo ‘export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr / lib’ >> /home/grid/.bash_profile
echo ‘export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME / jlib:$ORACLE_HOME / rdbms / jlib’ >> /home/grid/.bash_profile
Echo “export EDITOR=vi” >> /home/grid/.bash_profile
Echo “export LANG = en_US” >> /home/grid/.bash_profile
Echo “export NLS_LANG=american_america.AL32UTF8” >> /home/grid/.bash_profile
Echo “umask 022” >> /home/grid/.bash_profile
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle/ -s /bin/bash -c “Oracle Software Owner” Orakel
Echo “Orakel” | passwd –stdin oracle
echo ‘export PS1=”`/bin/hostname -s` -> “‘ >> /home/oracle/.bash_profile
echo ‘export TMPDIR=$TMP’ >> /home/oracle/.bash_profile
Echo “export ORACLE_HOSTNAME=node2.localdomain” >> /home/oracle/.bash_profile
Echo “export ORACLE_SID=devdb2” >> /home/oracle/.bash_profile
Echo “export ORACLE_BASE=/u01/app/oracle” >> /home/oracle/.bash_profile
echo ‘export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1’ >> /home/oracle/.bash_profile
Echo “export ORACLE_UNQNAME=devdb” >> /home/oracle/.bash_profile
echo ‘export TNS_ADMIN=$ORACLE_HOME/network/admin’ >> /home/oracle/.bash_profile
Echo “export ORACLE_TERM = xterm” >> /home/oracle/.bash_profile
echo ‘export PATH=/usr/sbin:$PFAD’ >> /home/oracle/.bash_profile
echo ‘export PATH=$ORACLE_HOME/bin:$PFAD’ >> /home/oracle/.bash_profile
echo ‘export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr / lib’ >> /home/oracle/.bash_profile
echo ‘export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME / jlib:$ORACLE_HOME / rdbms / jlib’ >> /home/oracle/.bash_profile
Echo “export NLS_LANG=american_america.AL32UTF8” >> /home/oracle/.bash_profile
Echo “export NLS_DATE_FORMAT=’yyyy/mm/dd hh24:mich:ss'” >> /home/oracle/.bash_profile
Echo “umask 022” >> /home/oracle/.bash_profile
现在node1和node2的用户和用户组已创建完成.
node1和node2为grid和oracle用户创建相关路径,并赋予权限。
mkdir -p / u01 / app / grid
mkdir -p /u01/app/11.2.0/grid
mkdir -p / u01 / app / oracle
chown -R Orakel:oinstall / u01
chown -R Gitter:oinstall /u01/app/grid
chown -R Gitter:oinstall /u01/app/11.2.0
chmod -R 775 /u01
编辑/etc/security/limits.conf,配置oracle , grid用户的shell限制
Echo “oracle soft nproc 2047” >> /etc/security/limits.conf
Echo “oracle hard nproc 16384” >> /etc/security/limits.conf
Echo “oracle soft nofile 1024” >> /etc/security/limits.conf
Echo “oracle hard nofile 65536” >> /etc/security/limits.conf
Echo “grid soft nproc 2047” >> /etc/security/limits.conf
Echo “grid hard nproc 16384” >> /etc/security/limits.conf
Echo “grid soft nofile 1024” >> /etc/security/limits.conf
Echo “grid hard nofile 65536” >> /etc/security/limits.conf
Echo “Modifing the /etc/security/limits.conf has been succeed.”
node1和node2 编辑/etc/pam.d/login
Echo “session required /lib/security/pam_limits.so” >> /etc/pam.d/login
Echo “Sitzung erforderlich pam_limits.so” >> /etc/pam.d/login
node1和node2编辑/etc/profile
echo ‘if [ $USER = “Orakel” ] || [ $USER = “Gitter” ] ; dann’ >> /etc/profile
echo ‘if [ $SHELL = “/bin / ksh” ] ; dann’ >> /etc/profile
echo ‘ulimit -p 16384’ >> /etc/profile
echo ‘else’ >> /etc/profile
echo ‘ulimit -u 16384 -n 65536’ >> /etc/profile
echo ‘fi’ >> /etc/profile
echo ‘fi’ >> /etc/profile
node1和node2修改内核参数
Echo “fs.aio-max-nr = 1048576” >> /etc / sysctl.conf
Echo “fs.file-max = 6815744” >> /etc / sysctl.conf
Echo “kernel.shmall = 2097152” >> /etc / sysctl.conf
Echo “kernel.shmmax = 1054472192” >> /etc / sysctl.conf
Echo “kernel.shmmni = 4096” >> /etc / sysctl.conf
Echo “net.ipv4.ip_local_port_range = 9000 65500” >> /etc / sysctl.conf
Echo “net.core.rmem_max = 4194304” >> /etc / sysctl.conf
Echo “net.core.wmem_default = 262144” >> /etc / sysctl.conf
Echo “net.core.wmem_max = 1048586” >> /etc / sysctl.conf
Echo “net.ipv4.tcp_wmem = 262144 262144 262144” >> /etc / sysctl.conf
Echo “net.ipv4.tcp_rmem = 4194304 4194304 4194304” >> /etc / sysctl.conf
sysctl -p
创建node1和node2的共享磁盘
共享磁盘分为OCR , VOTE , DATEN , FLASH ;其中OCR和VOTE大小均为500MB,DATA和FLASH大小均为3GB
OCR: 保存node1和node2的共有配置信息, 防止“健忘”发生.
VOTE: 选举盘(也叫仲裁盘),防止“脑裂”发生.
DATEN: 放置共享数据,表空间等。
FLASH: 存放闪回区数据。
共享磁盘只在node1上创建即可,node2上添加现有磁盘就OK了。
node1上添加完成后, 请为OC R , VOTE , DATEN , FLAH分配总线1.0 1.1 2.o 2.1
node2同样为OC R , VOTE , DATEN , FLAH分配总线1.0 1.1 2.o 2.1 ,不能搞错.
如何创建一块磁盘,以OCR为例
VOTE , DATEN , FLASH和OCR创建方式一样,就不再演示了 ,以下是创建好的.
node2添加node1的磁盘,注意这里添加指的是使用现有磁盘, 否则就不是共享磁盘咯,
其他步骤基本一样.
zu guter Letzt,node1和node2除系统盘外,使用的都是相同磁盘.
我们还需要设置vmx文件,使node1和node2真正做到磁盘共享
打开OEL 5 64 11gnode1.vmx添加如下内容:
isk.locking = “FALSE”
scsi:1.0.sharing = “multi-writer”
scsi:2.0.sharing = “multi-writer”
这样关闭锁定,开启多路径写入,就可以实现磁盘共享
node2的配置文件添加的内容和 node1相同.
设置完成后,开启node1和node2,然后执行fdisk -l 如下:
要使用这四块硬盘还必须格式化,以/dev/sdb为例
fdisk /dev/sdb
键入n ,建立新分区
键入p,建立主分区
键入1 ,从第一块开始
直接回车,使用全部磁盘
键入w,保存更改.
用同样的方法,格式话其余3个磁盘. 最终效果如下.
node2不用再格式化了,直接查看后 结果和node1一样.