赞
踩
主机名:
操作系统(centos7) / | 50G |
/u01 | 40G |
ocr | 10g*3 |
data | 40g*4 |
1.1给虚拟机增加一块40g的磁盘用于安装grid&oracle
fdisk /dev/sdb
我们需要单独给他挂载到/u01下
1.2格式化磁盘\
mkfs.xfs /dev/sdb1
1.3查看磁盘uid和type
blkid /dev/sdb1
1.4 把sdb1挂载到/u01上
- mkidr /u01
- vim /etc/fstab
1.5查看/u01目录磁盘情况
df -h
1.4挂载一下镜像(因为我没有设置开机自动挂载)
mount /dev/cdrom /mnt/cdrom/
vi /etc/hosts
- #public ip
- 192.168.80.30 racnode1
- 192.168.80.31 racnode2
-
- #private ip
- 192.168.20.30 racnode1-priv
- 192.168.20.31 racnode2-priv
-
- #vip ip
- 192.168.80.32 racnode1-vip
- 192.168.80.33 racnode2-vip
-
- #scan ip
- 192.168.80.34 racnode-scan
- groupadd -g 10001 oinstall
- groupadd -g 10002 dba
- groupadd -g 10003 oper
- groupadd -g 10004 asmadmin
- groupadd -g 10005 asmoper
- groupadd -g 10006 asmdba
- useradd -g oinstall -G dba,asmdba,oper oracle
- useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
- password oracle
- password grid
- 直接回车输入密码就ok
- mkdir -p /u01/app/11.2.0/grid
- mkdir -p /u01/app/grid
- chown -R grid:oinstall /u01
- mkdir -p /u01/app/oracle
- chown -R oracle:oinstall /u01/app/oracle
- chmod -R 775 /u01/
6.1挂载一下镜像(因为我没有设置开机自动挂载)
mount /dev/cdrom /mnt/cdrom/
6.2安装依赖包
- yum install binutils -y
- yum install compat-libcap1 -y
- yum install compat-libstdc++-33 -y
- yum install gcc -y
- yum install gcc-c++ -y
- yum install glibc -y
- yum install glibc-devel -y
- yum install ksh -y
- yum install libgcc -y
- yum install libstdc++ -y
- yum install libstdc++-devel -y
- yum install libaio -y
- yum install libaio-devel -y
- yum install libXext -y
- yum install libXtst -y
- yum install libX11 -y
- yum install libXau -y
- yum install libxcb -y
- yum install libXi -y
- yum install make -y
- yum install sysstat -y
- yum install unixODBC -y
- yum install unixODBC-devel -y
- yum install unzip -y
- vi /etc/security/limits.conf
- ------------------------------------------
- grid soft nproc 16384
- grid hard nproc 16384
- grid soft nofile 65536
- grid hard nofile 65536
- grid soft stack 32768
- grid hard stack 32768
- oracle soft nproc 16384
- oracle hard nproc 16384
- oracle soft nofile 65536
- oracle hard nofile 65536
- oracle soft stack 32768
- oracle hard stack 32768
- ++++++++++++++++++++++++++++++++++++++++++++
- vi /etc/pam.d/login
- ----------------------------------------------
- echo "session required pam_limits.so" >> /etc/pam.d/login
- vi /etc/sysctl.conf
- ----------------------------------
- fs.aio-max-nr = 1048576
- fs.file-max = 6815744
- 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 = 1048586
- kernel.panic_on_oops = 1
- kernel.shmmax = 2348810240
- kernel.shmall = 573440
- kernel.shmmni = 4096
- vm.swappiness = 10
- vm.nr_hugepages = 1120
查看是否修改成功
sysctl -p
- vi /etc/rc.d/rc.local
- ------------------------------------
- if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
- echo never > /sys/kernel/mm/transparent_hugepage/enabled
- fi
- if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
- echo never > /sys/kernel/mm/transparent_hugepage/defrag
- fi
- -------------------------------------
- source /etc/rc.d/rc.local
- vim /etc/default/grub
- ---------------------------------
- GRUB_TIMEOUT=5
- GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
- GRUB_DEFAULT=saved
- GRUB_DISABLE_SUBMENU=true
- GRUB_TERMINAL_OUTPUT="console"
- GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet numa=off transparent_hugepage=never"
- GRUB_DISABLE_RECOVERY="true"
- -----------------------------------------------------
- 运行grub2–mkconfig 命令以重新生成grub.cfg文件
- grub2-mkconfig -o /boot/grub2/grub.cfg
11.1grid环境变量配置(su grid 进入grid用户)
下面是两个节点的环境变量都需要配置
- vi .bash_profile
- ----------------racnode1----------------
- alias sqlplus="rlwrap sqlplus"
- export TMP=/tmp
- export ORACLE_BASE=/u01/app/grid
- export ORACLE_HOME=/u01/app/11.2.0/grid
- export GRID_HOME=/u01/app/11.2/grid
- export ORACLE_SID=+ASM1
- export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
- export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
- ----------------racnode2---------------------------------
- alias sqlplus="rlwrap sqlplus"
- export TMP=/tmp
- export ORACLE_BASE=/u01/app/grid
- export ORACLE_HOME=/u01/app/11.2.0/grid
- export GRID_HOME=/u01/app/11.2/grid
- export ORACLE_SID=+ASM2
- export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
- export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
11.2oracle环境变量配置(su oracle)
操作跟grid用户一样
- vi .bash_profile
- -----------------racnode1------------------
- alias sqlplus="rlwrap sqlplus"
- export TMP=/tmp
- export TMPDIR=$TMP
- export LANG=en_US
- export ORACLE_BASE=/u01/app/oracle
- export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
- export ORACLE_SID=racdb1
- export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
- export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
- export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
- export NLS_LANG=AMERICAN_AMERICA.UTF8
- -------------------racnode2--------------------------
- alias sqlplus="rlwrap sqlplus"
- export TMP=/tmp
- export TMPDIR=$TMP
- export LANG=en_US
- export ORACLE_BASE=/u01/app/oracle
- export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
- export ORACLE_SID=racdb2
- export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
- export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
- export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
- export NLS_LANG=AMERICAN_AMERICA.UTF8
- vi /etc/udev/rules.d/99-oracle-asmdevices.rules
- ----------------------------------------------------------------
- ENV{DM_NAME}=="oracle-ocr01", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
- ENV{DM_NAME}=="oracle-ocr02", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
- ENV{DM_NAME}=="oracle-ocr03", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
- ENV{DM_NAME}=="oracle-data01", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
- ENV{DM_NAME}=="oracle-data02", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
- ENV{DM_NAME}=="oracle-data03", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
- ENV{DM_NAME}=="oracle-data04", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
udev
规则- /sbin/udevadm control --reload
-
- /sbin/udevadm trigger --type=devices --action=change
- udevadm trigger
- ls -ld /dev/dm-*
正常添加就行不多解释
14.1查看一下新增的磁盘
fdisk -l | grep /dev/sd
14.2分区磁盘
fdisk /dev/sdc
14.3格式化磁盘
mkfs.xfs /dev/sdc1
14.4创建存放安装包文件
- mkdir /soft
- chmod -R 777 /soft/
- mount /dev/sdc1 /soft/
- df -h
15.1创建存放grid目录
在soft目录下创建grid目录存放grid安装包
- su grid
- cd /soft
- mkdir grid
15.2传输解压包
使用xftp或者是远程传输软件将grid安装包传输到/soft/grid目录下
这省略不截图了
15.3赋予安装包权限
使用root用户赋予权限
- su
- cd /soft/grid
- chown -R grid:oinstall *
必须得用grid用户
unzip p13390677_112040_Linux-x86-64_3of7.zip
- cd ./grid
- ./runInstaller -jreLoc /etc/alternatives/jre_1.8.0
可以查看一下
vim /etc/hosts
会给你个弹窗,说你密码强度太低,yes就行
后面就一直下一步就行
这些必须解决
一下操作节点2也需要进行操作
- cd /soft/grid/grid/rpm
- 安装这个目录下的安装包
- rpm -ivh cvuqdisk-1.0.9-1.rpm
- 挂载一下yum原,(我没有设置开机自动挂起)
-
- mount /dev/cdrom /mnt/cdrom/
- yum install elfutils-libelf-devel.x86_64 -y
-
- rpm -ivh compat-libstdc-33-3.2.3-72.el7.x86_64.rpm
- rpm -ivh --force --nodeps pdksh-5.2.14-30.x86_64.rpm
-
需要重新进行检测
可以看一下里面多了很多文件,
- cd /soft/grid/grid/
- 还可以多次输入一下命令,来看目录的大小
- du -sh grid/
执行脚本之前需要在两个节点上打补丁
- unzip p18370031_112040_Linux-x86-64.zip
- grid 用户在节点1,和节2都要打上打补丁
- /u01/app/11.2.0/grid/OPatch/opatch napply -oh /u01/app/11.2.0/grid/ -local /soft/grid/18370031
y
分别在节点1和节点2上打脚本
- 两个节点都要打
- /u01/app/oraInventory/orainstRoot.sh
- 第二个会慢很正常、但是第二个脚本一定要在节点1跑完再去节点2
- /u01/app/11.2.0/grid/root.sh
下面是第一个脚本实行的大致图可以看一下是否一样
下面是第二个脚本实行的大致图可以看一下是否一样
查看grid情况
crsctl stat res -t
会有两个x,正常的,因为我们没有装jns,我们用的是etchost
使用root用户配置一下环境变量
两个节点都要设置
- vim .bash_profile
- 在bin后面加上:/u01/app/11.2.0/grid/bin
- source .bash_profile
- crsctl stop crs
再次启动
crsctl stop crs
OK结束
使用oracle用户
解压安装
- unzip p13390677_112040_Linux-x86-64_1of7.zip
- unzip p13390677_112040_Linux-x86-64_2of7.zip
-
- cd ./database
- ./runInstaller -jreLoc /etc/alternatives/jre_1.8.0
- oracle用户
- 修改个文件
- cd /u01/app/oracle/product/11.2.0/db_1/sysman/lib
- vim ins_emagent.mk ins_emagent.mk.bak
- 176行改成
- $(MK_EMAGENT_NMECTL) -lnnz11
然后retry就ok
在节点2执行
/u01/app/orInventory/orainstRoot.sh
分别在节点1和节点2执行
/u01/app/oracle/product/11.2.0/db_1/root.sh
ok ok ok ok
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。