Wednesday, February 6, 2013

Solved: Error Snapshotting Volumes (DISK2VHD)

Windows XP
I encountered the error "Error Snapshotting Volumes" while using the DISK2VHD tool to virtualize an old XP dev environment. The error is DISK2VHD's own description of an error that occurs with the shadow copy features of XP. This error is not confined to the DISK2VHD tool, and may occur with anything that relies on the usage of the shadow copy features. Most often, these tools are backup programs.

Fortunately, this is quite a well defined problem and Microsoft has a knowledge base article detailing the cause and resolution. The article goes into more depth about the symptoms and cause of the problem and does not actually mention the error message that I received from DISK2VHD, but it is in fact the root cause of the  error and the resolution steps discussed solved my error on the first attempt.

Here is the chewed version from the knowledge base article:
  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate and then click the following registry subkey:
  3. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs
  4. Click the registry subkey for each program that is listed under the Catalogs registry subkey. For each registry subkey, verify whether the Location registry entry exists.
  5. If the Location registry entry is missing for a selected program, verify whether the program is still installed.
  6. If the program is not installed, right-click the registry subkey for the program under the Catalogs subkey, and then clickDelete. If the program is installed, correct the location information.
  7. Restart the computer, and then use Windows Backup Utility to test this problem.
In my case, it was Visio that was previously uninstalled, but still had a registry entry that was running amok with my virtualization task. Simply removing the rogue registry entry got me on my way again and finally I have the dev environment virtualized.

Monday, November 5, 2012

Simplest way to debug your Oracle Java Stored Procedure

Oracle 9i/10g/11g
Today I came across a situation where I had to debug a Java Stored Procedure. I was under time pressure and just needed to understand where the procedure was failing. 

The simplest way of debugging pretty much any code is the good old print to standard output. And luckily for us, Oracle thought the same way and provided a super simple method of reading from the standard output stream by redirecting the output.

So my solution was easily implemented using the good old System.out.println, placing the print calls strategically throughout the Java procedure. The last little trick that allows you to actually see what was written, is to enable the output in SQL*Plus by turning the server output on and setting the DBMS_JAVA output size.

Thursday, July 12, 2012

Base64 decode using PL/SQL

Oracle 10g
For those of us that deal with internet based communication, Base64 encode/decode is a must. It is a method for us to move binary data files over a text based communication channel.

In my environment, I receive files over HTTP via the MOD_PLSQL gateway. MOD_PLSQL implements the bare necessities in terms of HTTP communication, so it comes as no surprise that it does not decode uploaded files if those files arrive as GZIP or Base64 encoded. If I think about it, it shouldn't decode them automatically, but at the very least it should record the encoding of the file for later use.

Fortunately, I just happen to know that the 3rd party sends the file encoded using Base64. Only thing is, the PL/SQL package for decoding Base64 strings UTL_ENCODE only decodes RAW datatypes which limits us to 32767 characters. For Base64 strings larger than 32767 characters in size, we needed to role our own solution. So here is my version of decode to support decoding clob to blob.

Wednesday, May 23, 2012

Solved "Setup was unable to open information file games.inf"

Windows XP
Windows XP was actually a great OS, and I still use it extensively in testing on virtual machines. Of course, for my test environment, it did not make sense to install all of the components of XP, so I made sure I only installed the lightest components that I thought I needed. 

It was only later that I discovered that I could not add components back in because the Add/Remove Programs dialog would error with "Setup was unable to open information file games.inf". Fortunately, this problem is not that difficult to solve. 

Friday, April 20, 2012

Example: How to print a Oracle report using a URL

Oracle Reports 10g
Windows Server 2008
For those of us that use Oracle Reports in our environments, most of us (I assume), use the web browser to run the report. The report is then returned back to the browser window for viewing (typically). But what happens if I want to run the report directly to a printer without viewing it? 

Perhaps I want to have a payroll run that prints a few thousand pay sheets. Not something I want to preview or download to my browser. It's also not something I would print to my local printer that only does 15-20ppm.

Or, maybe I want a document that requires particular stationary, delicate watermarking and copy protection only available on a specialised corporate printer. Like perhaps a vehicle license document or access card printer.

Anyway, there is quite a bit of documentation about printing from Oracle Reports on UNIX servers (because it's so much more complex on UNIX systems), but basically none on Windows servers because it is so simple. Still, it took me a little while to find just the right parameters to set when running the report. So here it is then, a simple guide to printing Oracle Reports to a designated printer via a URL browser command....

Friday, March 23, 2012

Extending the simple MS Excel procedure to include headers

Oracle 10g
MS Excel
In my previous post titled "Simplest example of writing to MS Excel using an Oracle Stored Procedure", I demonstrated what I believe to be the simplest way of outputting a file that can be used by MS Excel. But the example does not include the column headings.... Okay, thats simple enough. In this post, I will extend on the previous example to include the headings.  So without further ado....

Tuesday, February 28, 2012

Simplest example of writing to MS Excel using an Oracle Stored Procedure

Oracle 10g
MS Excel
First of all, we need to define exactly what is meant by "writing to Excel worksheet". Most people just mean produce something that MS Excel can show as a worksheet. A CSV file is the simplest file that can be displayed by MS Excel and since it is a simple text markup, is the easiest to produce via PL/SQL.

Generating the file using a stored procedure is seriously simple. But you will need to also give thought to how you will make the file available to excel (how to distribute the file). In my example, I make the file available on a network share. The user will find the file available there and open it using MS Excel.