Wednesday, March 30, 2011

2011 World Cup cricket ended in disappointment for Pakistan

Long story short.......In electrifying semi final at MOHALI India beat Pakistan by 29 runs on Wednesday to set-up a World Cup final against Sri Lanka in Mumbai on Saturday.

Friday, March 18, 2011

The 100 Oldest Currently Registered .COM Domains

Here is the list of 100 oldest .com domains if anyone wondering to buy any of the these domain eg (the 12th oldest domain) which Oracle will soon spare after $7 billion purchase of Sun Microsystems. then remember you need a bottom less pocket :).
Domain brokers speculate Oracle could sell it for $1 million or more, if it chose to do so.

Tuesday, March 15, 2011

My Baby Girl Fatime

If anyone wondering about my baby girl Fatime here she :). Fatima is now almost two months old.

Its more fun with Ayesha and Fatima I would say its the greatest time of our lives.

Friday, March 11, 2011

Installing oracle-instantclient on Centos 5.5

1. Download oracle instantclient rpm from Oracle for your platform

Need to download these two rpms.


2. Install
# rpm -ivh oracle-instantclient-*

Getting and compiling oci8 extension for PHP

# pear download pecl/oci8
# tar zxvf oci8-1.4.5.tgz
# cd oci8-1.4.5
# ./configure --with-oci8=instantclient
# make
# make install

Create a file called /etc/php.d/oracle_oci.ini and place the following line

Restart Apache

Create a .php file with call to phpinfo(); and confirm that oci8 is loaded in apache, you can also check if module is loaded with php -m.

Wednesday, March 9, 2011

HP EliteBook 8540p Hibernate/Suspend Fixed in Fedora 13

Today got time to play with the long standing problem of hibernate/suspend problem on my work notebook HP EliteBook 8540p running Fedora 13 (upgrading to Fedora 14 still pending :( )

Quick Google search reports an article on The Linux Laptop Wiki and astonishingly within 3 minutes the problem fixed and now the thing goes on suspend/hibernate (as per power management settings) if the  laptop lid is closed while on battery power or when when the battery power is critically low.

As per the article all have to do is to create a script,

1. Create a script file.
$ sudo vi /etc/pm/sleep.d/01fix_usb3

# Put the laptop to suspend/hibernate

case $1 in
suspend | hibernate) modprobe -r $MOD ;;
resume | thaw) modprobe $MOD ;;
*) echo "USB3 fix script: wrong argument $1" ;;

2. Make it executable
sudo chmod +x /etc/pm/sleep.d/01fix_usb3

Thanks to nice folks at The Linux Laptop Wiki.

Update: This hack is no longer required in Fedora 14,  Hibernate/Suspend working out of the box in Fedora 14

Wednesday, March 2, 2011

Bulk data uploading into the Oracle database using SQL*Loader

SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle database.

 SQL*Loader (sqlldr) is the utility to use for high performance data loads. The data can be loaded from any text file and inserted into the database.

Recently I got the chance to use SQL*Loader to automate data uploading from a text file in which each field delimited with the pipe "|" into the Oracle.

1. Create a control file, call it anything in my case its add.ctl

load data  infile '-'
into table records
fields terminated by '|'

load data infile '-' : In my case there are multiple text files which to be process by sqlldr so instead of using filename I used the '-'. And used APPEND to append the new data into the table.

2. Script to run to call sqlldr utility for uploading the data from text files.

# Author: Askar Ali Khan
# Purpose: To upload data from text files into Oracle Table - RECORDS
# records_upload

# Define Oracle variables


# Must be run as oracle user
if [[ $UID -ne 501 ]]; then
    echo "$0 must be run as oracle"
    exit 1

cd "$SRCDIR"

# If directory contains *.txt files then call sqlldr otherwise do nothing

for file in *.txt; do
 test -f "$file" || continue
 cat $file | sqlldr oraclUser/Password add.ctl
 rm -f $file

The script process files in /data directory one by one by piping into sqlldr and delete it. Deletion is must coz in the next run there will be new files fetched into /data directory by another FTP script.

3. Define a cron job under oracle user to run script every 15 minutes

$ crontab -e
*/15 * * * * /usr/local/bin/records_upload > /dev/null 2>&1

Backup using Rsync

Rsync is a great tool for backup your servers, home directories or anything else, I thought of go for a little howto but there is already plenty of material available online therefore no need to reinvent the wheel :)

Anyone interested in quick howto for Rsync I would suggest to look into very nice article on LinuxPlanet.