Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
Author : Tejas Pillai (tpillai@gmail.com)
Problem:
I am using Macbook Pro (OS- Mac OS X 10.07 - Lion).
I need Oracle Database 11g Release 2 Enterprise Edition for development/testing purpose at home.There is no package available for Mac in Oracle 11 .Refer to Oracle site . Only Oracle Database 10g Release 2 is officially supported.
http://www.oracle.com/technetwork/topics/macos/whatsnew/index.html
Solution: There is a way to solve the above problem :
1. Get Oracle VM VirtualBox as VM.
2. Get Pre-built 11.2 Database VM
3. Use Port forwarding to Connect from Host System ( Mac OS ) to VM
Host OS:
For setting up Virtual Machine (also called Guest Machine) follow the steps 2 & 3.
1. Get Oracle VM VirtualBox as VM.
2. Get Pre-built 11.2 Database VM
Use the below link to download the VM software as described in the “Blue “ text.
http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html
Step 1. Download and install Oracle VM VirtualBox on your host system.
Step 2. Download the files (the use of a download manager is highly recommended):
Oracle Developer Day.ova (4,345,710,592 bytes, md5sum: 2754e276bf3469b17402ba253ce4f943)
It will take good amount of time to download the above software. You can continue once the donloadis complete.
< refer to below Screen shots for VM settings >
Step 3. Import your VM: File > Import Appliance to launch Appliance Import Wizard. Click Choose...to browse to the directory you re-assembled all the files in and select the Oracle Developer Day.ova then click Next> to begin importing the virtual machine. It will prompt you to agree to the appropriate developer licenses while importing. You will see 'Oracle Developer Days (Powered Off)' when it is finished importing.
VM Settings are displayed below:
Step 4. Test your VM: Once the import has completed, double-click the OTN Developer Days VM. Click OK to close the Virtualbox Information dialogs. When you get to the Enterprise Linux 5 screen you can now login. (Username and password is oracle.) Allow the process to complete; it is ready when you see a terminal window, which you can close. Once you are finished working in the guest VM you can shut it down via System > Shut Down; this will return the guest VM to the Powered Off state.
Click “start” icon in Virtual box
enter “oracle” as username
password is “oracle”
open the firefox browser
click on “sql developer link”
click on “Getting Started with Oracle SQL Developer” link
Notice the below lines mentioned in the “getting started with Oracle Sql Developer Page “.
1.Install Oracle SQL Developer 3.0 from OTN. Follow the readme instructions here.
2 .Install Oracle Database 11g with the Sample schema.
3.Unlock the HR user. Login to SQL Developer as the SYS user and execute the following command:
alter user hr identified by hr account unlock;
We do not have to perform the steps 1 & 2 .
Sql Developer is already pre-installed.
let us try to connect to “hr” user ,But first we need to unlock it.
check for oracle installation using “lsnrctl status” command.
Note : Service name = orcl
check Service using below commad.
ps auxww | grep pmon | grep -i orcl
unlock user “hr”
login to sqlplus
reference : http://stackoverflow.com/questions/740119/default-passwords-of-oracle-11g
use SQL Developer with “hr/hr” to connect to the DB
So far we are able to connect to the ORacle 11 g Db on
Oracle Linux. But in order to access it from Host Machine (Mac OS) , we need to do Port Forwarding as shown below.
3. Use Port forwarding to Connect from Host System
( Mac OS ) to VM
Port Forwarding on Virtual box:
click on “port forwarding”
We have enabled 2 ports 8888 & 1521.
1521 is for connecting to oracle DB from Host machine.
Navigate to below URL on VM/Guest machine
http://localhost:8888/apex/f?p=4550:1:0
Check if port forwading is working by accessing the same url from host machine.
Wow, we are able to connect to Guest Machine (Oracel VM ) from Host Machine (Mac OS) and get the port forwardng to work.
Now one should be able to connect to Oracle DB as well from Host System.
Access DB from Host Machine
Above Screenshot displays Database explorer of Eclipse to browse the DB.
Cool , we are able to connect to Oracle 11g running on Oracle VM via Mac OS.
Sharing Files between Host Machine & Guest Machine
Setting up Shared folder
login as root using su
create a mount point
mkdir /tmp/tejas_mac/shared_folder
Create a shared folder “Mercury” as shown below
Now use the below command to mount the folder on mount point.
Copy files from vm to guest:
Suppose we need to copy ojdbc jar from oracle in Vm to Host Machine.
find the jar : find / -type f -name "ojdbc*.jar" 2> /dev/null
copy to /tmp/tejas_mac_shared_folder
Note in the Host OS ( mac ) ,the jar file is now available