Monday 25 March 2013

Setting up a Sandbox environment for Oracle in VMPlayer


The following assumes you want an environment which will have an oracle database installed in a windows virtual environment. Whether this is going onto a laptop which will be connecting to multiple wireless networks or a desktop, chances are you’ll be using DHCP to get your IP. Since you’ll be using your VM for Oracle, you’ll want to have a static IP setup in your VM and it’s better to do it at the start than trying to reconfigure later, trust me.

You may also need a static ip address to connect to the guest from the host and possibly from other Virtual Machines on your host.

I’ll not cover installing Windows on a VM , that is covered all over the internet and no point reinventing the wheel.

For this scenario I would recommend setting your VM to use a Host Only adapter. I’ve found this is the simplest solution for getting a local play area set up on VMware Player. You will not have internet in your guest VM but that’s hardly the main reason for this setup. (A Bridged adpater may be the answer but I’ve found trying to configure it difficult as the network tool doesn’t install by default )

When installing VMware Player, it creates three virtual network interfaces, VMnNet0, VMnet1 and VMnet8.  VMnet1 is the 'host only' interface which we will be using and you can see this in your hosts network adapters. It will already have an IP assigned(I’ve found it doesn’t use this IP range when assigning  IP’s  to the VM’s, currently it’s a mystery to me but I think its probably done through the network tool).

The good thing is that it keeps the same IP for the VM as long as it’s around. Once configured with a host-only network card I’ve found my VM’s will keep the same IP. I’ve tested this starting them in different orders and copying them and starting them up, each time the existing VM’s maintain their IP and the new VM;’s are assigned a new one.

The new step before installing the oracle software is to configure your virtual windows environment with a loopback adpater as per oracle instructions.

Here is a summary for Windows 2003 or Windows XP:

  1. Open the Windows Control Panel.
  2. Double-click Add Hardware to start the Add Hardware wizard.
  3. In the Welcome window, click Next.
  4. In the ‘Is the hardware connected? window, select Yes, I have already connected the hardware, and click Next.
  5. In the The following hardware is already installed on your computer window, in the list of installed hardware, select Add a new hardware device, and click Next.
  6. In the The wizard can help you install other hardware window, select Install the hardware that I manually select from a list, and click Next.
  7. From the list of hardware types, select the type of hardware you are installing window, select Network adapters, and click Next.
  8. In the Select Network Adapter window, make the following selections:
    • Manufacturer: Select Microsoft.
    • Network Adapter: Select Microsoft Loopback Adapter.
  9. Click Next.
  10. In the The wizard is ready to install your hardware window, click Next.
  11. In the Completing the Add Hardware Wizard window, click Finish.
  12. If you are using Windows 2003, restart your computer.
  13. Right-click My Network Places on the desktop and choose Properties. This displays the Network Connections Control Panel.
  14. Right-click the connection that was just created. This is usually named "Local Area Connection 2". Choose Properties.
  15. On the General tab, select Internet Protocol (TCP/IP), and click Properties.
  16. In the Properties dialog box, click Use the following IP address and do the following:

    1. IP Address: Enter a non-routable IP for the loopback adapter. Oracle recommends the following non-routable addresses:
      • 192.168.x.x (x is any value between 0 and 255)
      • 10.10.10.10
    2. Subnet mask: Enter 255.255.255.0.
    3. Record the values you entered, which you will need later in this procedure.
    4. Leave all other fields empty.
    5. Click OK.
  1. Click OK.
  2. Close Network Connections.
  3. Restart the computer.
  4. Add a line to the SYSTEM_DRIVE:\WINDOWS\system32\drivers\etc\hosts file with the following format, after the localhost line:
          IP_address   hostname.domainname   hostname

where:

    • IP_address is the non-routable IP address you entered in step 16.
    • hostname is the name of the computer.
    • domainname is the name of the domain.
            For example:

10.10.10.10   mycomputer.mydomain.com   mycomputer

This way oracle will always resolve its connection correctly.

The last step is to install the Oracle Software and then test your connection from your host.

At the end, you should be able to connect from your host desktop to the guest VM over remote desktop or through a SQL client like SQL Developer. The Guest IP will not change so you could add a shortcut to your hosts file. In the Guest VM, the loopback adapter will resolve all traffic back to the guest IP and oracle will have no issues no matter what network your connected to on your host.

In the below example i've used ORADBHOST1 for the install and that is what is present in my tnsnames.ora.


 

No comments:

Post a Comment