一 单实例的创建GI+单实例数据库
分别使用grid用户和oracle用户
oracle用户
export ORACLE_SID=sdb
export ORACLE_UNQNAME=sdb
export JAVA_HOME=/usr/local/java
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/11.2.3
export OGG_HOME=$ORACLE_BASE/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_TERM=xterm
export NLS_DATE_FORMAT="YYYY:MM:DD HH24:MI:SS"
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS11=$ORACLE_HOME/nls/data
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
alias sqlplus='rlwrap sqlplus'
alias ggsci='rlwrap ggsci'
grid用户
#export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/grid
export ORACLE_HOME=/u01/app/grid/11.2.3
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
umask 022
alias sqlplus='rlwrap sqlplus'
mkdir -p /u01/grid/11g/
[root@localhost ~]# mkdir -p /u01/grid
[root@localhost ~]# mkdir -p /u01/oracle/11g
[root@localhost ~]# mkdir -p /u01/app/grid
[root@localhost ~]# chown grid.oinstall /u01/app/grid/
[root@localhost ~]# chmod -R 775 /u01
chown oracle.oinstall /u01/oracle
二 RAC搭建 环境变量设置 oracle用户和grid用户
export ORACLE_SID=mes1
export ORACLE_UNQNAME=mes
export JAVA_HOME=/usr/local/java
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/11.2.3/db
export OGG_HOME=$ORACLE_BASE/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_TERM=xterm
export NLS_DATE_FORMAT="YYYY:MM:DD HH24:MI:SS"
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS11=$ORACLE_HOME/nls/data
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
alias sqlplus='rlwrap sqlplus'
alias ggsci='rlwrap ggsci'
grid用户
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/grid
export ORACLE_HOME=/u01/app/11.2.3/grid
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
umask 022
alias sqlplus='rlwrap sqlplus'
alias asmcmd='rlwrap asmcmd'
--
2 安装 RAC 的准备工作
2.1 添加组和用户(所有节点)
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 -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash grid
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash oracle
--将用户 grid 添加到 dba 组:
[root@rac1 app]# gpasswd -a grid dba
Adding user grid to group dba
--确认用户信息:
[root@rac1 ~]# id oracle
uid=502(oracle) gid=507(oinstall) groups=507(oinstall),502(dba),503(oper),506(asmdba)
[root@rac1 ~]# id grid
uid=1100(grid) gid=507(oinstall) groups=507(oinstall),504(asmadmin),506(asmdba),505(asmoper)
--修改密码:
passwd oracle Dave
passwd grid
--在所有节点上验证用户 nobody 存在:
安装软件之前,执行以下过程,以验证在两个 Oracle RAC 节点上存在用户 nobody,要确定该用
户是否存在,输入以下命令:
# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
如果该命令显示了 nobody 用户的信息,则无需创建该用户。如果用户 nobody 不存在,则输入以下
命令进行创建:
# /usr/sbin/useradd nobody
vim /etc/sysctl.conf
D:\Oracle官方文档\E11882_01\install.112\e24326\toc.htm
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
3、
[root@qhmes ~]# /sbin/service ntpd stop
Shutting down ntpd: [FAILED]
[root@qhmes ~]# mv /etc/ntp.conf /etc/ntp.conf.bak
[root@qhmes ~]# chkconfig ntpd off
[root@qhmes ~]# /etc/init.d/sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@qhmes ~]# chkconfig sendmail off
[root@qhmes ~]# chkconfig iptables off
[root@qhmes ~]# rm /var/run/n
netreport/ nscd/
4、
grid soft nproc 8188
grid hard nproc 65536
grid soft nofile 4096
grid hard nofile 262144
oracle soft nproc 8188
oracle hard nproc 65536
oracle soft nofile 4096
oracle hard nofile 262144
5、
cat >> /etc/pam.d/login <<EOF
session required pam_limits.so
EOF
6、
cat >> /etc/profile <<EOF
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
fi
EOF
一 单实例的创建GI+单实例数据库
分别使用grid用户和oracle用户
oracle用户
export ORACLE_SID=sdb
export ORACLE_UNQNAME=sdb
export JAVA_HOME=/usr/local/java
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/11.2.3
export OGG_HOME=$ORACLE_BASE/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_TERM=xterm
export NLS_DATE_FORMAT="YYYY:MM:DD HH24:MI:SS"
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS11=$ORACLE_HOME/nls/data
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
alias sqlplus='rlwrap sqlplus'
alias ggsci='rlwrap ggsci'
grid用户
#export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/grid
export ORACLE_HOME=/u01/app/grid/11.2.3
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
umask 022
alias sqlplus='rlwrap sqlplus'
mkdir -p /u01/grid/11g/
[root@localhost ~]# mkdir -p /u01/grid
[root@localhost ~]# mkdir -p /u01/oracle/11g
[root@localhost ~]# mkdir -p /u01/app/grid
[root@localhost ~]# chown grid.oinstall /u01/app/grid/
[root@localhost ~]# chmod -R 775 /u01
chown oracle.oinstall /u01/oracle
二 RAC搭建 环境变量设置 oracle用户和grid用户
export ORACLE_SID=mes1
export ORACLE_UNQNAME=mes
export JAVA_HOME=/usr/local/java
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/11.2.3/db
export OGG_HOME=$ORACLE_BASE/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_TERM=xterm
export NLS_DATE_FORMAT="YYYY:MM:DD HH24:MI:SS"
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS11=$ORACLE_HOME/nls/data
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
alias sqlplus='rlwrap sqlplus'
alias ggsci='rlwrap ggsci'
grid用户
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/grid
export ORACLE_HOME=/u01/app/11.2.3/grid
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
umask 022
alias sqlplus='rlwrap sqlplus'
alias asmcmd='rlwrap asmcmd'
--
2 安装 RAC 的准备工作
2.1 添加组和用户(所有节点)
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 -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash grid
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash oracle
--将用户 grid 添加到 dba 组:
[root@rac1 app]# gpasswd -a grid dba
Adding user grid to group dba
--确认用户信息:
[root@rac1 ~]# id oracle
uid=502(oracle) gid=507(oinstall) groups=507(oinstall),502(dba),503(oper),506(asmdba)
[root@rac1 ~]# id grid
uid=1100(grid) gid=507(oinstall) groups=507(oinstall),504(asmadmin),506(asmdba),505(asmoper)
--修改密码:
passwd oracle Dave
passwd grid
--在所有节点上验证用户 nobody 存在:
安装软件之前,执行以下过程,以验证在两个 Oracle RAC 节点上存在用户 nobody,要确定该用
户是否存在,输入以下命令:
# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
如果该命令显示了 nobody 用户的信息,则无需创建该用户。如果用户 nobody 不存在,则输入以下
命令进行创建:
# /usr/sbin/useradd nobody
vim /etc/sysctl.conf
D:\Oracle官方文档\E11882_01\install.112\e24326\toc.htm
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
3、
[root@qhmes ~]# /sbin/service ntpd stop
Shutting down ntpd: [FAILED]
[root@qhmes ~]# mv /etc/ntp.conf /etc/ntp.conf.bak
[root@qhmes ~]# chkconfig ntpd off
[root@qhmes ~]# /etc/init.d/sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@qhmes ~]# chkconfig sendmail off
[root@qhmes ~]# chkconfig iptables off
[root@qhmes ~]# rm /var/run/n
netreport/ nscd/
4、
grid soft nproc 8188
grid hard nproc 65536
grid soft nofile 4096
grid hard nofile 262144
oracle soft nproc 8188
oracle hard nproc 65536
oracle soft nofile 4096
oracle hard nofile 262144
5、
cat >> /etc/pam.d/login <<EOF
session required pam_limits.so
EOF
6、
cat >> /etc/profile <<EOF
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
fi
EOF