我正在尝试运行备份脚本来备份数据库Sample
su -c "${DB2Home}/db2 quiesce database immediate force connections" ${InstanceName}
echo "[INFO:`date`]Executing the backup command: ${DB2Home}/db2 backup database ${Primary_Server_DBName} to ${BackupFolder} compress without prompting "
su -c "${DB2Home}/db2 backup database ${Primary_Server_DBName} to ${BackupFolder} compress without prompting" ${InstanceName}
我以root用户身份执行脚本而不是db2inst1用户
我收到以下错误
[INFO:Tue Oct 21 18:44:23 IST 2014]Executing the backup command: /opt/ibm/db2/V10.5/bin/db2 backup database TIPDB to /home/db2inst1/backupFolder compress without prompting
DB21019E An error occurred while accessing the directory
"/root".
答案 0 :(得分:1)
解决方案是添加 。的/ home / DB2INST1 / SQLLIB / db2profile中
在db2操作之前
答案 1 :(得分:-1)
在运行脚本之前使用:
su - db2inst1
然后像往常一样运行脚本:
db2 -stvf /yourpath/createDatabase1.sql