2017-08-09

Migrating Oracle VM from version 2.2 to 3.4

Migrating a virtual machine from Oracle VM Server 2.2 to Oracle VM Server 3.4

Environment

Oracle VM server release 2.2.2
Oracle VM server release 3.4.3
VMs: Redhat/Oracle Linux 5,6,7.

Importing VM2 to VM3 Template

Shutdown VM in v2 environment.
Locate System.img and vm.cfg, e.g.
pwd
/var/ovs/mount/B0CAFC70A7DB489C973D9819396703F7/running_pool/184_dtoocl10
ll
total 69206016
-rw------- 1 root root 53687091200 Feb 10  2012 OPTORACLE.img
-rw------- 1 root root 17179869184 Feb 10  2012 System.img
-rw------- 1 root root         778 Jul  5 11:24 vm.cfg
-rw------- 1 root root         666 Feb 10  2012 vm.cfg.orig

Backup vm.cfg
cp vm.cfg vm.cfg.backup

Modify vm.cfg and remove all disks except System.img. Other disks will be imported separately, I just don’t want them to be included in a template, to keep the template small.
disk = ['file:/var/ovs/mount/B0CAFC70A7DB489C973D9819396703F7/running_pool/184_dtoocl10/System.img,xvda,w',
'file:/var/ovs/mount/B0CAFC70A7DB489C973D9819396703F7/running_pool/184_dtoocl10/OPTORACLE.img,xvdb,w',
'file:/var/ovs/mount/B0CAFC70A7DB489C973D9819396703F7/sharedDisk/PIRUAT.img,xvdc,w!',
'file:/var/ovs/mount/B0CAFC70A7DB489C973D9819396703F7/sharedDisk/PIRBUAT_ARCHIVE.img,xvdd,w!',
]

Check/Kill IPtables
Share the current directory
python -m SimpleHTTPServer 80
Serving HTTP on 0.0.0.0 port 80 ...


Go to VM3 Manager and Import VM Template. All disks mentioned in vm.cfg must be included in the URLs if you didn’t delete them from vm.cfg.



Rename the template from System.img to something like dtoocl10_template_vm2, if migrating more than one VM otherwise you’ll have multiple templates with the same name.
Rename the Virtual Disk from System.img to something like template_dtoocl10_System.img
On VM2 hypervisor:
Kill SimpleHTTPServer
Restore vm.cfg
cp vm.cfg.backup vm.cfg
cp: overwrite `vm.cfg'? y

Locate other virtual disks, likely in “sharedDisk”, e.g.
/var/ovs/mount/B0CAFC70A7DB489C973D9819396703F7/sharedDisk

Go to that directory and share it
python -m SimpleHTTPServer 80
Serving HTTP on 0.0.0.0 port 80 ...

Go to VM3 Manager and Import Virtual Disk.
Rename the virtual disk if needed.
Kill SimpleHTTPServer

Creating VM


Rename the VM
Set Operating System
Setup network at Networks tab
Add other virtual disks at Disks tab, e.g. /opt/oracle or DB disk.
Rename SYSTEM virtual disk, and other disks if needed.
Modify vm.cfg file with extra='S' to boot in Single user mode.

Start the VM in Single user mode.
Launch Console.
Check that the disks are mounted
Change IP address in /etc/hosts
Change IP address and Gateway in /etc/sysconfig/network-scripts/ifcfg-eth0 (Oracle Linux 5 in this case)
Shutdown the VM
Update DNS entry
Remove extra=’S’ from vm.cfg
Start the VM
SSH to the VM and check DB and Apps. (You might need ipconfig /flushdns)

Cleaning up

Remove imported templates.






2017-08-07

Oracle EM 12c - reporting filesystem usage across all hosts

Environment:
Oracle Enterprise Manager 12c Cloud Control.

in SYSMAN schema:

select target_name, mountpoint,
round((freeb/1073741824),2) as "Free, GiB",
round((sizeb/1073741824),2) as "Size, GiB",
round((usedb/1073741824),2) as "Used, GiB",
round((((sizeb-freeb)/sizeb)*100),2) as "Used, %"
from MGMT$STORAGE_REPORT_LOCALFS
where filesystem_type not in ('iso9660','devtmpfs') -- excluding some filesystems
order by "Used, %" desc

Attention! (sizeb-freeb)/sizeb is not the same as usedb/sizeb
Use% of df command shows the same as (sizeb-freeb)/sizeb

Creating the report: