1.服务器配置

[root@oracle01 ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

/dev/mapper/centos-root   20G  1.7G   19G   9% /

devtmpfs                 1.5G     0  1.5G   0% /dev

tmpfs                    1.5G     0  1.5G   0% /dev/shm

tmpfs                    1.5G  9.5M  1.5G   1% /run

tmpfs                    1.5G     0  1.5G   0% /sys/fs/cgroup

/dev/sda1                397M  121M  277M  31% /boot

/dev/mapper/centos-tmp   5.0G   33M  5.0G   1% /tmp

/dev/mapper/centos-home   10G   33M   10G   1% /home

/dev/mapper/centos-u01    61G   33M   61G   1% /u01

tmpfs                    299M     0  299M   0% /run/user/0

[root@oracle01 ~]# free -h

total        used        free      shared  buff/cache   available

Mem:           2.9G        178M        2.3G        9.4M        487M        2.5G

Swap:          4.0G          0B        4.0G

[root@oracle01 ~]# ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

inet 192.168.157.137  netmask 255.255.255.0  broadcast 192.168.157.255

inet6 fe80::9be3:4f6f:e9d5:f61f  prefixlen 64  scopeid 0x20<link>

ether 00:0c:29:c3:19:be  txqueuelen 1000  (Ethernet)

RX packets 37857  bytes 53794846 (51.3 MiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 7050  bytes 485521 (474.1 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

inet 10.10.10.129  netmask 255.255.255.0  broadcast 10.10.10.255

inet6 fe80::a2e3:aa14:94c6:af5d  prefixlen 64  scopeid 0x20<link>

ether 00:0c:29:c3:19:c8  txqueuelen 1000  (Ethernet)

RX packets 19  bytes 1732 (1.6 KiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 18  bytes 1352 (1.3 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

inet 127.0.0.1  netmask 255.0.0.0

inet6 ::1  prefixlen 128  scopeid 0x10<host>

loop  txqueuelen 1000  (Local Loopback)

RX packets 0  bytes 0 (0.0 B)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 0  bytes 0 (0.0 B)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@oracle02 ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

/dev/mapper/centos-root   20G  1.8G   19G   9% /

devtmpfs                 1.5G     0  1.5G   0% /dev

tmpfs                    1.5G     0  1.5G   0% /dev/shm

tmpfs                    1.5G  9.5M  1.5G   1% /run

tmpfs                    1.5G     0  1.5G   0% /sys/fs/cgroup

/dev/sda1                397M  121M  277M  31% /boot

/dev/mapper/centos-u01    61G   33M   61G   1% /u01

/dev/mapper/centos-tmp   5.0G   33M  5.0G   1% /tmp

/dev/mapper/centos-home   10G   33M   10G   1% /home

tmpfs                    299M     0  299M   0% /run/user/0

[root@oracle02 ~]# free -h

total        used        free      shared  buff/cache   available

Mem:           2.9G        174M        2.3G        9.4M        458M        2.6G

Swap:          4.0G          0B        4.0G

[root@oracle02 ~]# ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

inet 192.168.157.138  netmask 255.255.255.0  broadcast 192.168.157.255

inet6 fe80::c74:76cb:6393:e10e  prefixlen 64  scopeid 0x20<link>

ether 00:0c:29:3f:38:c6  txqueuelen 1000  (Ethernet)

RX packets 29789  bytes 42933104 (40.9 MiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 4190  bytes 305947 (298.7 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

inet 10.10.10.130  netmask 255.255.255.0  broadcast 10.10.10.255

inet6 fe80::7832:2a05:85a6:b9b4  prefixlen 64  scopeid 0x20<link>

ether 00:0c:29:3f:38:d0  txqueuelen 1000  (Ethernet)

RX packets 0  bytes 0 (0.0 B)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 18  bytes 1352 (1.3 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

inet 127.0.0.1  netmask 255.0.0.0

inet6 ::1  prefixlen 128  scopeid 0x10<host>

loop  txqueuelen 1000  (Local Loopback)

RX packets 0  bytes 0 (0.0 B)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 0  bytes 0 (0.0 B)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

2.IP地址规划(两个节点的/etc/hosts文件都要配置)

# public ip

192.168.157.137 oracle01

192.168.157.138 oracle02

# Private IP

10.10.10.129 oracle01-priv

10.10.10.130 oracle02-priv

# Virtual IP

192.168.157.237 oracle01-vip

192.168.157.238 oracle02-vip

# Scan IP

192.168.157.139 oracle-cluster

[root@oracle01 ~]# ping -c 4 oracle02
PING oracle02 (192.168.157.138) 56(84) bytes of data.
64 bytes from oracle02 (192.168.157.138): icmp_seq=1 ttl=64 time=0.300 ms
64 bytes from oracle02 (192.168.157.138): icmp_seq=2 ttl=64 time=0.431 ms
64 bytes from oracle02 (192.168.157.138): icmp_seq=3 ttl=64 time=0.384 ms
64 bytes from oracle02 (192.168.157.138): icmp_seq=4 ttl=64 time=1.81 ms

--- oracle02 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.300/0.733/1.817/0.627 ms
[root@oracle01 ~]# ping -c 4 oracle02-priv
PING oracle02-priv (10.10.10.130) 56(84) bytes of data.
64 bytes from oracle02-priv (10.10.10.130): icmp_seq=1 ttl=64 time=0.190 ms
64 bytes from oracle02-priv (10.10.10.130): icmp_seq=2 ttl=64 time=0.249 ms
64 bytes from oracle02-priv (10.10.10.130): icmp_seq=3 ttl=64 time=0.261 ms
64 bytes from oracle02-priv (10.10.10.130): icmp_seq=4 ttl=64 time=0.204 ms

--- oracle02-priv ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.190/0.226/0.261/0.029 ms

===================================================================================

[root@oracle02 ~]# ping -c 4 oracle01
PING oracle01 (192.168.157.137) 56(84) bytes of data.
64 bytes from oracle01 (192.168.157.137): icmp_seq=1 ttl=64 time=2.06 ms
64 bytes from oracle01 (192.168.157.137): icmp_seq=2 ttl=64 time=0.592 ms
64 bytes from oracle01 (192.168.157.137): icmp_seq=3 ttl=64 time=1.07 ms
64 bytes from oracle01 (192.168.157.137): icmp_seq=4 ttl=64 time=1.25 ms

--- oracle01 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 0.592/1.248/2.067/0.532 ms
[root@oracle02 ~]# ping -c 4 oracle01-priv
PING oracle01-priv (10.10.10.129) 56(84) bytes of data.
64 bytes from oracle01-priv (10.10.10.129): icmp_seq=1 ttl=64 time=0.327 ms
64 bytes from oracle01-priv (10.10.10.129): icmp_seq=2 ttl=64 time=0.236 ms
64 bytes from oracle01-priv (10.10.10.129): icmp_seq=3 ttl=64 time=0.229 ms
64 bytes from oracle01-priv (10.10.10.129): icmp_seq=4 ttl=64 time=0.194 ms

--- oracle01-priv ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.194/0.246/0.327/0.051 ms

3.安装依赖包

yum install binutilscompat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 gcc gcc-c++ glibc glibc.i686 glibc-develglibc-devel.i686 ksh libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libaiolibaio.i686 libaio-devel libaio-devel.i686 libXext libXext.i686 libXtst libXtst.i686 libX11libX11.i686 libXau libXau.i686 libxcb libxcb.i686 libXi libXi.i686 make sysstat unixODBCunixODBC-devel readline libtermcap-devel pdksh -y

4.关闭selinux和配置防火墙

[root@oracle01 ~]# vi /etc/selinux/config
[root@oracle01 ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

===================================================================================

[root@oracle02 ~]# vi /etc/selinux/config
[root@oracle02 ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#???? enforcing - SELinux security policy is enforced.
#???? permissive - SELinux prints warnings instead of enforcing.
#???? disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#???? targeted - Targeted processes are protected,
#???? minimum - Modification of targeted policy. Only selected processes are protected.
#???? mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@oracle01 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-01-03 14:01:12 CST; 1h 58min ago
     Docs: man:firewalld(1)
 Main PID: 6429 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─6429 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Jan 03 14:01:09 oracle01 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 03 14:01:12 oracle01 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@oracle01 ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@oracle01 ~]# systemctl stop firewalld.service
[root@oracle01 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Jan 03 14:01:09 oracle01 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 03 14:01:12 oracle01 systemd[1]: Started firewalld - dynamic firewall daemon.
Jan 03 16:00:08 oracle01 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jan 03 16:00:09 oracle01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@oracle01 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-01-03 14:01:12 CST; 1h 58min ago
     Docs: man:firewalld(1)
 Main PID: 6429 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─6429 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Jan 03 14:01:09 oracle01 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 03 14:01:12 oracle01 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@oracle01 ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@oracle01 ~]# systemctl stop firewalld.service
[root@oracle01 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Jan 03 14:01:09 oracle01 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 03 14:01:12 oracle01 systemd[1]: Started firewalld - dynamic firewall daemon.
Jan 03 16:00:08 oracle01 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jan 03 16:00:09 oracle01 systemd[1]: Stopped firewalld - dynamic firewall daemon.

===========================================================================================

[root@oracle02 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
?? Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
?? Active: active (running) since Fri 2020-01-03 14:01:18 CST; 1h 32min ago
???? Docs: man:firewalld(1)
Main PID: 6442 (firewalld)
?? CGroup: /system.slice/firewalld.service
?????????? └─6442 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Jan 03 14:01:16 oracle02 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 03 14:01:18 oracle02 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@oracle02 ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@oracle02 ~]# systemctl stop firewalld.service
[root@oracle02 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
?? Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
?? Active: inactive (dead)
???? Docs: man:firewalld(1)

Jan 03 14:01:16 oracle02 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 03 14:01:18 oracle02 systemd[1]: Started firewalld - dynamic firewall daemon.
Jan 03 15:34:11 oracle02 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jan 03 15:34:11 oracle02 systemd[1]: Stopped firewalld - dynamic firewall daemon.

5.添加组和用户(两个节点)

groupadd -g 60001 oinstall
groupadd -g 60002 dba
groupadd -g 60003 oper
groupadd -g 60004 backupdba
groupadd -g 60005 dgdba
groupadd -g 60006 kmdba
groupadd -g 60007 asmdba
groupadd -g 60008 asmoper
groupadd -g 60009 asmadmin
useradd -u 61001 -g oinstall -G asmadmin,asmdba,dba,asmoper grid
useradd -u 61002 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin,oper,asmdba oracle
echo "grid" | passwd --stdin grid
echo "oracle" | passwd --stdin oracle

[root@oracle01 ~]# groupadd -g 60001 oinstall
[root@oracle01 ~]# groupadd -g 60002 dba
[root@oracle01 ~]# groupadd -g 60003 oper
[root@oracle01 ~]# groupadd -g 60004 backupdba
[root@oracle01 ~]# groupadd -g 60005 dgdba
[root@oracle01 ~]# groupadd -g 60006 kmdba
[root@oracle01 ~]# groupadd -g 60007 asmdba
[root@oracle01 ~]# groupadd -g 60008 asmoper
[root@oracle01 ~]# groupadd -g 60009 asmadmin
[root@oracle01 ~]# useradd -u 61001 -g oinstall -G asmadmin,asmdba,dba,asmoper grid
[root@oracle01 ~]# useradd -u 61002 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin,oper,asmdba oracle
[root@oracle01 ~]# echo "grid" | passwd --stdin grid
Changing password for user grid.
passwd: all authentication tokens updated successfully.
[root@oracle01 ~]# echo "oracle" | passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
[root@oracle01 ~]# id oracle
uid=61002(oracle) gid=60001(oinstall) groups=60001(oinstall),60002(dba),60003(oper),60004(backupdba),60005(dgdba),60006(kmdba),60007(asmdba),60009(asmadmin)
[root@oracle01 ~]# id grid
uid=61001(grid) gid=60001(oinstall) groups=60001(oinstall),60002(dba),60007(asmdba),60008(asmoper),60009(asmadmin)

=============================================================================================================

[root@oracle02 ~]# groupadd -g 60001 oinstall
[root@oracle02 ~]# groupadd -g 60002 dba
[root@oracle02 ~]# groupadd -g 60003 oper
[root@oracle02 ~]# groupadd -g 60004 backupdba
[root@oracle02 ~]# groupadd -g 60005 dgdba
[root@oracle02 ~]# groupadd -g 60006 kmdba
[root@oracle02 ~]# groupadd -g 60007 asmdba
[root@oracle02 ~]# groupadd -g 60008 asmoper
[root@oracle02 ~]# groupadd -g 60009 asmadmin
[root@oracle02 ~]# useradd -u 61001 -g oinstall -G asmadmin,asmdba,dba,asmoper grid
[root@oracle02 ~]# useradd -u 61002 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin,oper,asmdba oracle
[root@oracle02 ~]# echo "grid" | passwd --stdin grid
Changing password for user grid.
passwd: all authentication tokens updated successfully.
[root@oracle02 ~]# echo "oracle" | passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
[root@oracle02 ~]#
[root@oracle02 ~]# id oracle
uid=61002(oracle) gid=60001(oinstall) groups=60001(oinstall),60002(dba),60003(oper),60004(backupdba),60005(dgdba),60006(kmdba),60007(asmdba),60009(asmadmin)
[root@oracle02 ~]#
[root@oracle02 ~]# id grid
uid=61001(grid) gid=60001(oinstall) groups=60001(oinstall),60002(dba),60007(asmdba),60008(asmoper),60009(asmadmin)

6.添加目录(两个节点都要加)

mkdir -p /u01/app/grid
mkdir -p /u01/app/12.2.0/grid
chown -R grid:oinstall /u01/app
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle

7.修改操作系统参数(两个节点都要加)

vi /etc/security/limits.conf

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

grid soft stack 10240

grid hard stack 32768

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

oracle hard stack 32768

cat /etc/security/limits.d/20-nproc.conf

#*          soft    nproc     4096

root       soft    nproc     unlimited

*          soft    nproc     16384

vi /etc/pam.d/login

session required pam_limits.so

kernel.shmmax参数:需要根据实际物理内存计算,此处按节点物理内存计算;建议kernel.shmmax参数取值为节点物理内存的70%,单位为字节,即物理内存*70%*1024*1024*1024。
kernel.sem参数:如果客户单个数据库需要支持的process数超过12000,请按照实际情况配置

[root@oracle01 ~]# MEMTOTAL=$(free -b | sed -n '2p' | awk '{print $2}')

[root@oracle01 ~]# echo SHMMAX=$(expr $MEMTOTAL*4/5)

SHMMAX=3133755392*4/5

[root@oracle01 ~]# echo SHMALL=$(expr $MEMTOTAL/4*1024)

SHMALL=3133755392/4*1024

[root@oracle01 ~]# vi /etc/sys

sysconfig/          sysctl.conf         sysctl.conf.bak     sysctl.d/           systemd/            system-release      system-release-cpe

[root@oracle01 ~]# vi /etc/sysc

sysconfig/       sysctl.conf      sysctl.conf.bak  sysctl.d/

[root@oracle01 ~]# vi /etc/sysctl.conf

[root@oracle01 ~]#

[root@oracle01 ~]# cat /etc/sysctl.conf

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmmax = 2507004313

kernel.shmall = 12241232

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

kernel.panic_on_oops = 1

[root@oracle01 ~]# sysctl -p

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmmax = 2507004313

kernel.shmall = 12241232

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

kernel.panic_on_oops = 1

8. 配置用户变量

节点一:

[grid@oracle01:/home/grid]$cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

umask 022

export TMP=/tmp

export LANG=en_US

export TMPDIR=$TMP

export ORACLE_HOSTNAME=oracle01

export ORACLE_SID=+ASM1

export ORACLE_TERM=xterm

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/12.2.0/grid

export NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"

export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin

export THREADS_FLAG=native

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

[grid@oracle01:/home/grid]$source .bash_profile

[root@oracle01 ~]# su - oracle

[oracle@oracle01 ~]$ vi .bash_profile

[oracle@oracle01 ~]$ source .bash_profile

[oracle@oracle01:/home/oracle]$cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

umask 022

export TMP=/tmp

export LANG=en_US

export TMPDIR=$TMP

export ORACLE_HOSTNAME=oracle01

export ORACLE_UNQNAME=rac

export ORACLE_SID=rac01

export ORACLE_TERM=xterm

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1

export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin

export THREADS_FLAG=native

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

节点二:

[root@oracle02 ~]# su - grid

[grid@oracle02 ~]$ vi .bash_profile

[grid@oracle02 ~]$ cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

umask 022

export TMP=/tmp

export LANG=en_US

export TMPDIR=$TMP

export ORACLE_HOSTNAME=oracle02

export ORACLE_SID=+ASM2

export ORACLE_TERM=xterm;export ORACLE_TERM

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/12.2.0/grid

export NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"

export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin

export THREADS_FLAG=native

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

[grid@oracle02 ~]$ source .bash_profile

[root@oracle02 ~]# su - oracle

[oracle@oracle02 ~]$ vi .bash_profile

[oracle@oracle02 ~]$ cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

umask 022

export TMP=/tmp

export LANG=en_US

export TMPDIR=$TMP

export ORACLE_HOSTNAME=oracle02

export ORACLE_UNQNAME=rac

export ORACLE_SID=rac02

export ORACLE_TERM=xterm

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1

export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin

export THREADS_FLAG=native

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

[oracle@oracle02 ~]$ source .bash_profile

9.配置SSH无密码登陆(两节点)

节点1:

[root@oracle01 ~]# su - grid

Last login: Sat Jan  4 12:37:40 CST 2020 on pts/0

[grid@oracle01:/home/grid]$ssh

ssh          ssh-add      ssh-agent    ssh-copy-id  sshd         sshd-keygen  ssh-keygen   ssh-keyscan

[grid@oracle01:/home/grid]$ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/home/grid/.ssh/id_rsa):

Created directory '/home/grid/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/grid/.ssh/id_rsa.

Your public key has been saved in /home/grid/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:7ieUDFT+LZ+ZUReTPnG9Oqae07YeULYoTONGe9zS8Vw grid@oracle01

The key's randomart image is:

+---[RSA 2048]----+

|       ..      oo|

|      ..       o=|

|     .  .+   +o E|

|      . =.+.*.==.|

|       oSBo*o+.o.|

|       .= oooO   |

|       ..   O..  |

|       .. .o.o.  |

|        .o.o+o.  |

+----[SHA256]-----+

[grid@oracle01:/home/grid]$ssh-copy-id -i ~/.ssh/id_rsa.pub grid@192.168.157.138

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/grid/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.138 (192.168.157.138)' can't be established.

ECDSA key fingerprint is SHA256:bhmrFpJcz+l4Mb9RdwoWxROsSI4brh+VEws/G5vSREA.

ECDSA key fingerprint is MD5:3b:5f:17:42:44:11:68:6a:70:cf:e5:28:3e:8f:fb:b0.

Are you sure you want to continue connecting (yes/no)? yes

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

grid@192.168.157.138's password:

Permission denied, please try again.

grid@192.168.157.138's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'grid@192.168.157.138'"

and check to make sure that only the key(s) you wanted were added.

[grid@oracle01:/home/grid]$ssh-copy-id -i ~/.ssh/id_rsa.pub grid@192.168.157.137

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/grid/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.137 (192.168.157.137)' can't be established.

ECDSA key fingerprint is SHA256:l1t05f8Yvogx3vZicVSkMNIdPiboJ7drwTnVblKLS/c.

ECDSA key fingerprint is MD5:c0:38:7b:96:8f:14:3d:80:7b:2d:24:2d:3b:ca:c1:84.

Are you sure you want to continue connecting (yes/no)? yes

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

grid@192.168.157.137's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'grid@192.168.157.137'"

and check to make sure that only the key(s) you wanted were added.

[grid@oracle01:/home/grid]$exit

logout

[root@oracle01 ~]# su - oracle

Last login: Sat Jan  4 12:46:13 CST 2020 on pts/0

[oracle@oracle01:/home/oracle]$ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_rsa):

Created directory '/home/oracle/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_rsa.

Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:+jSLEAkSRHqrkvUR5YVg4noCKRQL9yOEUXTCfUfo4rk oracle@oracle01

The key's randomart image is:

+---[RSA 2048]----+

|*@O.+..+o        |

|=*o*.o+..        |

|*.= +o..         |

|o+ +.+.          |

|o +.+o  S        |

| * .oo .         |

|+   o.. o        |

|.   E. + o       |

|      . o        |

+----[SHA256]-----+

[oracle@oracle01:/home/oracle]$ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@192.168.157.138

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.138 (192.168.157.138)' can't be established.

ECDSA key fingerprint is SHA256:bhmrFpJcz+l4Mb9RdwoWxROsSI4brh+VEws/G5vSREA.

ECDSA key fingerprint is MD5:3b:5f:17:42:44:11:68:6a:70:cf:e5:28:3e:8f:fb:b0.

Are you sure you want to continue connecting (yes/no)? yes

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

oracle@192.168.157.138's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'oracle@192.168.157.138'"

and check to make sure that only the key(s) you wanted were added.

[oracle@oracle01:/home/oracle]$ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@192.168.157.137

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.137 (192.168.157.137)' can't be established.

ECDSA key fingerprint is SHA256:l1t05f8Yvogx3vZicVSkMNIdPiboJ7drwTnVblKLS/c.

ECDSA key fingerprint is MD5:c0:38:7b:96:8f:14:3d:80:7b:2d:24:2d:3b:ca:c1:84.

Are you sure you want to continue connecting (yes/no)? yes

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

oracle@192.168.157.137's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'oracle@192.168.157.137'"

and check to make sure that only the key(s) you wanted were added.

[root@oracle01 ~]# ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:abP1A7fcXyhDMX2dN0e5TZ1bj0SoV1axfJvJjKZEaCw root@oracle01

The key's randomart image is:

+---[RSA 2048]----+

|             o.oB|

|        . . ..=+B|

|       E + oo+.B%|

|        o.o .o=+@|

|        S oooo * |

|       . +.*oo . |

|        .  .B o .|

|             + ..|

|                .|

+----[SHA256]-----+

[root@oracle01 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.157.138

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

root@192.168.157.138's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.157.138'"

and check to make sure that only the key(s) you wanted were added.

[root@oracle01 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.157.137

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.137 (192.168.157.137)' can't be established.

ECDSA key fingerprint is SHA256:l1t05f8Yvogx3vZicVSkMNIdPiboJ7drwTnVblKLS/c.

ECDSA key fingerprint is MD5:c0:38:7b:96:8f:14:3d:80:7b:2d:24:2d:3b:ca:c1:84.

Are you sure you want to continue connecting (yes/no)? yes

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

root@192.168.157.137's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.157.137'"

and check to make sure that only the key(s) you wanted were added.

节点2:

[root@oracle02 ~]# su - grid

Last login: Sat Jan  4 12:49:13 CST 2020 on pts/0

[grid@oracle02:/home/grid]$

[grid@oracle02:/home/grid]$ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/home/grid/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/grid/.ssh/id_rsa.

Your public key has been saved in /home/grid/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:vPazYJaAmjXlpedX8AJj4WYTMtNvGMJKaLk7xA7yPrA grid@oracle02

The key's randomart image is:

+---[RSA 2048]----+

|   o .+.o        |

|  + . o=oo       |

| o o ...X+.      |

|o + .+ B.+oo     |

|.= .+ + S.. o    |

|. =+ . + o o     |

| +o.    O .      |

|E o    + +.      |

|   .      oo     |

+----[SHA256]-----+

[grid@oracle02:/home/grid]$ssh-copy-id -i ~/.ssh/id_rsa.pub grid@192.168.157.137

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/grid/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.137 (192.168.157.137)' can't be established.

ECDSA key fingerprint is SHA256:l1t05f8Yvogx3vZicVSkMNIdPiboJ7drwTnVblKLS/c.

ECDSA key fingerprint is MD5:c0:38:7b:96:8f:14:3d:80:7b:2d:24:2d:3b:ca:c1:84.

Are you sure you want to continue connecting (yes/no)? yes

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

grid@192.168.157.137's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'grid@192.168.157.137'"

and check to make sure that only the key(s) you wanted were added.

[grid@oracle02:/home/grid]$ssh-copy-id -i ~/.ssh/id_rsa.pub grid@192.168.157.138

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/grid/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.138 (192.168.157.138)' can't be established.

ECDSA key fingerprint is SHA256:bhmrFpJcz+l4Mb9RdwoWxROsSI4brh+VEws/G5vSREA.

ECDSA key fingerprint is MD5:3b:5f:17:42:44:11:68:6a:70:cf:e5:28:3e:8f:fb:b0.

Are you sure you want to continue connecting (yes/no)? yes

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

grid@192.168.157.138's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'grid@192.168.157.138'"

and check to make sure that only the key(s) you wanted were added.

[grid@oracle02:/home/grid]$

[grid@oracle02:/home/grid]$exit

logout

[root@oracle02 ~]# su - oracle

Last login: Sat Jan  4 12:51:01 CST 2020 on pts/0

[oracle@oracle02:/home/oracle]$ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_rsa.

Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:9AOgZtzCmbOs4Za1k4oVsL46EkxpgxOgfyERWlgEn2E oracle@oracle02

The key's randomart image is:

+---[RSA 2048]----+

|+=E.  .          |

|+= * = .         |

|=.= % . o        |

|oO = = . o       |

|=.= =   S o      |

|oo B o     .     |

| o* +            |

|o+.. .           |

|=o.              |

+----[SHA256]-----+

[oracle@oracle02:/home/oracle]$ssh-copy-id -i ~/.ssh/id_rsa.pub grid@192.168.157.137

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.137 (192.168.157.137)' can't be established.

ECDSA key fingerprint is SHA256:l1t05f8Yvogx3vZicVSkMNIdPiboJ7drwTnVblKLS/c.

ECDSA key fingerprint is MD5:c0:38:7b:96:8f:14:3d:80:7b:2d:24:2d:3b:ca:c1:84.

Are you sure you want to continue connecting (yes/no)? yes

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

grid@192.168.157.137's password:

Permission denied, please try again.

grid@192.168.157.137's password:

Permission denied, please try again.

grid@192.168.157.137's password:

[oracle@oracle02:/home/oracle]$ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@192.168.157.137

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

oracle@192.168.157.137's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'oracle@192.168.157.137'"

and check to make sure that only the key(s) you wanted were added.

[oracle@oracle02:/home/oracle]$ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@192.168.157.138

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.138 (192.168.157.138)' can't be established.

ECDSA key fingerprint is SHA256:bhmrFpJcz+l4Mb9RdwoWxROsSI4brh+VEws/G5vSREA.

ECDSA key fingerprint is MD5:3b:5f:17:42:44:11:68:6a:70:cf:e5:28:3e:8f:fb:b0.

Are you sure you want to continue connecting (yes/no)? yes

/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

oracle@192.168.157.138's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'oracle@192.168.157.138'"

and check to make sure that only the key(s) you wanted were added.

[root@oracle02 ~]# ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:+2GbnG/KaCrnOlXLMhiDg8DYqe1kkc/xYfjtCojpZns root@oracle02

The key's randomart image is:

+---[RSA 2048]----+

|o. o .           |

|o.= o o          |

|.+ = = o         |

|o * = o o        |

| * o + +S.       |

|o o o + +.       |

|.    o +. o      |

| + Eo o .* =.    |

|o.o .*oo. O+.    |

+----[SHA256]-----+

[root@oracle02 ~]#

[root@oracle02 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.157.137

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.137 (192.168.157.137)' can't be established.

ECDSA key fingerprint is SHA256:l1t05f8Yvogx3vZicVSkMNIdPiboJ7drwTnVblKLS/c.

ECDSA key fingerprint is MD5:c0:38:7b:96:8f:14:3d:80:7b:2d:24:2d:3b:ca:c1:84.

Are you sure you want to continue connecting (yes/no)? yes

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

root@192.168.157.137's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.157.137'"

and check to make sure that only the key(s) you wanted were added.

[root@oracle02 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.157.138

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"

The authenticity of host '192.168.157.138 (192.168.157.138)' can't be established.

ECDSA key fingerprint is SHA256:bhmrFpJcz+l4Mb9RdwoWxROsSI4brh+VEws/G5vSREA.

ECDSA key fingerprint is MD5:3b:5f:17:42:44:11:68:6a:70:cf:e5:28:3e:8f:fb:b0.

Are you sure you want to continue connecting (yes/no)? yes

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

root@192.168.157.138's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.157.138'"

and check to make sure that only the key(s) you wanted were added.

10.共享存储

10.1 创建共享存储

该步骤可以用cmd命令也可以用图形界面,本文采用命令行进行添加。

在cmd 中进入 WMware Workstation安装目录,执行命令创建磁盘:

D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 6GB -a lsilogic -t 2 "D:\Virtual Machines\rac12c-sharedisk\ocr.vmdk"

Creating disk 'D:\Virtual Machines\rac12c-sharedisk\ocr.vmdk'

Create: 100% done.

Virtual disk creation successful.

D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 10GB -a lsilogic -t 2 "D:\Virtual Machines\rac12c-sharedisk\fra.vmdk"

Creating disk 'D:\Virtual Machines\rac12c-sharedisk\fra.vmdk'

Create: 100% done.

Virtual disk creation successful.

D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 10GB -a lsilogic -t 2 "D:\Virtual Machines\rac12c-sharedisk\data.vmdk"

Creating disk 'D:\Virtual Machines\rac12c-sharedisk\data.vmdk'

Create: 100% done.

Virtual disk creation successful.

D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 10GB -a lsilogic -t 2 "D:\Virtual Machines\rac12c-sharedisk\mgmt.vmdk"

Creating disk 'D:\Virtual Machines\rac12c-sharedisk\mgmt.vmdk'

Create: 100% done.

Virtual disk creation successful.

D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 10GB -a lsilogic -t 2 "D:\Virtual Machines\rac12c-sharedisk\arch.vmdk"

Creating disk 'D:\Virtual Machines\rac12c-sharedisk\arch.vmdk'

Create: 100% done.

Virtual disk creation successful

注意:12c R1OCR磁盘组最少需要5501MB的空间。

[INS-30515] Insufficient space available in the selected disks.

Cause - Insufficient space available in the selected Disks. At least, 5,501 MB of free space is required.

Action - Choose additional disks such that the total size should be at least 5,501 MB.

10.2 修改配置文件

关闭两台虚拟机,用记事本打开 虚拟机名字.vmx,即打开配置文件,2个节点都需要修改。

添加以下内容,其中,scsix:y 表示第x个总线上的第y个设备

#shared disks configure

disk.EnableUUID="TRUE"
disk.locking = "FALSE"
scsi1.shared = "TRUE"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize= "4096"
diskLib.maxUnsyncedWrites = "0"

scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsil.sharedBus = "VIRTUAL"

scsi1:0.present = "TRUE"
scsi1:0.mode = "independent-persistent"
scsi1:0.fileName = "D:\Virtual Machines\rac12c-sharedisk\ocr.vmdk"
scsi1:0.deviceType = "disk"
scsi1:0.redo = ""

scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.fileName = "D:\Virtual Machines\rac12c-sharedisk\data.vmdk"
scsi1:1.deviceType = "disk"
scsi1:1.redo = ""

scsi1:2.present = "TRUE"
scsi1:2.mode = "independent-persistent"
scsi1:2.fileName = "D:\Virtual Machines\rac12c-sharedisk\fra.vmdk"
scsi1:2.deviceType = "disk"
scsi1:2.redo = ""

scsi1:3.present = "TRUE"
scsi1:3.mode = "independent-persistent"
scsi1:3.fileName = "D:\Virtual Machines\rac12c-sharedisk\arch.vmdk"
scsi1:3.deviceType = "disk"
scsi1:3.redo = ""

scsi1:4.present = "TRUE"
scsi1:4.mode = "independent-persistent"
scsi1:4.fileName = "D:\Virtual Machines\rac12c-sharedisk\mgmt.vmdk"
scsi1:4.deviceType = "disk"
scsi1:4.redo = ""

10.3 重新打开VMware

关闭 VMware Workstation 软件重新打开,此时看到共享磁盘正确加载则配置正确,这里尤其注意第二个节点,2个节点的硬盘配置和网络适配器的配置应该是一样的,若不一样请检查配置。

之后重启虚拟机

[root@oracle01 ~]# fdisk -l | grep /dev/sd

Disk /dev/sdb: 6442 MB, 6442450944 bytes, 12582912 sectors

Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors

/dev/sda1   *        2048      821247      409600   83  Linux

/dev/sda2          821248   209715199   104446976   8e  Linux LVM

Disk /dev/sde: 10.7 GB, 10737418240 bytes, 20971520 sectors

Disk /dev/sdd: 10.7 GB, 10737418240 bytes, 20971520 sectors

Disk /dev/sdf: 10.7 GB, 10737418240 bytes, 20971520 sectors

[root@oracle01 ~]# fdisk -l | grep  "Disk /dev/sd"

Disk /dev/sdb: 6442 MB, 6442450944 bytes, 12582912 sectors

Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors

Disk /dev/sde: 10.7 GB, 10737418240 bytes, 20971520 sectors

Disk /dev/sdd: 10.7 GB, 10737418240 bytes, 20971520 sectors

Disk /dev/sdf: 10.7 GB, 10737418240 bytes, 20971520 sectors

11.设置共享存储

检查UUID,两个节点的UUID必须一致:

[root@oracle01 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdb

36000c290a8f5dd6c3150d2e49bde5183

[root@oracle01 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdc

36000c296c1e9562d242fd56571092a91

[root@oracle01 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdd

36000c292da65f477ffc932927cb35c08

[root@oracle01 ~]# /usr/lib/udev/scsi_id -g -u /dev/sde

36000c29b3a17f0629d504249a7508d24

[root@oracle01 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdf

36000c29b15d777ab379b1b882f9be1be

[root@oracle02 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdb

36000c290a8f5dd6c3150d2e49bde5183

[root@oracle02 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdc

36000c296c1e9562d242fd56571092a91

[root@oracle02 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdd

36000c292da65f477ffc932927cb35c08

[root@oracle02 ~]# /usr/lib/udev/scsi_id -g -u /dev/sde

36000c29b3a17f0629d504249a7508d24

[root@oracle02 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdf

36000c29b15d777ab379b1b882f9be1be

创建磁盘组(udev)

新增的每个磁盘都要用fdisk处理一下(只执行一个节点,另外一个节点会同步),

[root@oracle01 ~]# fdisk /dev/sdg

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0xd89e766a.

Command (m for help): n

Partition type:

p   primary (0 primary, 0 extended, 4 free)

e   extended

Select (default p):

Using default response p

Partition number (1-4, default 1):

First sector (2048-104857599, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599):

Using default value 104857599

Partition 1 of type Linux and of size 50 GiB is set

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@oracle01 rules.d]# pwd
/etc/udev/rules.d
[root@oracle01 rules.d]# cat 99-oracle-asmdevics.rules

KERNEL=="sd*", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c290a8f5dd6c3150d2e49bde5183", RUN+="/bin/sh -c 'mknod /dev/asmdisk_ocr b $major $minor; chown grid:asmadmin /dev/asmdisk_ocr; chmod 0660 /dev/asmdisk_ocr'"

KERNEL=="sd*", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c296c1e9562d242fd56571092a91", RUN+="/bin/sh -c 'mknod /dev/asmdisk_data01 b $major $minor; chown grid:asmadmin /dev/asmdisk_data01; chmod 0660 /dev/asmdisk_data01'"

KERNEL=="sd*", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c292da65f477ffc932927cb35c08", RUN+="/bin/sh -c 'mknod /dev/asmdisk_fra b $major $minor; chown grid:asmadmin /dev/asmdisk_fra; chmod 0660 /dev/asmdisk_fra'"

KERNEL=="sd*", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29b3a17f0629d504249a7508d24", RUN+="/bin/sh -c 'mknod /dev/asmdisk_arch b $major $minor; chown grid:asmadmin /dev/asmdisk_arch; chmod 0660 /dev/asmdisk_arch'"

KERNEL=="sd*", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29b15d777ab379b1b882f9be1be", RUN+="/bin/sh -c 'mknod /dev/asmdisk_data02 b $major $minor; chown grid:asmadmin /dev/asmdisk_data02; chmod 0660 /dev/asmdisk_data02'"

KERNEL=="sd*", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c2975c24408268b1acee46816143", RUN+="/bin/sh -c 'mknod /dev/asmdisk_mgmt b $major $minor; chown grid:asmadmin /dev/asmdisk_mgmt; chmod 0660 /dev/asmdisk_mgmt'"

[root@oracle01 ~]# /sbin/udevadm control --reload-rules
[root@oracle01 ~]# /sbin/udevadm trigger --type=devices --action=change
[root@oracle01 rules.d]# ll /dev/asm*

brw-rw---- 1 grid asmadmin 8, 64 Jan  7 09:59 /dev/asmdisk_arch

brw-rw---- 1 grid asmadmin 8, 32 Jan  7 09:59 /dev/asmdisk_data

brw-rw---- 1 grid asmadmin 8, 32 Jan  7 10:04 /dev/asmdisk_data01

brw-rw---- 1 grid asmadmin 8, 80 Jan  7 10:04 /dev/asmdisk_data02

brw-rw---- 1 grid asmadmin 8, 48 Jan  7 09:59 /dev/asmdisk_fra

brw-rw---- 1 grid asmadmin 8, 80 Jan  7 09:59 /dev/asmdisk_mgmt

brw-rw---- 1 grid asmadmin 8, 16 Jan  7 09:59 /dev/asmdisk_ocr

[root@oracle01 rules.d]# scp 99-oracle-asmdevics.rules root@192.168.157.138:/etc/udev/rules.d/

99-oracle-asmdevics.rules

[root@oracle02 ~]# /sbin/udevadm control --reload-rules

[root@oracle02 ~]# /sbin/udevadm trigger --type=devices --action=change

[root@oracle02 ~]# ll /dev/asm*

brw-rw---- 1 grid asmadmin 8, 64 Jan  7 10:06 /dev/asmdisk_arch

brw-rw---- 1 grid asmadmin 8, 32 Jan  7 10:06 /dev/asmdisk_data01

brw-rw---- 1 grid asmadmin 8, 80 Jan  7 10:06 /dev/asmdisk_data02

brw-rw---- 1 grid asmadmin 8, 48 Jan  7 10:06 /dev/asmdisk_fra

brw-rw---- 1 grid asmadmin 8, 96 Jan  7 10:06 /dev/asmdisk_mgmt

brw-rw---- 1 grid asmadmin 8, 16 Jan  7 10:06 /dev/asmdisk_ocr

12.安装图形界面

[root@orcl12c ~]# yum install tigervnc-server

[root@orcl12c ~]# yum install xdpyinfo

[root@oracle01 ~]# vncserver

You will require a password to access your desktops.

Password:

Verify:

Passwords don't match - try again

Password:

Verify:

Would you like to enter a view-only password (y/n)? y

Password:

Verify:

xauth:  file /root/.Xauthority does not exist

New 'oracle01:1 (root)' desktop is oracle01:1

Creating default startup script /root/.vnc/xstartup

Creating default config /root/.vnc/config

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/oracle01:1.log

[root@oracle01 ~]# export DISPLAY=localhost:0.0

[root@oracle01 ~]# cd 安装目录

[root@oracle01 ~]# ./runInstaller

这里怎么选择看

(1)先在节点一执行/u01/app/oraInventory/orainstRoot.sh,再到节点二执行/u01/app/oraInventory/orainstRoot.sh

(2)然后执行节点一执行/u01/app/grid-install/root.sh,再节点二执行/u01/app/grid-install/root.sh

原因:

由于配置/etc/hosts来解析SCAN,导致未来走DNS来进行SCAN的解析,爆出此错误,可以考虑略掉

解决办法:ping scan ip 如果可以ping通,忽略即可。

[root@oracle01 oraInventory]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

# public ip

192.168.157.137 oracle01

192.168.157.138 oracle02

# Private IP

10.10.10.129 oracle01-priv

10.10.10.130 oracle02-priv

# Virtual IP

192.168.157.237 oracle01-vip

192.168.157.238 oracle02-vip

# Scan IP

192.168.157.139 oracle-cluster

[root@oracle01 oraInventory]# ping -c 4 192.168.157.139

PING 192.168.157.139 (192.168.157.139) 56(84) bytes of data.

64 bytes from 192.168.157.139: icmp_seq=1 ttl=64 time=0.017 ms

64 bytes from 192.168.157.139: icmp_seq=2 ttl=64 time=0.025 ms

64 bytes from 192.168.157.139: icmp_seq=3 ttl=64 time=0.026 ms

64 bytes from 192.168.157.139: icmp_seq=4 ttl=64 time=0.028 ms

--- 192.168.157.139 ping statistics ---

4 packets transmitted, 4 received, 0% packet loss, time 3000ms

rtt min/avg/max/mdev = 0.017/0.024/0.028/0.004 ms

[root@oracle01 oraInventory]# ping -c 4 oracle-cluster

PING oracle-cluster (192.168.157.139) 56(84) bytes of data.

64 bytes from oracle-cluster (192.168.157.139): icmp_seq=1 ttl=64 time=0.019 ms

64 bytes from oracle-cluster (192.168.157.139): icmp_seq=2 ttl=64 time=0.027 ms

64 bytes from oracle-cluster (192.168.157.139): icmp_seq=3 ttl=64 time=0.026 ms

64 bytes from oracle-cluster (192.168.157.139): icmp_seq=4 ttl=64 time=0.029 ms

--- oracle-cluster ping statistics ---

4 packets transmitted, 4 received, 0% packet loss, time 3000ms

rtt min/avg/max/mdev = 0.019/0.025/0.029/0.005 ms

至此,grid安装完成

12.配置磁盘组

[grid@oracle01 ~]$ export DISPLAY=192.168.213.23:0.0

[grid@oracle01 ~]$ asmca

13.安装数据库软件

[oracle@oracle01 database]$ export DISPLAY=192.168.213.23:0.0

[oracle@oracle01 database]$ ./runInstaller

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 2662 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 1767 MB    Passed

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-01-07_01-48-07PM. Please wait ...[oracle@oracle01 database]$

先节点一执行:/u01/app/oracle/product/12.2.0/db_1/root.sh,再执行/u01/app/oracle/product/12.2.0/db_1/root.sh

14.dbca建库:

[grid@oracle01 ~]$ crsctl status res -t

--------------------------------------------------------------------------------

Name           Target  State        Server                   State details

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.ARCH.dg

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.ASMNET1LSNR_ASM.lsnr

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.DATA.dg

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.FRA.dg

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.LISTENER.lsnr

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.MGMT.dg

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.OCR.dg

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.chad

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.net1.network

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

ora.ons

ONLINE  ONLINE       oracle01                 STABLE

ONLINE  ONLINE       oracle02                 STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

1        ONLINE  ONLINE       oracle02                 STABLE

ora.MGMTLSNR

1        ONLINE  ONLINE       oracle02                 169.254.82.84 10.10.

10.130,STABLE

ora.asm

1        ONLINE  ONLINE       oracle01                 Started,STABLE

2        ONLINE  ONLINE       oracle02                 Started,STABLE

3        OFFLINE OFFLINE                               STABLE

ora.cvu

1        ONLINE  ONLINE       oracle02                 STABLE

ora.mgmtdb

1        ONLINE  ONLINE       oracle02                 Open,STABLE

ora.oracle01.vip

1        ONLINE  ONLINE       oracle01                 STABLE

ora.oracle02.vip

1        ONLINE  INTERMEDIATE oracle01                 FAILED OVER,STABLE

ora.qosmserver

1        ONLINE  ONLINE       oracle02                 STABLE

ora.rac.db

1        ONLINE  ONLINE       oracle01                 Open,HOME=/u01/app/o

racle/product/12.2.0

/db_1,STABLE

2        ONLINE  ONLINE       oracle02                 Open,HOME=/u01/app/o

racle/product/12.2.0

/db_1,STABLE

ora.scan1.vip

1        ONLINE  ONLINE       oracle02                 STABLE

--------------------------------------------------------------------------------

Centos 7安装Oracle12c RAC相关推荐

  1. Linux命令行安装Oracle12c

    文章目录 1.下载Oracle12c 2.配置主机名和IP的映射 3.Oracle安装的先决条件 3.1手动设置 3.1.1配置内核参数 3.1.2限制oracle用户资源使用 3.1.3安装依赖软件 ...

  2. 使用 VMware Server 在 Oracle Enterprise Linux 上安装 Oracle RAC 10g

    DBA:Linux   下载 VMware Server 1.0.1 Oracle Enterprise Linux 4,Kernel 2.6.9-42.0.0.0.1.ELsmp 适用于 Linux ...

  3. Centos8安装Oracle12C未能初始化安装程序

    缺少Java环境 dnf install java INS-10102未能初始化安装程序 dnf install libnsl解决缺少libnsl package INS-13001此操作系统不支持O ...

  4. 【安装篇】- 基于 VMWARE Oracle Linux7.9 安装 Oracle19c RAC 详细配置方案

    作者 | yanwei 来源 | 墨天轮 https://www.modb.pro/db/95684 大家好,我是 JiekeXu,很高兴又和大家见面了,今天和大家一起来看看 Linux7.9 安装 ...

  5. 安装Oracle RAC数据库前的准备工作

    安装Oracle RAC数据库 1. 安装前的系统配置需求 安装Oracle Rac数据库需要的组件可以分为软硬件两部分,下面是一个软硬件推荐配置: 为了方便安装RAC数据库,在安装操作系统时,建议选 ...

  6. Centos7 静默安装 Oracle RAC 11gR2

    vSphere EXSi + CentOS 7.4 静默安装 Oracle RAC (11gR2) 安装之前,先总结一下安装Oracle RAC的注意事项: 如果是在vSphere EXSi环境中搭建 ...

  7. CentOS 8 安装图解

    继 RHEL 8 发布之后,CentOS 社区也发布了让人期待已久的 CentOS 8,并发布了两种模式: CentOS stream:滚动发布的 Linux 发行版,适用于需要频繁更新的开发者 Ce ...

  8. centOS 自动安装php

    centos下安装php #yum install -y php 这个只安装PHP 建议安装运行库及MySQL的支持 #yum install -y php php-devel php-mysql 如 ...

  9. Centos下安装mysql 总结

    一.MySQL安装 Centos下安装mysql 请点开:http://www.centoscn.com/CentosServer/sql/2013/0817/1285.html 二.MySQL的几个 ...

  10. 安装oracle后在cmd,在WINDOWS上安装ORACLE RAC的注意事项

    在WINDOWS上安装ORACLE RAC的注意事项 1.检查防火墙和杀毒软件 如果不关掉防火墙,在安装CRS时,在"Oracle Clusterware Configuration Ass ...

最新文章

  1. 网管日志-06.08.14
  2. 廖雪峰python教程书-Python 爬虫:把廖雪峰的教程转换成 PDF 电子书
  3. py2neo 基本用法
  4. ubuntu如何安装python36_在Ubuntu 16.04下安装Python3.6,ubuntu1604,Python36
  5. 在线教育、精品课程、直播课、课程交流、历史观看、订单、收藏、余额、推荐、关注、购买课程、充值、产品设计、线上教育、视频课程、教育app、在线课堂、网络教学、远程教育、教学辅导、学习平台、K12教育
  6. Java-Runtime
  7. 2022牛客寒假算法基础集训营2 签到题7题
  8. 解决conda install速度慢
  9. 最长单调递增子序列及思维题——动态规划
  10. 11.sql条件查询
  11. 这一切,只因心中有梦
  12. 【树莓派不吃灰】基础篇⑲ 搭建usb摄像头MJPG-streamer图片流监控,支持远程视频监控访问
  13. RabbitMQ从入门到实战(图文并茂)
  14. android espresso跨程序,Android中使用Espresso进行UI测试
  15. 英文版本Ubuntu下添加中文拼音输入法: Chinese (Intelligent Pinyin)
  16. 数据挖掘的十大经典算法
  17. Python基础之线程(Thread)
  18. Open×××优化之-巨型帧
  19. 【云原生Docker系列第三篇】Docker网络模式(在失去的所有人里,我最怀念自己 )
  20. selenium实现QQ空间和b站这些网站的模拟登录

热门文章

  1. linux分段加载程序_Linux的分段机制
  2. hive:函数:sort_array函数解决collet_list列表排序混乱问题
  3. 旧项目归档:旅游年卡-旅游直通车-微信二级分销推广会员-汽车租赁-金币提现-司机乘务管理-景点线路乘车预约
  4. matlab统计字符个数,Matlab函数统计字符串中莫个字母含量
  5. 《SEM长尾搜索营销策略解密》一一2.7 经济基础决定上层建筑,文化也是
  6. 龙之谷linux一键端1网段手机可玩,龙之谷手游一键端怎么用
  7. 打印照片显示rpc服务器,打印照片时出现了“RPC服务器不可用”的错误怎么办?...
  8. 计算机设备管理没有打印机,win7电脑找不到打印机设备怎么办
  9. H264里面描述符的意思--------x264学习笔记ByMK
  10. 解决数据库日志文件过大的问题