DB2 on Ubuntu: “Database is damaged” error

If you installed DB2 Express-C 9.5 on Ubuntu and can’t create any databases because of the following error:

SQL1034C The database is damaged. All applications processing the database
have been stopped. SQLSTATE=58031

Try adding the following to the /home/db2inst1/.bashrc file:

export LC_ALL=C

This happened to me running Ubuntu in Spanish and the above environment variable fixed the problem. I can now create and use databases.

By the way, I found this solution here.


No grep in Windows? No problem.

Just a quick tip. I’ve always complained that Windows doesn’t have the grep command but you can use the Windows find command the same way.

For example, in Linux you can do:

$ cat /etc/services | grep “http”

The equivalent in Windows would be:

c:\> type \Windows\system32\drivers\etc\services | find “http”

Try it.

Linux Open Files Limit

If you’ve ever gotten the “too many open files” error and tried to increase the open file limit for a certain user, you’ve probably seen the following solution on forums:

Edit the /etc/security/limits.conf file and add a new line to the end of the file like this:
myuser hard nofile 2048

Then you open up a new terminal session with myuser only to see that the limit hasn’t changed.

What gives?

I decided to add both hard and soft limits to the file, like this:

myuser hard nofile 2048
myuser soft nofile 2048

And that did the trick. Now every time I open a new terminal session I have a 2048 open file limit instead of the usual 1024.

I’m not sure if this is the best way to do it, though. If anybody knows a better way let me know.

A few Terminal tips

A couple of days ago I found an interesting article called Lazy Linux: 10 essential tricks for admins, so I decided to try a couple of these on my Mac – I’m running Tiger, by the way.

1. Unmounting a stuck DVD (or disk image, for that matter)

I could not find the fuser command mentioned for linux on my Mac but we can always use lsof.

If you’re trying to eject a disk called Movies and are getting the old The disk “Movies” is in use and could not be ejected message you can open up the Terminal and run the following commands to find which app is at fault:

$ lsof | grep Movies

You should get something like this:

QuickTime 404  myuser  13r   REG   14,3 735825920   45186 /Volumes/Movies/My Movie.mov

This example tells you that QuickTime has a file called My Movie.mov open from the Movies disk. So just close the file in QuickTime and you should be able to eject your DVD/image file.

2. Collaboration with screen

This one worked exactly as it says in the article. Just do the following:

  • Open up the Terminal on your Mac. Let’s assume your username is myuser.
  • From another machine, open up an SSH connection to your Mac as myuser.
  • From the remote machine type the following:
  • $ screen -S myscreen 
  • Now, from the Mac Terminal type the following:
  • $ screen -x myscreen
  • Your Mac Terminal session and your SSH session should now be joined together. Anything you do on the Mac will be seen from the remote machine and viceversa. This is great for collaboration or troubleshooting.
  • To exit myscreen just type exit from either machine.


The linux article includes tips for:

  1. Unmounting the unresponsive DVD drive – works great.
  2. Getting your screen back when it is hosed.
  3. Collaboration with screen – I did not know about this, works great.
  4. Getting back the root password – I will probably try this one soon.
  5. SSH back door.
  6. Remote VNC session through an SSH tunnel.
  7. Checking your bandwidth.
  8. Command-line scripting and utilities.
  9. Spying on the console.
  10. Random system information collection.

So if you’re a linux user check them out. They could come in handy eventually.