Installing Oracle XE 11g r2 on Amazon micro-instance (Oracle Linux 5.4)

April 4, 2011  |  apex, cloud, dba, linux

Amazon EC2 Micro instances provide 613 MB of memory and support 32-bit/64-bit platforms Linux or Windows. Micro instances price starts at $0.02 per hour for Linux and $0.03 per hour for Windows. Oracle XE 11g release 2 (beta) was launched on April 1st 2011 and it’s available for Linux 64 bit and Windows 32 bit. The new XE increased the max user data from 4GB to 11GB but still only uses a max of 1GB of memory, even if you have more available. Lets get started…

1 – Launch a micro-instance on your AWS Console (I’ve used an OEL5.4-x86_64 ami-e9664c9d instance)

2 – Add swap space, in my case I’ve add a 2GB swapfile (Oracle Database 11gExpress Edition requires 1230 MB of swap space… check yours with “free” command)

[root@ip oracle]$ dd if=/dev/zero of=/swapfile bs=1024 count=2048000
[root@ip oracle]$ mkswap /swapfile
[root@ip oracle]$ swapon /swapfile
# add the following line to /etc/fstab to enable swap at boot time
/swapfile swap swap defaults 0 0

3 – Get Oracle XE 11g (http://www.oracle.com/technetwork/database/express-edition/downloads/index.html) and send it to the server. What I’ve done was download it to my MAC and after that i’ve put the file on my public Dropbox folder. It was instantly!!!… Dropbox is intelligent enought to find that if someone already have this file shared it won’t be uploaded again! It was immediatly available.

4 – At your server download the Oracle XE from your Dropbox (your link may be different) and unzip it.

[root@ip root]$ wget http://dl.dropbox.com/u/123456/linux.x64_11gR2_OracleXE.zip
[root@ip root]$ unzip linux.x64_11gR2_OracleXE.zip

5 – Check that you have the required linux programs installed.

[root@ip root]$ yum install glibc make binutils gcc libaio

6 – Install and configure it.

[root@ip root]$ rpm -i oracle-xe-11.2.0-0.5.x86_64.rpm
[root@ip root]$ /etc/init.d/oracle-xe configure

Oracle XE 11g r2 sets the ORACLE_HOME to /u01/app/oracle/product/11.2.0/xe and the datafiles, fra, admin dirs complies with the OFA. Take a look:

[root@ip oracle]$ pwd
/u01/app/oracle
[root@ip oracle]$ ls -lht
total 40K
drwxrwxr-x 4 oracle oinstall 4.0K Apr  4 16:29 diag
drwxr-x--- 4 oracle oinstall 4.0K Apr  4 16:29 admin
drwxr-x--- 3 oracle oinstall 4.0K Apr  4 16:29 flash_recovery_area
drwxr-xr-x 3 oracle oinstall 4.0K Apr  4 16:29 oradata
drwxr-xr-x 3 oracle dba      4.0K Apr  4 16:28 product

7 – Connect to the database with SQLPlus  (set environment) and enable APEX remote access (The APEX start page is http://:8080/apex/f?p=4950)

[root@ip root]$ su - oracle
[oracle@ip oracle]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
[oracle@ip oracle]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@ip oracle]$ export ORACLE_SID=XE
[oracle@ip oracle]$ sqlplus "/ as sysdba"
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Beta
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

The memory default settings shows that Oracle is running with a small memory footprint… only 160MB… Sweet to run on cheap Micro-instances for development purposes!

SQL> show sga
Total System Global Area  162836480 bytes
Fixed Size		    2224632 bytes
Variable Size		   96472584 bytes
Database Buffers	   58720256 bytes
Redo Buffers		    5419008 bytes

Done! Enjoy it…


4 Comments


  1. Thankyou ^_^

  2. for swap, needed 2097152 (1024*1024*2) instead of 2048000. Oracle rpm would not install without it.

    Also, I used a Cent OS 5.6 install which did not have /etc/hosts:
    127.0.0.1 localhost.localdomain localhost

    Oracle apex and listener would not work without it.

  3. Awesome writeup, thank you!

    For swap, I used:

    # dd if=/dev/zero of=/swapfile bs=1048576 count=1193

    This matches the initial error message I received when trying to do the rpm install (must have 1193MB swap).

    I had to change the host name in tnsnames.ora & listener.ora to localhost. Not sure if this is a firewall issue or what, but I’m only testing locally, so this works out OK.

    Finally, normally I can connect from my own account w/:

    $ sqlplus sys@XE as sysdba

    but this install refuses it. Connecting from the ‘oracle’ account works fine as you describe above.

    • On the third point, I realized I need to be in the ‘dba’ Unix group for this to work. All better.

      Didn’t mention initially, thanks for pointing out how you used DropBox. I had to sling 300MB .zip files around via DSL modem. Not good. DropBox seems like the way to go.

Leave a Reply