A primer in awk for DB2 LUW DBAs

Although awk and awkward start with the same three letters, awk by no means is awkward. Well, from the syntax of it (and I agree, sometimes, from its learning curve), it could be appear to be so. In this blog post, I share how awk’s most basic features could be powerful tools to get things done faster.

I use awk in many of my UNIX scripts that I write to automate routine tasks. In addition to this, I routinely write awk one-liners to save time. Many times, these one-liners are throw-away in that the same exact awk command might not be used again.

Continue reading

Advertisements

DB2 LUW – Handling database objects with mixed case and special characters in their names

Handling tables (or other database objects) that have mixed case names and/or with special character(s) in their names needs special effort. In this blog post, we will look at our options; essentially, what works and what does not work.

Continue reading

DBA tip – Easy way to handle single quotes in awk

It is no wonder that I cannot live without awk even a single (working) day in my life. Such is the power of awk (or AWK). It is simply the most powerful utility that I use on *IX (Linux/AIX) systems. awk makes my life easy when dealing with daily DBA tasks. I learned awk almost 10 years ago and I admit that it was tough to get used to its syntax. However, once I knew few basics, it was fun.

Continue reading

DBA’s friend — UNIX’s crontab utility

There are many tools and utilities that simplify routine tasks and empower DBAs to automate tasks and get the job done. One of them is UNIX’s crontab utility. Colloquially, this is referred to as ‘Cron’ . In this  blog post, first I will introduce few basics about crontab. We will then look at few gotchas to watch out for when using crontab in UNIX environments. Continue reading

DB2 DBA tip – UNIX script to reduce typing (and save time) for reorgs after altering tables

At my current work engagement, I interact with a team of developers who work on multiple projects on a large multi-terabyte data warehouse. Some of these interactions are in the form of requests for DDL (Data Definition Language) changes. Many of such DDL requests have ‘alter table … ‘ statements in them, sometimes, multiple alters on the same table.

When there are more than 3 alter statements for the same table and in few other cases like altering few data types of columns, DB2 puts altered tables into reorg-pending mode. It becomes imperative to perform a reorg on such a table as no Insert, Update and Delete statements could be run until reorg operation is done.

This effort involves identifying tables that are in reorg-pending mode and then performing reorg on each of the table that is in reorg-pending mode. It is repetitive in nature. I usually come up with a UNIX script to get mundane tasks done. In this blog post, I will share this UNIX script that will aid in identifying tables in reorg-pending mode and then perform reorg operation.

Continue reading

DB2 LINUX and DB2 AIX — Empty line makes a difference in a shell script

I have had an interesting observation this week and it is about subtle difference between AIX and LINUX (SUSE in this case) from DB2 standpoint. In this blog I will share about this rather surprising encounter I had while I was working on a simple database task. Continue reading