accessing oracle 11 g on mac os (10.7.5) using oracle virtual box

21
Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box Author : Tejas Pillai ([email protected]) 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 Prebuilt 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

Upload: tejas-pillai-

Post on 14-Jun-2015

4.196 views

Category:

Technology


2 download

DESCRIPTION

Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

TRANSCRIPT

Page 1: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

Accessing Oracle 11 g on Mac OS (10.7.5) usingOracle Virtual Box

Author : Tejas Pillai ([email protected])

Problem:I am using Macbook Pro (OS­ Mac OS X 10.07 ­ Lion).I need Oracle Database 11g Release 2 Enterprise Edition fordevelopment/testing purpose at home.There is no packageavailable for Mac in Oracle 11 .Refer to Oracle site . Only Oracle Database10g 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 VM3. 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

Page 2: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

steps 2 & 3.1. Get Oracle VM VirtualBox as VM.2. Get Pre-built 11.2 Database VMUse 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

Verify that you have met the required system requirements mentioned inthe above link.

Refer to “Setup Section “ described in above link

Step 1. Download and install Oracle VM VirtualBox on your host system.

Step 2. Download the files (the use of a download manager is highlyrecommended):

Oracle Developer Day.ova (4,345,710,592 bytes, md5sum:2754e276bf3469b17402ba253ce4f943)

It will take good amount of time to download the above software. You cancontinue 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 andselect the Oracle Developer Day.ova then click Next> to begin importing the virtualmachine. It will prompt you to agree to the appropriate developer licenses whileimporting. You will see 'Oracle Developer Days (Powered Off)' when it is finishedimporting.

VM Settings are displayed below:

Page 3: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
Page 4: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
Page 5: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
Page 6: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

Step 4. Test your VM: Once the import has completed, double­click the OTNDeveloper Days VM. Click OK to close the Virtualbox Information dialogs. Whenyou get to the Enterprise Linux 5 screen you can now login. (Username and

Page 7: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

password is oracle.) Allow the process to complete; it is ready when you see aterminal window, which you can close. Once you are finished working in the guestVM you can shut it down via System > Shut Down; this will return the guest VM tothe Powered Off state.

Click “start” icon in Virtual box

enter “oracle” as username

Page 8: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

password is “oracle”

Page 9: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

open the firefox browser

click on “sql developer link”

Page 10: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

click on “Getting Started with Oracle SQL Developer” link

Page 11: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

Notice the below lines mentioned in the “getting started with Oracle SqlDeveloper 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 thefollowing 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.

Page 12: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

Note : Service name = orcl

check Service using below commad.ps auxww | grep pmon | grep ­i orcl

unlock user “hr”

Page 13: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

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

Page 14: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

So far we are able to connect to the ORacle 11 g Db onOracle Linux. But in order to access it from Host Machine (Mac OS) , weneed to do Port Forwarding as shown below.

Page 15: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

3. Use Port forwarding to Connect from Host System( Mac OS ) to VMPort Forwarding on Virtual box:

click on “port forwarding”

Page 16: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

We have enabled 2 ports 8888 & 1521.1521 is for connecting to oracle DB from Host machine.Navigate to below URL on VM/Guest machinehttp://localhost:8888/apex/f?p=4550:1:0

Page 17: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

Check if port forwading is working by accessing the same url from hostmachine.

Wow, we are able to connect to Guest Machine (Oracel VM ) from HostMachine (Mac OS) and get the port forwardng to work.

Page 18: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

Now one should be able to connect to Oracle DB as well from HostSystem.

Access DB from Host Machine

Page 19: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

Above Screenshot displays Database explorer of Eclipse to browse theDB.

Cool , we are able to connect to Oracle 11g running on Oracle VM via MacOS.

Page 20: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

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.

Page 21: Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box

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_folderNote in the Host OS ( mac ) ,the jar file is now available