Paramiko模块,访问AIX系统,后台执行sql文件,提示DB21018E错误,如何解决?

问题描述

利用python的Paramiko模块 SSH连接远程AIX系统,无法对DB2数据库进行后台执行sql文件,代码如下:

# client是 paramiko的SSHClient实例  
client.exec_command("db2 -tvf test.sql > test.log 2>&1 &")

提示错误如下:

DB21018E  A system error occurred. The command line processor could not continue processing.

不使用后台执行,则能够成功执行:

client.exec_command("db2 -tvf test.sql")  # 这样能够执行,并得到结果 

怀疑 SSHClient 关闭连接时,对进程发送了中断信号,于是做下面的尝试,也是报DB21018E。

client.exec_command("nohup db2 -tvf test.sql > test.log 2>&1 &")

想实现 后台执行 sql文件,但是不得其解,望各位大神指点,谢谢。

阅读 7.1k
1 个回答

试试这个
nohup xxxxx >/dev/null 2>log &

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题