How to resize VirtualBox VMDK Hard disk size

This post is due to lack of clear instructions available where I searched for. These are notes which I used to perform a hard disk extension in Ubuntu host for a Windows Vista is guest/vm.

Summary of steps:

Step 1: Convert vmdk file to vdi (if you are using vmdk as hard drive)
Step 2: Resize vdi file to required hard drive size
Step 3: Convert the resized vdi file to a new vmdk file (so that the original file serves as backup)
Step 4: Remove the attached vmdk file in vm and add the newly converted vmdk file.
Step 5: If you are running a Windows OS which supports Disk Management > Extend Volume then the guest OS will recognize the size of extended hard disk.
Step 6: Remove the original vmdk file if everything is fine.

Steps and commands:

The commands which I used are as follows:

Step 1: Convert vmdk to vdi

VBoxManage clonehd "WinVistaDev-disk2.vmdk" "cloned.vdi" --format vdi

Step 2: Resize vdi file:

VBoxManage modifyhd "cloned.vdi" --resize 40000

The above will resize the existing vdi to 40GB from existing. The size must be specified in MB.

If you are getting the following error:
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

Run this command:
VBoxManage showhdinfo cloned.vdi 

The following information will be listed:
UUID:               a8cxxxxx-5xx-4xx-axxx-xxxxxxx
Parent UUID:    base
State:                 created
Type:                 normal (base)
Location:           /home/anantha/VMs/cloned.vdi
Storage format: VMDK
Format variant: dynamic default
Capacity:          25600 MBytes
Size on disk:    18915 MBytes

You have probably forgotten the --format vdi while cloning VMDK to VDI. If that is the case delete the VDI file and recreate the VDI with the proper command mentioned in Step 1.

Step 3: Convert VDI to VMDK back

VBoxManage clonehd "cloned.vdi" "WinVistaDev-disk3.vmdk" --format vmdk

Step 4: Remove the attached VMDK file in VM and add the newly converted VMDK file.

Click Settings of the VM guest, select Storage. Remove the existing attachment and add the new VMDK file that is created.

Step 5: If you are running a Windows OS which supports Disk Management > Extend Volume then the guest OS will recognize the size of extended hard disk.

Within Windows guest open Device Management, you must see the newly available free space as unallocated. Right click the drive and select Extend Volume. Save and restart the guest.

Check if guest is reporting the new hard disk size.

Step 6: Remove the original VMDK file if everything is fine.

Remove the old VMDK file.

Oracle Apex 5 - First impressions

The new age Oracle Apex is here to download. Till 16th April it was only available as a preview in apex.oracle.com. Starting yesterday it is available for download.

For the first time, first day first show I could download Apex from otn and install in my local Express Edition database. The installation was smooth only 3 steps. The upgradation steps are clearly mentioned in documentation here.

Step 1: Download zip file from otn
Step 2: Unzip in folder of your choice
Step 3: Run the following command in sqlplus which is connected to sys

@apexins.sql tablespace_apex tablespace_files tablespace_temp images

As I had not created any tablespaces, I simply ran the following command:

@apexins.sql SYSAUX SYSAUX TEMP /i/

Step 4: Login back after the previous step and execute following:

@apxldimg.sql APEX_HOME

APEX_HOME is the folder containing the unzipped downloaded files of apex.

For example

@apxldimg.sql c:\

Step 5: Complete upgrade by updating password:

@apxchpwd.sql

Now you can navigate to

http://localhost:8080/apex/apex_admin  [Change server ip and port if your installation is not your pc]

But I am getting the following error, but I am ignoring for now. I referred the documentation for "Configuring Static File Support" but did not help. Will have to fix this later.



My first impressions of Apex is that it is superfast. The page loading in created applications were almost instant.

Need to test in an environment which has some applications to judge how migration has affected existing applications. Dont have the bandwidth now. But that is my next plan.

For now enjoying the page designer and Pivot option in Interactive report. These are the major additions to Apex as far as I have seen. More updates later.

Get Image attributes from BLOB

Q: How can I obtain image attributes such as height, width, format from BLOB column?
A: Using Oracle Multimedia ORDImage object type it is possible to get such attributes.

Consider the following example:
DECLARE
  lv_blob                  BLOB;
  unused_attributes        CLOB;
  img_mimetype             VARCHAR2(32);
  img_width                INTEGER;
  img_height               INTEGER;
  img_contentlength        INTEGER;
  unused_fileformat        VARCHAR2(32);
  unused_contentformat     VARCHAR2(32);
  unused_compressionformat VARCHAR2(32);
BEGIN
  SELECT blob_content
  INTO lv_blob
  FROM mytable;
  ordsys.ordimage.getproperties(lv_blob,
                                unused_attributes,
                                img_mimetype,
                                img_width,
                                img_height,
                                unused_fileformat,
                                unused_compressionformat,
                                unused_contentformat,
                                img_contentlength);
  dbms_output.put_line('Width=' || img_width || ' Height=' || img_height);
END;

You may encounter exceptions while calling this procedure if the image format is not proper. So always wrap this procedure call within an EXCEPTION block and determine the error.

For a list of exceptions which you can handle, check out the documentation.