-- 检查是否又数据库在运行的命令
ps -ef|grep smon
2020-07-02
1. 操作系统: Oracle Linux 7.6 x86_64
2. 数据库: 12c
3.数据库实例名称:
4.字符集:ZHS16GBK
5.数据块大小:8k
6.IP地址:自少会有7个
7.每台机器要2块网卡
先把linux环境安装好
做三个系统,目录下需要挂载好磁盘空间
1. 文件分区做好, 先每个月预留20个G
文件做好
2. 配置IP ,计算机名称,域控等, 保证内网可以访问, 并关闭防火墙设定
保证xshell可以访问
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=ac52ae68-be92-4586-8479-b92425db4107
DEVICE=ens33
IPADDR=192.168.32.131
NETMASK=255.255.255.0
GATEWAY=192.168.32.2
ONBOOT=yes
NM_CONTROLLED=no
IPV6_PRIVACY=no
3. 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
查看防火墙状态
systemctl status firewalld
NAT 网络模式,对应网卡是ens33
需要修改
vi /etc/sysconfig/network-scripts/ifcfg-ens33
重启网络服务
systemctl restart network
3.系统名称
vi /etc/hosts
192.168.32.131 ocp2
vi /etc/resolv.conf
nameserver 8.8.8.8
-- 最后安装会报错,现在修改为
namerserver 192.168.32.140
namerserver 192.168.32.141
结论是这部分, 在最后都不需要
------------------------------------------------------------
4. 安装Oracle
配置 hosts
相互直接用IP跟名称可以访问 ,A,B 同时配置
vi /etc/hosts
192.168.32.140 CQRAC01-EN
192.168.32.141 CQRAC02-EN
192.168.30.144 CQRAC01prv -- 不要跟对外一个网段
192.168.30.145 CQRAC02prv
192.168.32.146 CQRAC01vip
192.168.32.147 CQRAC02vip
192.168.32.100 CQRACscan
5.关闭SELINIX,防火墙
echo "SELINUX=disabled" > /etc/selinux/config
echo "#SELINUXTYPE=targeted" >> /etc/selinux/config
setenforce 1
systemctl stop firewalld.service
systemctl disable firewalld.service
6. 禁止NTP 时间同步服务
systemctl stop ntpd
systemctl disabled ntpd
systemctl stop chronyd.service
systemctl disable chronyd.service
rm -f /etc/chrony.conf
7.配置 yum 源配置
mkdir /mnt/linux
mount /dev/cdrom /mnt/linux
cd /etc/yum.repos.d
mkdir bk
mv *.repo bk/
echo "[EL]" >> /etc/yum.repos.d/itpux.repo
echo "name=Linux 7.x DVD" >> /etc/yum.repos.d/itpux.repo
echo "baseurl=file:///mnt/linux" >> /etc/yum.repos.d/itpux.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/itpux.repo
echo "enabled=1" >> /etc/yum.repos.d/itpux.repo
cat /etc/yum.repos.d/itpux.repo
8.oracle预备安装前的包
cd /mnt/hgfs/soft/
rpm -ivh
9.权限分配
S
/usr/sbin/groupadd -g 60001 oinstall
/usr/sbin/groupadd -g 60002 dba
/usr/sbin/groupadd -g 60003 oper
/usr/sbin/groupadd -g 60004 backupdba
/usr/sbin/groupadd -g 60005 dgdba
/usr/sbin/groupadd -g 60006 kmdba
/usr/sbin/groupadd -g 60007 asmdba
/usr/sbin/groupadd -g 60008 asmoper
/usr/sbin/groupadd -g 60009 asmadmin
/usr/sbin/useradd -u 61001 -g oinstall -G asmadmin,asmdba,dba,asmoper grid
/usr/sbin/useradd -u 61002 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin oracle
passwd grid
passwd oracle
--------------
10. 处理文件夹
mkdir -p /u01/app/grid
mkdir -p /u01/app/12c/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
mkdir -p /u01/app/oracle/product/12c/dbhome_1
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
11.-----------
-- 修改配置文件
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
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 = 1048586
# 配置生效
sysctl -p
------------
12. 环境变量的配置
su - grid
vi ~/.bash_profile
umask 022
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/12c/grid
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
source ~/.bash_profile
env |grep ORACLE
--------------------------------------------------------------------
su - grid
vi ~/.bash_profile
umask 022
export ORACLE_SID=+ASM2
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/12c/grid
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
source ~/.bash_profile
env |grep ORACLE
------------------------------------------------------------------
su - oracle
vi ~/.bash_profile
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12c/dbhome_1
export ORACLE_UNQNAME=lfscq
export ORACLE _SID=ifscq1
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
source ~/.bash_profile
env |grep ORACLE
---------------------------------------------------------------------
su - oracle
vi ~/.bash_profile
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12c/dbhome_1
export ORACLE_UNQNAME=lfscq
export ORACLE _SID=ifscq2
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
source ~/.bash_profile
env |grep ORACLE
13. 配置共享存储
rm -rf asm
-- 这是删除目录的命令,不要经常用,避免删除不应该删除的东西
IP: 192.168.32.142
配置ASM目录
vi /etc/exports
/data *(rw,sync,no_wdelay,insecure,no_root_squash)
systemctl restart nfs-server.service
showmount -t
exportfs -v
14. 关闭共享存储配置的
echo "SELINUX=disabled" > /etc/selinux/config
echo "#SELINUXTYPE=targeted" >> /etc/selinux/config
cat /etc/selinux/config
systemctl stop firewalld.service
systemctl disable firewalld.service
15. RAC主机配置
mkdir /asm
vi /etc/fstab
192.168.32.142:/data /asm nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
mount -a
chown -R grid:asmadmin /asm
15. ASM共享磁盘创建
mkdir -p /data/oracleasm/disks
dd if=/dev/zero of=/data/oracleasm/disks/asm1 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm2 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm3 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm4 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm5 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm6 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm7 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm8 bs=8192k count=1280
chown grid:asmadmin /data/oracleasm/disks/asm1
chown grid:asmadmin /data/oracleasm/disks/asm2
chown grid:asmadmin /data/oracleasm/disks/asm3
chown grid:asmadmin /data/oracleasm/disks/asm4
chown grid:asmadmin /data/oracleasm/disks/asm5
chown grid:asmadmin /data/oracleasm/disks/asm6
chown grid:asmadmin /data/oracleasm/disks/asm7
chown grid:asmadmin /data/oracleasm/disks/asm8
-- 这个授权有个问题, 就是, 是否是, RAC主机授权这个路径,还是,在共享磁盘组里面,创建grid账号组,再授权。。。
chown grid:asmadmin /asm/oracleasm/disks/asm1
chown grid:asmadmin /asm/oracleasm/disks/asm2
chown grid:asmadmin /asm/oracleasm/disks/asm3
chown grid:asmadmin /asm/oracleasm/disks/asm4
chown grid:asmadmin /asm/oracleasm/disks/asm5
chown grid:asmadmin /asm/oracleasm/disks/asm6
chown grid:asmadmin /asm/oracleasm/disks/asm7
chown grid:asmadmin /asm/oracleasm/disks/asm8
16. 安装grid , 先把软件压缩包拷贝到/mnt中
用grid 用户解压文件到
su - grid
cd $ORACLE_HOME
unzip linuxx64_12201_grid_home.zip
su - root
rpm -Uvh /u01/app/12c/grid/cv/rpm/cvuqdisk*
17. 执行grid 安装
grid账户登录虚拟机
cd $ORACLE_HOME
./gridSetup.sh
18. 需要两块网卡
cp ifcfg-ens33 ifcfg-ens37
为网卡生成新的编码
命令: uuidgen ens37
UUID
5958e51e-233c-47f7-a864-df41a9cb160e
df38ce14-8968-47d1-99b6-defaa0018849
vi /etc/sysconfig/network-scripts/ifcfg-ens37
systemctl restart network
19. 安装grid
注意事项: 如果服务器重启,那么记得需要先把共享存储挂起来。
oracle
安装失败后,最好把路径的软件都删除,重新做
rm -rf 路径/*
一定要保证grid安装完成后,才能去安装Oracle ,否则, 更麻烦
cat /etc/resolv.conf
CQRAC01-EN 192.168.32.140
CQRAN02-EN 192.168.32.141
CQRAC01prv 192.168.30.144
CQRAC02prv 192.168.30.145
CQRAC01vip 192.168.32.146
CQRAC02vip 192.168.32.147
CQRACscan 192.168.32.100
CQRACcluster
CQRACscan
CQRAC01-EN
CQRAC01vip
CQRAC02-EN
CQRAC02vip
mv /etc/resolv.conf /etc/resolv.conf.20180620.bak
这个文件中不能配置, 否则会报错
20,虚拟机内存要大于最小限制的8个G
temp 空间不足
mkdir /u01/tmp
chown root:root /u01/tmp
chmod 1777 /u01/tmp
vi ~/.bash_profile
export TEMP=/u01/tmp
export TMPDIR=/u01/tmp
source ~/.bash_profile
env |grep TMP
21. 不光盘挂载一下,看看需要的包
su - root
mount /dev/sr0 /mnt
cd /mnt
cd Packages/
ls compat*
rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm
rpm -ivh libstdc++-devel-4.8.5-16.el7.x86_64.rpm
rpm -ivh ksh-20120801-34.el7.x86_64.rpm
rpm -ivh glibc-devel-2.17-196.el7.x86_64.rpm
rpm -ivh libaio-devel-0.3.109-13.el7.x86_64.rpm
rpm -ivh glibc-headers-2.17-196.el7.x86_64.rpm
rpm -ivh kernel-headers-2.6.18-274.el5.x86_64.rpm
如果发现有些包安装不上, 那是因为有依赖包要先安装, 如果光盘里面没有,那么请到网上下载,并上传到服务器,安装后,再做
22,检查grid集群运行状态
出现的错误:
--- 11
Check Failed on Nodes: [cqrac01-en, cqrac02-en]
Verification result of failed node: cqrac01-en
Expected Value
: 8GB (8388608.0KB)
Actual Value
: 7.5445GB (7910952.0KB)
Details:
-
PRVF-7530 : Sufficient physical memory is not available on node "cqrac01-en" [Required physical memory = 8GB (8388608.0KB)] - Cause: Amount of physical memory (RAM) found does not meet minimum memory requirements. - Action: Add physical memory (RAM) to the node specified.
-- 22
Swap Size - This is a prerequisite condition to test whether sufficient total swap space is available on the system.
Check Failed on Nodes: [cqrac01-en, cqrac02-en]
Verification result of failed node: cqrac01-en
Expected Value
: 7.5445GB (7910952.0KB)
Actual Value
: 3.875GB (4063228.0KB)
Details:
-
PRVF-7573 : Sufficient swap size is not available on node "cqrac01-en" [Required = 7.5445GB (7910952.0KB) ; Found = 3.875GB (4063228.0KB)] - Cause: The swap size found does not meet the minimum requirement. - Action: Increase swap size to at least meet the minimum swap space requirement.
--33
Free Space: cqrac01-en:/usr,cqrac01-en:/var,cqrac01-en:/etc,cqrac01-en:/sbin,cqrac01-en:/tmp - This is a prerequisite condition to test whether sufficient free space is available in the file system. Error:
-
PRVF-7501 : Sufficient space is not available at location "/tmp" on node "cqrac01-en" [Required space = 1GB ; available space = 596MB ] - Cause: There was not enough free space at location specified. - Action: Free up additional space or select another location.
-
PRVF-7501 : Sufficient space is not available at location "/" on node "cqrac01-en" [Required space = [25MB (/usr) + 5MB (/var) + 25MB (/etc) + 10MB (/sbin) + 1GB (/tmp) = 1.0635GB ]; available space = 596MB ] - Cause: There was not enough free space at location specified. - Action: Free up additional space or select another location.
--44