mor*_*hai 2 unix db2 sql-scripts su
我怎样才能su从root到db2inst1和调用SQL脚本都在1号线?我在考虑这样的事情:
su db2inst1 | db2 CONNECT TO myDatabase USER db2inst1 USING mypw; db2 -c -i -w -td@ -f /tmp/deploy/sql/My.sql | exit;
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
您可以使用-c或--command=<command>选项执行命令su.在你的情况下,这样的事情:
su -c 'db2 CONNECT TO myDatabase USER db2inst1 USING mypw; db2 -c -i -w -td@ -f /tmp/deploy/sql/My.sql' db2inst1
Run Code Online (Sandbox Code Playgroud)