SHELL调用Trafodion SQL与并发执行

来源:互联网 发布:ubuntu软件中心搜索框 编辑:程序博客网 时间:2024/05/16 09:10

本文总结了几种在SHELL脚本中调用Trafodion SQL语句的方法,供读者参考~
这里假设执行SHELL脚本的用户为trafodion用户,调用方法示例如下,如果执行SHELL脚本的用户为非trafodion用户,需要在脚本中另外添加一些su到trafodion用户的步骤,在此不做详述。

[trafodion@n12 ~]$ cat test.sh#method 1echo "select count(*) from trafodion.seabase.test_table;exit;" | trafci#method 2trafci < /home/trafodion/test.sql#method 3$MY_SQROOT/trafci/bin/trafci.sh -h n12:23400 -u zz -p zz -s "/home/trafodion/test.sql"[trafodion@n12 ~]$ cat test.sqlselect count(*) from trafodion.seabase.test_table;exit;

下面一个例子是通过SHELL脚本并发执行SQL查询,并发数即For循环的次数,

for ((i=0;i<50;i++));do    sleep 1    trafci < single.sql >> log.txt &    echo `date`doneexit
1 0
原创粉丝点击