Configure Host Access to an Oracle Database on a VirtualBox vm

Admittedly it’s been a while since I’ve used VirtualBox to host a database. I’ve been using a bunch of different cloud services.

I like to program on my main machine(host) and connect to the VM as if it were just a database server.  I expected to have quite a few issues given how long it’s been since I did it this way. But really the only issue I had was  making the connection from the Host to the VM.

This is how I configured my VM using VirtualBox 4.3.26 for Windows hosts.

If any of the steps need a better explanation, leave me a comment and I’ll clarify.

Steps

  • Download the Database App Development VM from Oracle’s Pre-Built Developer VMs.  Others should also work if you have a favorite.
  • Import the .ova file into VirtualBox
  • Add network adapter
    • Select the imported VM
    • Click Settings (gear icon in toolbar or in the VM’s right-click menu)
      Settings
  • Configure Adapter
    • Select Network
    • Click on the Adapter 2 tab
    • Check Enable Network Adapter
    • In the Attached to list, select Host-only Adapter
    • Click OK button
      Add 2nd Adapter
  • Start the VM
  • Enable network adapter inside the VM
    • Click the network icon on the right side of the toolbar
    • Turn on the new adapter. Both adapters should be on.
      Note the name of the new adapter you just turned on.
      Enable2ndAdapter
  • Open a Terminal inside the VM
    • From the information at the top of the Terminal, Note the Pluggable DB and ALL PASSWORDS ARE values
      InitialTerminalMessage
    • Type ifconfig -a to get the ip address.  The adapter you just enabled (name from last step) will have the address you need, in my case it’s 192.168.52.101.
      ifconfig results
  • Test the connection on your host machine.
    I’m using Oracle SQL Developer 4.0.3 (4.0.3.16.84)

    • Create a new connection using the above values and push the test button.
      Password: oracleALL PASSWORDS ARE value
      Hostname: 192.168.52.101 — IP address value
      Service Name: orcl — Pluggable DB value
      Test Connection

If all goes well you should have a good connection.

Any questions please leave a comment.

18 thoughts on “Configure Host Access to an Oracle Database on a VirtualBox vm”

  1. Can we use Virtual Machine instead of virtual box where database is created and can we connect to the local mechine from SQL developer as mentioned in the course?

  2. These instructions are specifically for Oracle VirtualBox https://www.virtualbox.org/

    Also, there have been a few new versions of Oracle VirtualBox released since I wrote this. If you try this with the latest version, please let me know if this post is still accurate.

  3. Hi,

    I am trying to add the network adapter. I am getting an error like this “Nonexistent host networking interface, name ” (VERR_INTERNAL_ERROR).”

    When I select Attached to as Host-only Adapter , I don’t have any options to chose an adapter from the list. Can you help me out here?

  4. This post has helped me a lot. I’ve tied this with the latest version of Oracle VirtualBox (5.2.12/May 2018) and it works. Thank you very much!

  5. I can not connect to both network adapters. One is connected but the other one has the inscription “Connecting”.

    1. Hmmm… I’m not sure.

      A lot has changed since this post was published (see my other comment.)

  6. when i try to connect it says Failure – Test failed: IO Error: The Network Adapter could not establish the connection

    1. Have you checked that the port mapping is correct and that there’s not a local firewall issue?

  7. Pluggable database is really necessary to get connected? I have had setup without pluggable DB and even successul connected to EM Express still can get connected through SQLDeveloper with:
    Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection

    Any thoughts?

    1. The specific VM I used in the examples was pluggable, but that’s not required. Usually when I get that error, I check the port mapping and local firewall to make sure I can get to the VM.

Comments are closed.