5.13.5 Increasing the Size of the Swap Area

This procedure describes how to increase the amount of swap configured in a user domain.

  1. Verify there is available space in the volume group VGExaDb using the vgdisplay command.
    # vgdisplay VGExaDb -s
    

    The following is an example of the output from the command:

    "VGExaDb" 53.49 GiB [42.00 GiB used / 11.49 GiB free]
    

    If the command shows that there is less than 1 GB of free space, then neither the logical volume nor file system should be extended. Maintain at least 1 GB of free space in the VGExaDb volume group for the LVM snapshot created by the dbnodeupdate.sh utility during an upgrade. If there is not sufficient free space in the volume group, then add a new disk to LVM.

  2. Create a new logical volume of the size to increase swap space using the lvcreate command.

    In the following example, a new 8 GB logical volume named LVDbSwap2 is created.

    # lvcreate -L 8G -n LVDbSwap2 VGExaDb
    
  3. Setup the new logical volume as a swap device with a unique label, such as SWAP2, using the mkswap command. The unique label is a device LABEL entry that is currently unused in the /etc/fstab file.
    # mkswap -L SWAP2 /dev/VGExaDb/LVDbSwap2
    
  4. Enable the new swap device using the swapon command.
    # swapon -L SWAP2
    
  5. Verify the new swap device is enabled using the swapon command.
    # swapon -s
    

    The following is an example of the output from the command:

    Filename         Type            Size      Used     Priority
    /dev/dm-3        partition       8388604   306108   -1
    /dev/dm-4        partition       8388604   0         -2
    
  6. Edit the /etc/fstab file to add the new swap device by copying the existing swap entry, and then changing the LABEL value in the new entry to the label used to create the new swap device. In the following example, the new swap device was added to the /etc/fstab file as LABEL=SWAP2.
    # cat /etc/fstab
    LABEL=DBSYS   /                       ext4    defaults        1 1
    LABEL=BOOT    /boot                   ext4    defaults,nodev        1 1
    tmpfs         /dev/shm                tmpfs   defaults,size=7998m 0
    devpts        /dev/pts                devpts  gid=5,mode=620  0 0
    sysfs         /sys                    sysfs   defaults        0 0
    proc          /proc                   proc    defaults        0 0
    LABEL=SWAP    swap                    swap    defaults        0 0
    LABEL=SWAP2   swap                    swap    defaults        0 0
    LABEL=DBORA   /u01                    ext4    defaults        1 1
    /dev/xvdb     /u01/app/12.1.0.2/grid  ext4    defaults        1 1
    /dev/xvdc       /u01/app/oracle/product/12.1.0.2/dbhome_1       ext4   defaults        1 1