在linux上运行teredata查询

时间:2021-03-01 22:50:01

I am in badly need of some direction here :) ,there is an batch file(.bat) which runs an teredata query on windows, but for some reasons i will have to use Linux server from now on

我在这里非常需要一些方向:),有一个批处理文件(.bat)在Windows上运行teredata查询,但由于某些原因,我将不得不从现在开始使用Linux服务器

test.bat

echo off
bteq < D:\commands.txt > D:\output.txt 2>&1
@echo off goto end
:end @echo exit 

commands.txt

.LOGON ------
select (date);
.LOGOFF

how can i do this on red hat - linux? and is it necessary to have bteq utilities or any other Teredata utilities , i have got teredata ODBC drivers on linux though. it would be great if any one could give an insight onto this ?

我怎么能在red hat-linux上做到这一点?并且有必要使用bteq实用程序或任何其他Teredata实用程序,但我在Linux上有teredata ODBC驱动程序。如果有人能够对此有所了解,那会很棒吗?

Thank you

1 个解决方案

#1


1  

BTEQ is available on multiple flavours of Windows/Unix/linux including RedHat.

BTEQ可用于多种Windows / Unix / Linux,包括RedHat。

BTEQ can't use ODBC, need to install it plus some other packages like cli.

BTEQ不能使用ODBC,需要安装它加上一些像cli这样的其他软件包。

You just might have to do some minor modifications in your BTEQ script, e.g. backslash to slash in pathname, rm instead of del in .OS.

您可能需要在BTEQ脚本中进行一些小修改,例如:反斜杠在路径名中斜杠,rm而不是.OS中的del。

Otherwise you can run this as a shell script (you just have to decide which Unix shell to use: sh, ksh, bash, etc.), all you can do in a Windows bat can be done in Unix shel, too.

否则你可以把它作为一个shell脚本运行(你只需要决定使用哪个Unix shell:sh,ksh,bash等),所有你在Windows bat中可以做的事情也可以在Unix shel中完成。

Make the script executable using chmod u+x test.sh

使用chmod u + x test.sh使脚本可执行

 #!/bin/sh
 bteq < /...../commands.txt > /...../output.txt 2>&1

and then simply run it from the command prompt.

然后只需从命令提示符运行它。

#1


1  

BTEQ is available on multiple flavours of Windows/Unix/linux including RedHat.

BTEQ可用于多种Windows / Unix / Linux,包括RedHat。

BTEQ can't use ODBC, need to install it plus some other packages like cli.

BTEQ不能使用ODBC,需要安装它加上一些像cli这样的其他软件包。

You just might have to do some minor modifications in your BTEQ script, e.g. backslash to slash in pathname, rm instead of del in .OS.

您可能需要在BTEQ脚本中进行一些小修改,例如:反斜杠在路径名中斜杠,rm而不是.OS中的del。

Otherwise you can run this as a shell script (you just have to decide which Unix shell to use: sh, ksh, bash, etc.), all you can do in a Windows bat can be done in Unix shel, too.

否则你可以把它作为一个shell脚本运行(你只需要决定使用哪个Unix shell:sh,ksh,bash等),所有你在Windows bat中可以做的事情也可以在Unix shel中完成。

Make the script executable using chmod u+x test.sh

使用chmod u + x test.sh使脚本可执行

 #!/bin/sh
 bteq < /...../commands.txt > /...../output.txt 2>&1

and then simply run it from the command prompt.

然后只需从命令提示符运行它。