23 December 2010

clone virtual machine in VirtualBox

Goal of this procedure:
Source: machine called EntLnx10 with disk EntLnx_10.vdi
Target: machine called EntLnx09 with disk EntLnx_09.vdi


Here is what we do:

  • start up Virtualbox program.
  • Go to File > Virtual Media Manager (or press Ctrl-D)
  • Select the EntLnx_10.vdi and click Release button.
  • Select the EntLnx_10.vdi and click Remove button.
  • Select the Keep button (!!)

Now start a commandline and give the command (also see example below):


  [path]\VBoxManage.exe clonehd [path]\sourcedisk.vdi [path]\targetdisk.vdi


This starts copying the disk, which might take a while.


D:\Virtual Machines>"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd "d:\Virtual Machines\EntLnx_10.vdi" "d:\Virtual Machines\EntLnx_09.vdi"
Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.


0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 65a30476-0a44-4dea-aee8-9e0e95a12e7c


Now add the new disk to Virtualbox:

  • Go to File > Virtual Media Manager (or press Ctrl-D)
  • Click Add and select the new vdi file. Click Ok.

Now create a new virtual machine, and select in this process the 'existing' new vdi file as harddisk.


Start up the EntLnx09 machine.


Good luck!



06 December 2010

Getting the NLS_LANG right for exp and imp

If you use the old-fashioned imp en exp tools, you really need to set the NLS_LANG environment variable right. To what value? It can be read from the v$nls_parameters. To make life easier, I always keep this set_nls.sql script available. It creates just the right (Linux) statement to make the setting.


set heading off
set feedback off
 select 'export NLS_LANG=' || lan.value || '_' || ter.value || '.' || chr.value
  from v$nls_parameters lan,
       v$nls_parameters ter,
       v$nls_parameters chr
  where lan.parameter='NLS_LANGUAGE'
    and ter.parameter='NLS_TERRITORY'
    and chr.parameter='NLS_CHARACTERSET';
set heading on
set feedback on

This gives me for example:

export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1

Just copy it in your shell environment and fire up the imp or exp!