Skip to main content

Running APEX on 11gR2 using Sun's (Oracle's?) VirtualBox

Today I decided that I needed an environment to play with the latest and greatest Oracle RDBMS : 11gR2. This version is only available for Unix platforms, so I needed a virtual environment to get that working on my laptop - running on XP.
You can pick any kind of virtualization software, but, due to the recent take-over of Sun by Oracle, I decided to go for what's currently known as Sun's VirtualBox. I guess this product will re-branded to Oracle's VirtualBox somewhere soon.
So what are the steps:

1. Download VirtualBox from http://www.virtualbox.org/ and run the installer.

2. Start VirtualBox, click 'New' and enter a Name, Operating and Version for the Virtual machine. This is gonna be a 100% Oracle thing, so I installed Oracle Enterprise Linux (OEL).

3. Oracle 11gR2 needs 1Gb of RAM, so set the memory size to 1024 - you can change this afterwards.

4. Create a new boot harddisk with dynamically expanding storage.









5. On the next page you have to set the 'size of the virtual hard disk'. This is not the initial size, but the maximum to which the harddisk can be expanded. So don't take it too small, because adding or expanding a hard disk to a current installation is not so easy...(as I have experienced).














6. Next start the VM and install OEL from a DVD or ISO download. I installed it with all defaults, with support for Software Development and Webserver. Honestly I have no idea what is added by checking these features, but I checked it just because that's what I want to use it for.

7. Now take a break - or do something else - while OEL is being installed... it takes a while.










8. After installation you have to configure OEL. You can accept all defaults, I just changed the settings for the Firewall to accept HTTP request on port 8080 - the one we're going to use for running APEX.













9. Next add a Shared Folder in VirtualBox - a folder that can be used by both the host and the guest OS. To use it within the Linux environment: login as root, mount the VBoxGuestAdditons.iso (by pressing the Host-D key, whereby Host is the right Ctrl key by default), copy VBoxLinuxAddtions-x86.run to the Desktop and run it. Restart the VM when that's finished.

10. Mount the added shared drive: sudo mount -t vboxsf Shared /media/shared






11. In the Host OS: Download the two 11gR2 disks, copy them to c:\shared, unzip them - of course you can do that in the Guest system also, but not while you're installing it ;-). Install 11gR2 on the Guest OS following the steps in the documentation. Again some time for a good cup of coffee....









12. 11gR2 is shipped with APEX, so it just takes two steps to get it running:
Open up the EPG using port 8080 : Start SQLPlus, login as SYS, exec dbms_xdb.sethttpport(8080) and set a password for the APEX Admin user by executing the apxchpwd script (located in /home/oracle/app/oracle/product/11.2.0/dbhome_1/apex for a default installation). Now you can open up the browser, navigate to http://localhost:8080/apex/apex_admin and off you go.

13. Now where almost there...because now we want to use the database in the VM from the browser in the Host OS. Therefore we need to set up Port Forwarding in VirtualBox. Shutdown the Guest VM and VirtualBox. Run these three commands:
vboxmanage setextradata OEL "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apex/HostPort" 8080
vboxmanage setextradata OEL "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apex/GuestPort" 8080
vboxmanage setextradata OEL "VBoxInternal/Devices/pcnet/0/LUN#0/Config/Apex/Protocol" TCP
Startup VirtualBox and the VM. If the database doesn't start, login as the oracle user, set the environment (. /usr/local/bin/oraenv), start the listener (lsnrctl start) and start the database (sqlplus sys as sysdba and enter 'startup').
Now we can use the APEX on Oracle 11gR2 in a Oracle Enterprise Linux VirtualBox from an XP Host OS. And it runs very fast....!!

One final remark: If you've got an Oracle instance running on your Host OS, http://localhost:8080/apex will open up the login page from your Host. So you either have to shut that down, or forward another HostPort (like 8081).

Comments

Hi Roel,

“… it runs very fast....!!”
Could you give me some specs on your host system, so I can compare it to mine? Just to decide if it’s worthwhile to try an installation with VirtualBox on my laptop. I already have successfully configured a VirtualBox with XP and XE database and Apex which performed reasonably.

Regards,
Christian
Roel said…
Hi Christian

I am running it on a Lenovo Thinkpas T61 with XP-SP2. 2 CPU's 2Gb RAM.
I assigned 1CPU an 1Gb of RAM to the VM.

Roel
Mark Lancaster said…
Nice post Roel.

I'll give it a go this weekend.

Mark
Marco said…
Need to toss in my kudos and support for VirtualBox as well. Been using it for a year, with more satisfaction than VMWare (mostly due to its simplicity and stability).

Hope Oracle continues Sun's good work.

Marco
Martin D'Souza said…
Hi Roel,

Thanks for the excellent post. Just some install notes that I had to go through that may be helpful to others:

Virtual Box: I changed the network settings to "Bridged Network" so that I could Putty/SSH into the machine to do Linux updates

Missing Packages. When I went to install some packages were missing. I had to update the YUM repository. The following article helped out a lot: http://thuannvn.blogspot.com/2009/06/yum-repository-setup-by-oracle.html

# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-el5.repo


Enable the appropriate repository by editing the yum configuration file

* Open the yum configuration file in a text editor
* Locate the section in the file for the repository you plan to update from, e.g. [el4_u6_base]
* Change enabled=0 to enabled=1
Martin D'Souza said…
Hi Roel,

Thought this might help other users for the Oracle Installation instructions: http://www.oracle.com/technology/pub/articles/smiley-11gr1-install.html

Martin

Popular posts from this blog

Filtering in the APEX Interactive Grid

Remember Oracle Forms? One of the nice features of Forms was the use of GLOBAL items. More or less comparable to Application Items in APEX. These GLOBALS where often used to pre-query data. For example you queried Employee 200 in Form A, then opened Form B and on opening that Form the Employee field is filled with that (GLOBAL) value of 200 and the query was executed. So without additional keys strokes or entering data, when switching to another Form a user would immediately see the data in the same context. And they loved that. In APEX you can create a similar experience using Application Items (or an Item on the Global Page) for Classic Reports (by setting a Default Value to a Search Item) and Interactive Reports (using the  APEX_IR.ADD_FILTER  procedure). But what about the Interactive Grid? There is no APEX_IG package ... so the first thing we have to figure out is how can we set a filter programmatically? Start with creating an Interactive Grid based upon the good o...

apex_application.g_f0x array processing in Oracle 12

If you created your own "updatable reports" or your custom version of tabular forms in Oracle Application Express, you'll end up with a query that looks similar to this one: then you disable the " Escape special characters " property and the result is an updatable multirecord form. That was easy, right? But now we need to process the changes in the Ename column when the form is submitted, but only if the checkbox is checked. All the columns are submitted as separated arrays, named apex_application.g_f0x - where the "x" is the value of the "p_idx" parameter you specified in the apex_item calls. So we have apex_application.g_f01, g_f02 and g_f03. But then you discover APEX has the oddity that the "checkbox" array only contains values for the checked rows. Thus if you just check "Jones", the length of g_f02 is 1 and it contains only the empno of Jones - while the other two arrays will contain all (14) rows. So for ...

Stop using validations for checking constraints !

 If you run your APEX application - like a Form based on the EMP table - and test if you can change the value of Department to something else then the standard values of 10, 20, 30 or 40, you'll get a nice error message like this: But it isn't really nice, is it? So what do a lot of developers do? They create a validation (just) in order to show a nicer, better worded, error message like "This is not a valid department".  And what you then just did is writing code twice : Once in the database as a (foreign key) check constraint and once as a sql statement in your validation. And we all know : writing code twice is usually not a good idea - and executing the same query twice is not enhancing your performance! So how can we transform that ugly error message into something nice? By combining two APEX features: the Error Handling Function and the Text Messages! Start with copying the example of an Error Handling Function from the APEX documentation. Create this function ...