Thursday, December 11, 2008

Troubleshooting Oracle Error

We had an IVR application which writes to an Oracle database start giving a pretty basic error tonight. The error basically said that the app could not access the table in Oracle. Not very descriptive, and not a lot to go from.
Now, this customer has multiple sites, and the database is replicated between all of the sites, and all were experiencing the issue.
We did some digging, and ended up looking to the Oracle Alert logs which were in

/u01/app/oracle/admin/<instance>/bdump

The alert log is called:

alert_<instance>.log

What we found were entries like this:

ORA-1654: unable to extend index <schema>.<index> by 128 in tablespace <tablespace>

This was a pretty clear indication of what the issue was, because the timestamps on the messages coincided with the timestamps on the IVR messages.
So we knew that the tablespace for the index was full. How do you fix that.
Well, you need to add more space to the tablespace. Here's a simple way to do that:

alter tablespace <tablespace>
add datafile '<data file path and name>'
size <size>m
autoextend off


This will add a datafile to the tablespace with a size as specified.
We did this and the errors went away. But now the question is how can we be proactive and prevent this in the future.
Well, periodically the free space in all of the tablespaces should be checked.
Here's a simple query to figure out how much free space is available in each tablespace:

select tablespace_name,
sum(bytes)/1024/1024 MB_Free
from dba_free_space
group by tablespace_name
order by sum(bytes)/1024/1024;

This will give you a list of each tablespace and the amount of free space in Megabytes.
If you see the free space of one of the tablespaces getting real low, it's time to add more.

Tuesday, December 2, 2008

A few recommended tools

Working between Windows and Unix systems, you find from time to time, tools that you wish you could have on both systems. Generally, I find I'm missing some Unix command on Windows. So I've compile a few links here for tools that I find handy.

Text Editor
You can never underestimate the value of a good text editor. I do a lot of log file reading, and a good text editor is required. Some of the files can get rather large in size, and they tend to be in a Unix format, so they don't work in Notepad. vi is the tool of choice on a Unix system. Here are few good ones for Windows (some free, some not)
  • vim : There is an actual port of vi to windows. This includes both a command line option, and an GUI option.
    See http://www.vim.org
  • Textpad: Textpad is a good, free text editor. It handles large files sizes, and different file formats.
    See http://www.textpad.com
  • EditPad: This is my tool of choice. It's not free, but it offers a lot of different features. It receognizes many extensions and does syntax highlighting, so if your looking at Java code, or SQL Queries, it automatically colors the commands for easier viewing.
    See http://www.editpadpro.com/
Tail
Tail is a great utility available on most Unix systems. Tail allows you to watch a log file in real time.
Grep
Grep is very handy for searching a group of logs for a specific string.
These are all essential tools for log file analysis.