Could Not Find Program Unit Being Called

I was told to write a stand alone script to clear out a backlog of work that needed done. It was caused by a slow nightly process that had to get aborted. I coded a new procedure in one of our packages. My script was very simple. It logged the start and end times of the script. The only other thing it did was call the stored procedure with the correct parameters.

Now I wanted to make sure the performance of the stand alone script was acceptable. So I looked in the log to see the start and end times. I was shocked to find tons of ORA-06508 errors being logged by one of the triggers in the database. Now this error means some stored procedure could not be found, or was invalid. This darn trigger was calling all kinds of procedures in many different packages. I guess I could have recompiled them all.

I did find a gem of an idea on Akdora's blog. Instead of just logged the error message in the exception handler, you can store the output of DMBS_UTLITY.FORMAT_ERROR_STACK. This tells you exactly what object is missing or invalid. Thanks Akdora. You helped me get the problem solved and still get home in time.

PL/SQL Review

I just went through a recap of the PL/SQL programming language. It was good. PL/SQL is the programming language for the Oracle database. It can improve application performance but compiling stored procedure code into the database.

PL/SQL is arranged in blocks. Blocks with names are procedures or functions. You can run PL/SQL from the Oracle SQL*Plus tool. You can also run it through an IDE like Oracle SQL Developer.

I hear that new developers continue to come into the PL/SQL programming community.

Oracle Database Firewall

Oracle has released a database firewall product. It analyzes SQL to determine whether to block or log the activity. This functionality comes from F5 Corporation, with which Oracle has struck a partnership.

Normally this is the territory of database activity monitoring products. Companies with these products are downplaying the security of the Oracle database firewall.

There are ways to get around the firewall. For example, our UNIX guys log into their UNIX accounts on the machine that hosts the database. Then they use a local connection to the database. Once they do that, all they SQL bypasses the firewall. Ooops.

Users are Blocked

I was working on some low priority customer problems for a manager. Then all holy heck broke loose. I was getting emails and calls like crazy. The system supporting all our customers was slowing down to a crawl. That should not be possible as we have massive hardware.

The DBA team was on hand to monitor what was going on. User row-level locks were in contention. Our applications were hanging. The DBA teams used some tools to identify one of the first locks that happened in the morning. I knew the business logic behind the SQL.

We got in touch with the user. She killed her application that had been hung all morning. This automatically released the locks and the system returned to a normal state. The lead DBA asked us developers to look at the locking strategy used by the application. He recommended a potential redesign of the app. I took a note, then ran off to the next set of emergencies.

VirtualBox

A friend of mine asked me if I knew about Oracle's VirtualBox software. I was ashamed that I did not. I consider myself an Oracle developer.

VirtualBox is a free open source product released under a GNU license. It does operating system virtualization. You can run multiple copies of virtual operating systems at the same time.

To start with, you need a host operating system such as Windows XP or Windows 7 for the Windows platform. Then you can run all kinds of virtual guest operating systems with VirtualBox.

Why would you want to do this? Well you can test many platforms with just one physical host platform. VirtualBox also can simulate SMP up to 32 cores (which are all virtual). You can also take snapshots of the o/s state and restore to them.

I like the idea of having a snapshot I can revert to if my o/s gets corrupted by some nasty virus.

Keep Business Rules out of Triggers

My old team needed some assistance with a problem that was happening in production. Rows from a database table were mysteriously disappearing when the users ran a certain application. The developers swore that their code did not delete these records.

Since I trust nobody, I scanned the source code of all the database triggers in the system. Sure enough, there was a trigger on another table that deleted the records when a certain field got set to a value. Oh snap. This is just poor design. That's not what triggers are for.

There are two lessons to learn from this. One is to practice solid design and keep business rules out of the database triggers. The second is that the client server developers need to keep an eye on the code in the database triggers.

Promotion Woes

I had to fix a problem they were having using a back end process in production. Seems a processing command was resulting in an Oracle error. I investigated and found that the key stored procedure was commented out of the package. So I reenabled the procedure and thought we were good to go.

I got a call from our DBA. He said my code changes would not work in some of the other database schemas. When I got in to work, I found that the other schemas were missing a key column in the staging database table. That should never happen. We got a database configuration management issue.

So I thought we could just add the column everywhere. Some more analysis showed me this would not correct the whole problem. In the end I decided to recode the stored procedure to use another technique to derive the necessary data using some assumptions. This whole episode made me a bit leery about the state of our databases.