IT分销/经销数据库backup

Backup failed due to TSM error 106的解决思路

AIX Server,实例:db2inst2 ,数据库:CPW。部署脚本,每天做online backup use tsm。

客户发现备份失败。

检查report发现SQL2033 错误。

Sql代码

*------------------------------------------------------------------*   Starting database backup               Sun Dec 25 04:01:01 CUT 2011  *------------------------------------------------------------------*  
Start timestamp of backup is Sun Dec 25 04:01:01 CUT 2011  
Issuing this command: db2 backup database CPW  online use tsm open 2 sessions without prompting  
*------------------------------------------------------------------*  
SQL Return code = -2033   Backup of database CPW failed  


运行db2 backup db cpw use tsm检查错误码:sql2033,tsm error code 106

查看Sql2033的解释:
Sql代码

db2inst2@b03cxnp01049:/home/db2inst2> db2 ? sql2033  

SQL2033N  An error occurred while accessing TSM during the processing of        a database utility. TSM reason code: "".  
Explanation:  
Some common TSM reason codes are:  
106  
         The specified file is being used by another process. You tried           to read from or write to a file that is currently being used by           another process.  User response:  
Responses for common TSM problems are:  
106  
         Ensure that you specified the correct file or directory name,           correct the permissions, or specify a new location.  


检查为TSM设置的环境变量:
Sql代码

db2inst2@b03cxnp01049:/home/db2inst2> env |grep -i dsm  DSMI_CONFIG=/usr/tivoli/tsm/client/api/bin64/dsm.opt  DSM_LOG=/u/db2inst2  DSMI_LOG=/u/db2inst2  DSMI_DIR=/usr/tivoli/tsm/client/api/bin64  


需要写权限的应该只有LOG,检查LOG的权限:
Sql代码

db2inst2@b03cxnp01049:/home/db2inst2> ls -ld /u/db2inst2  drwxr-xr-x    8 db2inst2 staff          4096 Jan 20 04:55 /u/db2inst2  


权限没发现问题,还是不放心,touch一个文件,并且cat些text以确定可以写入:
Sql代码

db2inst2@b03cxnp01049:/home/db2inst2> touch /u/db2inst2/test  db2inst2@b03cxnp01049:/home/db2inst2> cat > /u/db2inst2/test  test  db2inst2@b03cxnp01049:/home/db2inst2> ls -l /u/db2inst2/test  -rw-------    1 db2inst2 db2iadm2          5 Jan 20 07:31 /u/db2inst2/test  db2inst2@b03cxnp01049:/home/db2inst2> cat /u/db2inst2/test  test  


确定LOG dir权限没问题,那么是哪个文件出问题了呢,想到TSM错误日志在dsm.sys里面指定,检查:
Sql代码

db2inst2@b03cxnp01049:/usr/tivoli/tsm/client/api/bin64> grep ERROR /usr/tivoli/tsm/client/api/bin64/dsm.sys  ERRORLOGRETENTION       7,d  ERRORLOGNAME            /home/inst1/dsierror.log  db2inst2@b03cxnp01049:/usr/tivoli/tsm/client/api/bin64> ls -l /home/inst1/dsierror.log  -rw-r--r--    1 inst1    sysadm1           0 Jul 18 2010  /home/inst1/dsierror.log  


显然,db2inst2没有写/home/inst1/dsierror.log的权限。
切换到user inst1,修改/home/inst1/dsierror.log的权限,允许db2inst2写入:
Sql代码

inst1@b03cxnp01049:/home/inst1> chmod 777 /home/inst1/dsierror.log  inst1@b03cxnp01049:/home/inst1> ls -l /home/inst1/dsierror.log  -rwxrwxrwx    1 inst1    sysadm1           0 Jul 18 2010  /home/inst1/dsierror.log  


运行备份脚本测试:
Sql代码

Starting online backup  Issuing this DB2 command:  backup db CPW online   use tsm  backup db CPW online use tsm  
Backup successful. The timestamp for this backup image is : 20120120045654  
参与1

0同行回答

“答”则兼济天下,请您为题主分忧!

提问者

智长老
数据库管理员IBM ISSC

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2012-01-20
  • 关注会员:1 人
  • 问题浏览:5735
  • X社区推广