How to handle insufficient SWAP space when installing Oracle
When installing Oracle, the installation may fail due to insufficient swap space allocated. The procedure is as follows:
The SWAP space is 2 GB.
[Root @ linux01 oracle] # free
Total used free shared buffers cached
Mem: 2039004 1207260 831744 0 22668 833660
-/+ Buffers/cache: 350932 1688072
Swap: 2097144 0 2097144
Use the dd command to create a temporary swap file. The size is 1 Gb.
[Root @ linux01 oracle] # dd if =/dev/zero of =/home/oracle/swap. file bs = 1024 k count = 1024
1024 + 0 records in
1024 + 0 records out
1073741824 bytes (1.1 GB) copied, 16.711 s, 64.3 MB/s
2. Use the mkswap command to format the temporary swap file created in step 1.
[Root @ linux01 oracle] # mkswap/home/oracle/swap. file
Mkswap:/home/oracle/swap. file: warning: don't erase bootbits sectors
On whole disk. Use-f to force.
Setting up swapspace version 1, size = 1048572 KiB
No label, UUID = 99e682db-bb37-444a-a8db-ee742a71b5d3
3. Use the swapon command to make the swap file take effect, as shown below:
[Root @ linux01 oracle] # swapon/home/oracle/swap. file
4. Run the free command or grep swap/proc/meminfo to check the effect of swap addition, as shown below:
[Root @ linux01 oracle] # free
Total used free shared buffers cached
Mem: 2039004 1955200 83804 0 12348 1569000
-/+ Buffers/cache: 373852 1665152
Swap: 3145712 0 3145712
[Root @ linux01 oracle] # grep Swap/proc/meminfo
SwapCached: 0 kB
SwapTotal: 3145712 kB
SwapFree: 3145712 kB
5. If the device is valid permanently, you need to write the newly added swap device file to the fstab file so that the device automatically takes effect after each server restart.
Echo "/home/oracle/swap. file swap defaults 0 0">/etc/fstab
6. Disable SWAP on a temporary Device
[Root @ linux01 oracle] # swapoff/home/oracle/swap. file
[Root @ linux01 oracle] # free
Total used free shared buffers cached
Mem: 2039004 1955324 83680 0 12440 1569460
-/+ Buffers/cache: 373424 1665580
Swap: 2097144 0 2097144
We do not recommend that you allocate enough swap space when installing the system. However, if this problem occurs, it is also a very effective solution.