DB2 restore from TSM
Sun, Mar 13, 2016 · 2 minute readdatabasedb2
Recently spent some time restoring large (~800GB) database direct from TSM.
First step was to get TSM configured for a restore onto a different server.
Second step, grant access to the backup (on the source server);
52> db2adutl grant all on all for database SID
A bit permissive but it works in our closed environment.
After that we should be able to query backups on the target server.
For me, options specifying the source node and owner were needed;
46> db2adutl query options "-fromnode=SERVER_DB2 -fromowner=db2sid"
Query for database SID
Retrieving FULL DATABASE BACKUP information.
1 Time: 20150822235502 Oldest log: S0086106.LOG DB Partition Number: 0 Sessions: 2
These options were also needed in the restore command:
db2 "restore db PRD use TSM options \"-fromnode=SERVER_DB2 -fromowner=db2sid\" taken at 20150822235502 into SID logtarget '/db2/SID/log_dir' replace existing redirect"
Our first restore attempt failed with this error reported in db2diag.log
MESSAGE : SQL2025N An I/O error "-50" occurred on media "TSM".
This is described by IBM as:
The COMMTIMEOUT value on the Tivoli Storage Manager Server was not sufficient to allow the DB2 processing to build the data containers to hold the restore data.
A DB2 restore is completed in two phases:
- Create all the database containers (datafiles).
- Restore the data from backup.
It can take many hours for phase 1 to complete during which the connection with TSM remains idle, which is where COMMTimeout comes in.
If COMMTimeout is exceeded TSM thinks the clien thas gone away and kills the session.
Increasing COMMTimeout fixed the problem - for this database phase 1 took 4 hours to complete with COMMTimeut set to 18000 seconds.
During phase 1 (container build) monitoring the usual db2 list utilities show detail
is not useful as ‘work completed’ does not go up.
During this phase it is more useful to monitor file creation on the server by running something like this:
find /db2/SID/sapdata? -name \* -type f -ls | tail -4
The filenames returned by this include a tablespace ID which can be used to monitor container creation for individual tablespaces, e.g.
find /db2/SID/sapdata? -name \* -type f -ls | grep T0000026
Once phase 1 is complete the list utilities command correctly records work done by TSM.