How to work with TSM commands
The most commons TSM commands used to work as DBA
- Checking where is ADSM config and log
env | grep -i dsm
Config is usually on /usr/tivoli/tsm/client/ba/bin/dsm.sys
Opt file is usually on /usr/tivoli/tsm/client/ba/bin/dsm.opt
API config files are under /usr/tivoli/tsm/client/api/bin64 or /usr/tivoli/tsm/client/api/bin
- Verifying if files are archived on TSM
cd to the target directory and do:
dsmc q ba ' filename_with_optional_wildcards*' -inactive
If you are using db2adutl and you want to check backup imanges and log on TSM, you have to specific the path: /<DB_NAME>/NODE0000/*
Example:
dsmc q ba /SAMPLE/NODE0000/*
dsmc q arc /SAMPLE/NODE0000/*
- Sending files to TSM
cd to the target directory and do:
dsmc incremental ' filename_with_optional_wildcards*'
- Restoring files from TSM
cd to the target directory and do:
dsmc restore "filename_with_optional_wildcards" -inactive
Examples:
cd /db2/db2inst1
dsmc incremental 'runstats.ddl‘
dsmc q ba 'run*' –inactive
dsmc restore 'runstats.ddl' -inactive
Note: If you don’t want to cd to the target directory you can enter with the complete
path on the TSM commands
The db2adutl utility
The db2adutl is a very useful command that comes with DB2 to manage old backups and logfiles that reside on the Tivoli Storage Manager server. The tool is located in the $HOME/sqllib/adsm directory of the instance owner. The db2adutl utility provides the ability to query, extract, delete, and verify backups, loadcopies, and log archives from Tivoli Storage Manager. All backup file names include a time stamp and therefore are unique for every backup to Tivoli Storage Manager. The backup copies in Tivoli Storage
Manager are therefore always active and never deleted by normal Tivoli Storage Manager file expiration processing. The db2adutl utility provides a way of deleting backups and log files that are no longer required.
Verification using db2adutl
In this section, we will focus on some options of the db2adutl command and how they may be used to verify the DB2 backups.
The query option of the db2adutl utility can be used to get general information about which database backups, logfiles and load copies reside on the Tivoli Storage Manager server.
$ db2adult query db sample
Output
Query for database SAMPLE
Retrieving full database backup information.
full database backup image: 1, Time: 20010314084325
Oldest log: S0000019.LOG, Node: 0, Sessions used: 1
full database backup image: 2, Time: 20010314084246
Oldest log: S0000019.LOG, Node: 0, Sessions used: 2
Retrieving tablespace backup information.
No tablespace backup images found for SAMPLE
Retrieving load copy information.
No load copy images found for SAMPLE
Retrieving log archive information.
Log file: S0000019.LOG, Node: 0, Taken at: 2001-03-14-08.43.13
Log file: S0000020.LOG, Node: 0, Taken at: 2001-03-14-08.43.48
Restoring an image backup with db2adutl
db2adutl extract full taken at 'timestamp' database xxxxx