【发布时间】:2010-09-07 00:52:33
【问题描述】:
我正在尝试制作一个 bash 脚本来备份一个 db2 数据库,然后将它恢复到另一个数据库中。问题是 DB2 提出了一个 (y/n) 问题,而我无法获得自动回答,它需要一个 y 和回车符。
我已经尝试了以下行(和 yes 命令)但它不起作用
#while true; do echo y; done | db2 restore database $SOURCE taken at $DB2TIME into $TARGET
restore database 命令执行后,我从 db2 得到以下输出:
SQL2528W Warning! Restoring to an existing database that is the same as the
backup image database, but the alias name "######" of the existing database
does not match the alias "$$$$$" of backup image, and the database name
"#######" of the existing database does not match the database name "$$$$$" of
the backup image. The target database will be overwritten by the backup
version.
Do you want to continue ? (y/n)
【问题讨论】: