Tips done on Ubuntu 8.10, virtualized on a Mac intel. Need to do this for Oracle XE : by default my swap space was set to 395mb but i need at least 1004mb swap space for Oracle XE

1. Create a large empty file :

sudo dd if=/dev/zero of=/swap_file bs=1M count=1000

Replace 1000 by the space desired in MB. You change the location of swap_file (here located in / )

2. Secure swap space , so users could not read contents

sudo chown root:root /swap_file
sudo chmod 600 /swap_file

3. Turn the file into swap :

sudo mkswap /swap_file

4. Turn it on :

sudo swapon /swap_file

5. Make it turn on at every bootup, edit /etc/fstab

sudo gedit /etc/fstab

Add this line at end of the file

/swap_file       none            swap    sw              0       0

source: ubuntuforums