Sunday, July 17, 2011

How to share Windows folder on Ubuntu (guest OS)

My system environment looks as follows - Windows host with Ubuntu 10 guest OS in VMWare

I followed the below URL from wmware to setup Windows share on Ubuntu. But this did not quiet work in a single given the fact that I am new to Ubuntu/Window intraction.

Try command "smbmount" if this works that means the smb pieces are install, else install them

if smb components are not install then run "apt-get install smbfs" - ensure that the installation goes correct.

Create a directory that will be mapped to window share "mkdir /home/gvphubli/win_shared"

Here is the last command in this process

mount -t smbfs -o username=win_user,password=win_user_pwd 
//win_system_IP/Java_Learning  /home/gvphubli/win_shared 

In case of CentOS or Fedora follow these steps,

Test for samba, run this command in terminal "smbd -V" if samba is installed and available the version number will be displayed, else you will see bash error.

If you see error, install samba using following steps, I used my root privileges to do so.

yum install samba-swat samba-client

After successfull installation, use the same command "smbd -V" to verify. If things look good go to next stop of creating a mount, here is he command

mount -t cifs -o username=win_user,password=win_user_pwd //win_system_IP/Java_Learning  /home/gvphubli/win_shared

Note: one difference in this command for Ubuntu v/s RH (Fedora and CentOS) is the change from "smbfs" to "cifs"

You should be all set to share files between host and guest OS


Friday, July 8, 2011

db2 restore with mix of full and incremental backups

Following are the steps to restore db2 database when you have mix of db backup with full, incremental and delta are involved.This illustration is based on Windows system.

text in blue are db2 commands
text in green are my comments
text in black are output seen on command line console.

db2 create db zzz_tmp
db2 restore db zzz incremental automatic from C:\ taken at 20110707154108 into zzz_tmp
db2 rollforward db zzz_tmp to end of backup and complete

-- you will see following message, if roll-forward is not complete

SQL4970N Roll-forward recovery on database "ZZZ_TMP" cannot reach the
specified stop point (end-of-log or point-in-time) on database partition(s)
"0". Roll-forward recovery processing has halted on log file "S0000026.LOG".

-- if you see a message as listed above you need to get(copy or restore from TSM)
-- the specified log file to zzz_tmp's active log directory

db2 rollforward db zzz_tmp to end of backup and complete

-- if successfull (you mostly will be) you will see following message

Rollforward Status

Input database alias = zzz_tmp
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read = Log files processed = S0000026.LOG - S0000026.LOG
Last committed transaction = 2011-07-07- UTC

DB20000I The ROLLFORWARD command completed successfully.

-- do some smoke testing, by connecting and possibly quering the db

db2 connect to zzz_tmp

Database Connection Information
Database server = DB2/NT 9.7.0
SQL authorization ID = db2admin
Local database alias = ZZZ_TMP

Thursday, July 7, 2011

db2 merge backup - utility test

I was very excited about "db2 merge backup" tool. As per the documentation this tool is supposed to merge incremental and delta backup and merge it with the most recent full db backup prior to these incremetnal or delta backups. More details about this utility can be found here

So, if you have this tool working you take one full backup and there are after you just do delta backups and keep merging them with you full backup. Here after you never take full db backups again.

Out of excitement I decided to test this tool. Downloaded this tool and set it up on my window workstation. I did my full backup, ran couple of database transactions and took the delta backup. Below is the control file options and the command used and the output as well.

Below are the contents from "SampleMergeCtrlFile.txt" control file used in the test. I used the control file examples from the following link here

PART (0)
START FROM "C:" TAKEN AT 20110707153755
END FROM "C:" TAKEN AT 20110707154108
OUTPUT TO "C:\Merged\"

Below is the my db2 merge command output.

db2mbk -i DB2INST1 -f SampleMergeCtrlFile.txt -s -p 0
MBKI445W Warning: you are still using a temporary license.
         you need to enroll DB2 Merge Backup for Linux, UNIX, and Windows within 29 days.
MBKM031I DB2 Merge Backup for Linux, UNIX, and Windows 01.01.000(110505) 32 bits 7/7/2011 (Windows)
PART (0)
START FROM "C:" TAKEN AT 20110707153755
END FROM "C:" TAKEN AT 20110707154108
OUTPUT TO "C:\Merged\"
MBKB005I MBK control step start   : 16:00:40.287.
MBKB037I Merged backups will not be registered into DB2.
MBKB005I [0] MBK control step start   : 16:00:40.302.
MBKB006I [0] MBK control step end     : 16:00:40.318.
MBKB006I MBK control step end     : 16:00:40.318.
MBKB053I MBK run step start       : 16:00:40.318.
MBKB007I [0] MBK inventory step start : 16:00:40.318.
MBKB021I [0] The partition 0 backup image taken at 20110707154108 is involved in the merge (type INCREMENTAL ONLINE DATABASE, device DISK)
MBKB008I [0] MBK inventory step end   : 16:00:40.349.
MBKB009I [0] MBK merge step start     : 16:00:40.349.
MBKB028I [0] The utility will build the partition 0 backup image taken at 20110707154109 (type FULL ONLINE DATABASE, device DISK)
MBKB021I [0] The partition 0 backup image taken at 20110707153755 is involved in the merge (type FULL ONLINE DATABASE, device DISK)
MBKB010I [0] MBK merge step end       : 16:00:41.849.
MBKB054I MBK run step end         : 16:00:41.849.
MBKI442I MBK successfully ended: real time -> 0m1.562530s

As per the output the merge was successfull. Then I attempted to restore above merged backup set to a new database. Remember merged backup image is equivalent to full backup. The attempted restore failed and db2 complained that the backup image is corrupt!!

db2 restore db zzz from C:\ taken at 20110707154109 into zzz_tmp
SQL2529W  Warning!  Restoring to an existing database that is different from
the backup image database, and the alias name "ZZZ_TMP" of the existing
database does not match the alias name "ZZZ" of the backup image, and the
database name "ZZZ_TMP" of the existing database does not match the database
name "ZZZ" of the backup image. The target database will be overwritten by the
backup version. The Roll-forward recovery logs associated with the target
database will be deleted.
Do you want to continue ? (y/n) y
SQL2530N  The backup image is corrupted.  Restore of database from this backup
image is not possible.

I felt may be my original backups (full and delta) are corrupt. I restored those backups sets instead of the merged and they work just fine. This concluded that the db2 merge utility is doing something funky.

If you find my test is not appropriate, correct me by leaving a comments.

Update: I was testing this on db2 express 9.7.0 on Window XP. Looks like this issue got resolved after I upgraded db2 to FP4. Later I also fond that if you don't want to upgrade db2 you can modify the merge utility configutaion with following file entry "vendor_object = no" in the configuration file located at "DB2TOOLS\MergeBackup11\cfg\db2mbk.cfg"

About Me

By profession I am a Database Administrator (DBA) with total 13 yrs. of experience in the field of Information Technology, out of that 9 yrs as SQL DBA and last 3 years in IBM System i/iSeries and DB2 LUW 9. I have handled Developer, plus production support roles, and I like both the roles. I love and live information technology hence the name "Techonologyyogi" Apart from that I am a small, retail investor, with small investments in India and United States in the form of Equity holdings via common stocks. Don't ask me if I have made money, I have been loosing money in stocks.