Tuesday, December 7, 2010

Cross-node TSM Restore

Cross-node TSM restore is all about restoring a database TSM backups from some other server on to another server while accessing TSM directly from the new server. If you don't want to deal with all this you can extract the files locally and copy them over to other server.

On your original instance open and check the contents of the following file "/usr/tivoli/tsm/client/api/bin64/dsm.sys" and list your TSM node names

After identifying the node name grant appropriate previlages to the user that you will mostly like use for db restore/recover purposes.

Assuming your node name is "db2inst2x-db2", your instance name owner name is "xyzp01" and your dbname is "DB001P01" - following are are the sample commands

db2adutl revoke user xyzp01 on nodename db2inst2x for db DB001P01
db2adutl grant user xyzp01 on nodename db2inst2x-db2 for db DB001P01
db2adutl query db DB001P01 nodename db21p1x-db2 owner xyzp01

db2 restore db DB001P01 use tsm options "'-fromnode=db21p1x-db2 -fromowner=xyzp01'" TAKEN AT 20101112080432 INTO DB001P01 REDIRECT

Wednesday, May 5, 2010

Changing you Unix/AIX Profile to enable DB2 commands

I am writing this article with DB2 newbies in mind and to keep my own knowledge and experiences available when I want it :)

When I log in to AIX/Unix box and if I try to run DB2 command it fails with following message

"ksh: db2: not found"

This is becauase the DB2 user profile is not loaded into your shell environment. To load it automatically whenever you login, you need to edit your ".profile" file. Below are the step for the same. This is very similar to window DOS environment setup with environment variables and set path etc.

type "vi .profile" in the console window. vi editor should open up with the contents of the .profile file. After the vi is open, it's in command mode, so whatever you type it will not be visible on the screen. By chance you some some valid vi command you will see some action else nothing will be happening.

In my case here is how it looks like, just so that you know how the vi editor looks like

You can refer to below URL for vi commands. With the help of vi command you should be able to put the following text into the .profile that you have opened.

# The following three lines have been added by UDB DB2.
if [ -f /home/db2inst1/sqllib/db2profile ]; then
. /home/db2inst1/sqllib/db2profile

Or you may want to just copy above line and just paste it {ESC}i and right click with a mouse(assuming the contents are in the clipboard)

After you are done with editing enter ":wq" command to save and quit the editor.

For this profile change to take effect you need to log-off and log back in. When you log back in, try db2 and it should take you to DB2 prompt.

Hope this serves some help to people who are new to DB2 and coming from windows background like I do.

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.