MySQL Plugin for Oracle Enterprise Manager on VirtualBox: installation gotchas

At the last OOW MySQL Plugin for Oracle Enterprise Manager (OEM) was recognized as most popular MySQL product. If you don't have OEM installed, but want to test the plugin you can download OEM virtual box template. But, althought this is the easiest way to get started, you still need to make few additions. At least I had to do them when deployed such installation for MySQL Support Team.

Here they are. I prefer to use command line when possible.

0. Import virtual machine image and change network adapter to working one, then allow to connections via rdesktop:

sudo vboxmanage import VBox_EM12cR4.ova --vsys 0 --vmname  myhost-vbox04 \
--vsys 0 --unit 17 --disk  /data0/vbox/myhost-vbox04/myhost-vbox04.vmdk
sudo vboxmanage modifyvm myhost-vbox04 --bridgeadapter1 'eth0'
sudo vboxmanage modifyvm myhost-vbox04 --vrdeaddress myhost --vrde on --vrdeport 9004

1. The machine comes with 3G RAM which is not enough. Better to increase up to 8::

sudo vboxmanage modifyvm myhost-vbox04 --memory 8192

2. Also 40G of disk space will be used completely right after you start OEM. Therefore it is better to don't follow me and don't reach this point, but increase it right after installing the machine. I increased mine up to 100G.

The machines comes with vmdk disk format which does not support dynamic size change. Therefore you need to convert it to vdi format first, then resize.

sudo vboxmanage clonehd myhost-vbox04.vmdk myhost-vbox04.vdi --format vdi
sudo vboxmanage modifyhd myhost-vbox04.vdi --resize 102400

3. Then convert it back to vmdk and replace old disk with new one:

sudo vboxmanage clonehd myhost-vbox04.vdi myhost-vbox04-01.vmdk --format vmdk
sudo vboxmanage storageattach myhost-vbox04 --storagectl "SATA" --device 0  \

--port 0 --type hdd --medium /data0/vbox/myhost-vbox04/myhost-vbox04-01.vmdk

4. We are not done yet: 60G will stay invisible unless we change disk partitions. I did it with help of utility GParted, but you can use any, including system's.

5. Turn machine off and eject GParted CD:

sudo vboxmanage storageattach myhost-vbox04 --storagectl "IDE" --port 0 \

--device 0 --medium emptydrive

6. Boot the machine, login as root user (password is welcome1) and confirm that although OS ecognizes extended disk, but partition which holds OEM installation still full:

$ /sbin/fdisk -l

Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       13055   104753177+  8e  Linux LVM

Disk /dev/dm-0: 36.5 GB, 36574330880 bytes
255 heads, 63 sectors/track, 4446 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 7314 MB, 7314866176 bytes
255 heads, 63 sectors/track, 889 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       33G   32G     0 100% /
/dev/sda1              99M   23M   71M  25% /boot
tmpfs                 4.0G     0  4.0G   0% /dev/shm

This happens, because OEM is on LVM partition and we need to fix it too:

$ /sbin/lvm
lvm> pvresize /dev/sda2
lvm> lvextend -L+55G /dev/mapper/VolGroup00-LogVol00
  Extending logical volume LogVol00 to 89.06 GB
  Logical volume LogVol00 successfully resized
lvm> quit
  Exiting.

$ /sbin/resize2fs /dev/mapper/VolGroup00-LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 23347200 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 23347200 blocks long.

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       87G   32G   51G  39% /
/dev/sda1              99M   23M   71M  25% /boot
tmpfs                 4.0G     0  4.0G   0% /dev/shm

Voi-la! Now we can logout from root account and start OEM.

7. But not yet if you need to connect to this virtual machine via ssh and cannot tune your network in such a way that emcc.example.com will be resolved to the virtual machine. In my case I had to connect to this machine via ssh and I cannot tune my network, only virtual machine's options. So I set network options as usual (GUI can be used) and changed ORACLE_HOSTNAME from emcc.example.com to appropriate value in .bashrc and ./start_agent.sh files.

Unfortunately this change does not instruct WebLogic to listen remote port even after I disabled machine's firewall, so I still have to use rdesktop to be able to see OEM GUI.

8. Finally we can start OEM as described in the README file, provided at edelivery.oracle.com for this virtual machine: do not use ./start_all.sh, but start each part separately:

./start_db.sh
/u01/OracleHomes/Middleware/oms/bin/emctl start oms
./start_agent.sh

And, last but not least, it is better to perform OEM setup wearing such a t-shirt:



I would not describe how to setup MySQL Plugin, because MySQL User Reference Manual contains detailed and clear instructions. I'd better show few screenshots how you can monitor both remote and local servers.

Just connected with a server on remote machine:



And on local one:



After test load with help of mysqlslap utility:



And this strange chart show how MySQL works on virtual machine: