安装过程中校验这步的时候出现 swap 警告,问题如下图
安装oracle12c swap不足_3c
如图,注意 Expected Value 的需求,然后进行下列操作:

下面以2G为例操作:
如果你本来就又swap(不是0),也可以直接按下面的步骤进行,重新设置是没有问题的。

1、查看当前内存
[root@oracle ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:          31753        2252       16279          30       13220       29047
Swap:             0           0           0

2、创建用于交换分区的文件:增加2G大小的交换分区,count等于想要的块大小
[root@oracle ~]# dd if=/dev/zero of=/home/swap bs=1024 count=2048000
2048000+0 records in
2048000+0 records out
2097152000 bytes (2.1 GB) copied, 5.22593 s, 401 MB/s

3、设置交换分区文件
[root@oracle ~]# mkswap /home/swap
Setting up swapspace version 1, size = 2047996 KiB
no label, UUID=2727ee12-bf8c-492a-8e02-83e75c1a5186

4、立即启用交换分区文件
[root@oracle ~]# swapon /home/swap
swapon: /home/swap: insecure permissions 0644, 0600 suggested.

5、再查看内存情况,swap就出来了
[root@oracle ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:          31753        2254       14222          30       15276       29046
Swap:          1999           0        1999
[root@oracle ~]# 

如果想使得开机自启动,想要修改文件/etc/fastb 修改swap行

#
# /etc/fstab
# Created by anaconda on Sat Sep 28 03:57:31 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9e3c64b5-d49a-4d5f-b73b-f60a58b4c50d /                       xfs     defaults        0 0
UUID=7d908518-e78b-48c9-ab7f-f75cd4b52467 /boot                   xfs     defaults        0 0
UUID=A2A5-9073          /boot/efi               vfat    defaults,uid=0,gid=0,umask=0077,shortname=winnt 0 0
/dev/mapper/cl-data     /u01                   xfs     defaults        0 0
/home/swap   swap                    swap    defaults        0 0

其他:
最开始的图上,看到很多其他参数的配置也不符合推荐值,这些值在不同的硬件配置的服务器上会有差异,逐个查看修改即可,参数内容在Linux系统配置文件 /etc/sysctl.conf 中,如下是我的文件内容示例:

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time = 120

net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2

net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2

kernel.sysrq = 1

net.core.somaxconn = 512
vm.max_map_count = 262144

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 3251512
kernel.shmmax = 16647741440
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

(END)