The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Tuesday, October 27, 2015

Installing Oracle XE on Virtual Box and Accessing it on Mac OS X Yosemite

Oracle XE  is not yet supported on Mac OS X and if you are planning to do any development and required a local DB then you are pretty much out of luck to install it.

Solution?  Install Virtual Box with linux or windows machine and run oracle XE on it. Access it locally from your host os Yosemite in this case. There are two major steps in this.

  1. Installing Virtual box, guest OS and Oracle XE
  2. Configuring it to access Oracle XE from the Mac Yosemite. 

Step 1

  1.  Download latest version of virtual box
  2. For the guest OS and DB either you can individual download the images and install all that or you can use one of the Oracle prebuilt images. They will be a bit larger in size due to some more stuff but will do the job as one step solution. I used Downloads and Instructions
  3. Once you have a everything installed and the image imported you will need to make sure that you can run your XE DB in the guest OS first. Do the following:
    1. from the Applications menu click on "Oracle XE DB --> Start Oracle Database". Wait for few min.
    2. From the same place click on "Run SQL lite terminal"
    3. In the terminal type  connect / sysdba  and this should connect if DB is up and running. 
    4. by default HR schema is installed and locked. So run the following 
      1. alter user hr account unlocked identified by hr
    5. This should do the job and will ensure that it all works fine.

Step 2

  1. Click on the top right corner and enable network on your guest OS (eth0 by default)
  2. Go to Virtual box and installed image settings. Click Network tab and click on Port Forwarding.
  3. Add a new entry here marking as: Host ip: port 1522 guest ip: blank port: 1521 and do ok.
  4. This should now connect to the XE running in guest OS as  hr/hr@localhost:1522:XE (service name)
NOTE: The pre-built image I used in step 1 has the port 1521 unblocked by default. If you are manually doing the step 1 then you would need to unblock the 1521 port by guest OS firewall. You can do that following: http://www.thatjeffsmith.com/archive/2014/03/connecting-to-oracle-from-your-host-to-a-virtualbox-oel-guest/

No comments: