Monday, January 28, 2013

Install Oracle XE 11g on AWS EC2 micro instance of Amazon Linux

Installing Oracle XE on AWS is little bit tricky. I was ready spend lot of time on it but found good step by step manual by Håvard Kristiansen. And it will be great if all my problems was solved but I need also latest version of APEX that also included in XE pack. Here you can find what problems I met during APEX upgrade to 4.2 and how I can solve them.


Preparing for upgrade

You have downloaded and unzipped APEX 4.2 on your AWS instance in /u01/download/apex folder

Oracle memory management

Now you should know that APEX update procedure will spent 4hrs!!! on AWS micro instance and if you have default configuration with 2Gb swap (as described in Harvard manual) you will get insufficient SHARED_POOL_SIZE error at the end of this 4 hours :). To solve this you must change Oracle memory management configuration to increase SHARED_POOL_SIZE.

Configure tmpfs

Remount tmpfs to increase it's size because by default it has RAM/2 size and it's not enougth to increase Oracle MEMORY_MAX_TARGET

  • sudo umount tmpfs
  • sudo mount -t tmpfs shmfs -o size=1500m /dev/shm

Now we should change /etc/fstab to save this effect and change line with tmpfs mount to look like:

  • tmpfs       /dev/shm    tmpfs   defaults,size=1500m        0   0

Even you do so size=1500m parameter will be ignored by sysinit. To override this we need remove -f parameter by these commands:

  • sudo cp /etc/rc.d/rc.sysinit /etc/rc.d/rc.sysinit.bck
  • sudo sed -i 's/-f \/dev\/shm/\/dev\/shm/g' /etc/rc.d/rc.sysinit

Now we ready to change Oracle memory parameters. All memory sizes you can change by your own wish.

  • sqlplus sys/<sys_password> as sysdba
  • create spfile from pfile;
  • ALTER SYSTEM SET MEMORY_MAX_TARGET=1G SCOPE=SPFILE;
  • ALTER SYSTEM SET MEMORY_TARGET=1G SCOPE=SPFILE;
  • ALTER SYSTEM SET SGA_TARGET=500M SCOPE=SPFILE;
  • ALTER SYSTEM SET SHARED_POOL_SIZE = 300M;
  • shutdown immediate;
  • startup;

Upgrade process

That's all. Now you can start upgrade process follow by official oracle manual.