AIX Server,实例:db2inst2 ,数据库:CPW。部署脚本,每天做online backup use tsm。
客户发现备份失败。
检查report发现SQL2033 错误。
运行db2 backup db cpw use tsm检查错误码:sql2033,tsm error code 106
查看Sql2033的解释:
检查为TSM设置的环境变量:
需要写权限的应该只有LOG,检查LOG的权限:
权限没发现问题,还是不放心,touch一个文件,并且cat些text以确定可以写入:
确定LOG dir权限没问题,那么是哪个文件出问题了呢,想到TSM错误日志在dsm.sys里面指定,检查:
显然,db2inst2没有写/home/inst1/dsierror.log的权限。
切换到user inst1,修改/home/inst1/dsierror.log的权限,允许db2inst2写入:
运行备份脚本测试:
客户发现备份失败。
检查report发现SQL2033 错误。
*------------------------------------------------------------------*
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的解释:
db2inst2@b03cxnp01049:/home/db2inst2> db2 ? sql2033
SQL2033N An error occurred while accessing TSM during the processing of
a database utility. TSM reason code: "<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设置的环境变量:
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的权限:
db2inst2@b03cxnp01049:/home/db2inst2> ls -ld /u/db2inst2
drwxr-xr-x 8 db2inst2 staff 4096 Jan 20 04:55 /u/db2inst2
权限没发现问题,还是不放心,touch一个文件,并且cat些text以确定可以写入:
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里面指定,检查:
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写入:
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
运行备份脚本测试:
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