How to Connect to Teradata and Run in Shell Script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to Connect to Teradata and Run in Shell Script?
# 1  
Old 12-17-2015
How to Connect to Teradata and Run in Shell Script?

Hi Master,

I need to create dan run script in linux to get data from teradata

I did this

---------- Post updated at 02:28 AM ---------- Previous update was at 02:25 AM ----------

Code:
LOG_DIR="/home/";
OUTDIR="/home/";
SCRIPT_NAME=“test";
DUMPFILE="${OUTDIR}${SCRIPT_NAME}"_"$(date +"%Y%m%d%H").txt";
USERID=“A12345";
PASWD=“B342a12";
LOGNAME="test_"$(date +"%Y%m%d%H")".sql";



#======================================================================================#
/usr/bin/bteq << END-OF-SQL >> ${LOG_DIR}${LOGNAME};
.logmech ldap;
.LOGON tdprod/${USERID},${PASWD};
.Set Format off
.Set Recordmode off
.Set Echoreq on
.Set Separator '|'
.width 3000
.Set Titledashes off
.Export REPORT FILE = ${DUMPFILE}


SELECT
        top 5*
FROM transactional_ldp


.Export Reset
.LOGOFF
.QUIT
END-OF-SQL

but it always ended up with errors
Code:
line 7: unexpected EOF while looking for matching `"'

Code:
line 33: syntax error: unexpected end of file

Please help

Last edited by radius; 12-17-2015 at 03:27 AM.. Reason: to complete the information
# 2  
Old 12-17-2015
The first double-quote character on the line:
Code:
SCRIPT_NAME=test";

is the wrong character. Change that line to:
Code:
SCRIPT_NAME="test";

and try again.
This User Gave Thanks to Don Cragun For This Post:
# 3  
Old 12-17-2015
huge thanks Sir Don, its solved
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

Shell script to connect

hello i try to made a report to conect all database to diferent OS HP-UX/LINUX/SOLARIS/AIX this is my example i have 5 db OS are HP-UX ps -fea | grep pmon root 1120 1 0 Nov 29 ? 5:14 ipmon -sD oracle 10286 1 0 Nov 29 ? 27:19 ora_pmon_BD1 oracle 10431... (7 Replies)
Discussion started by: ceciaide
7 Replies

3. Shell Programming and Scripting

Connection with Teradata through shell Script

Hi All, As we are using SQLPLUS command to connect Oracle Database in unix: Like below syntax: sqlplus username/password@dbname << EOI SET HEADING OFF SPOOL MAX_DATE_VAL.txt select max(LAST_UPDT_DATE) from source_defect; SPOOL OFF here the result is stored in... (0 Replies)
Discussion started by: Shilpi Gupta
0 Replies

4. Shell Programming and Scripting

Connect Oracle using shell script at run time

Hi all, I am a newbie.....am jus trying to connect to oracle thro a script, but not thro giving the username/password@server_name directly like `$ORACLE_HOME/bin/sqlplus username/password@server_name In the above line, once it is connected to Oracle, it shud ask me the username and password... (4 Replies)
Discussion started by: kritibalu
4 Replies

5. Shell Programming and Scripting

connect to db2 using shell script

Guys, I am trying to write a shell script that connect to wcsprod database and read the query #!/bin/ksh sqlplus -s < connect to wcsprod user wcsadm using pwd > select * from catentry fetch first 1 row only with ur; databse: wcsprod user: wcsadm pwd: pwd thanks (1 Reply)
Discussion started by: skatpally
1 Replies

6. Shell Programming and Scripting

Connect to oracle db using shell script

Hi, I want to connect to oracle db using unix shell script. And i want to retrieve data from db through shell script. Please help me as soon as possible. Thanks, J.P. Das (1 Reply)
Discussion started by: jyotidas
1 Replies

7. Programming

Connect To Teradata

How do i connect from C program to teradata Database? The C program is being executed from a Unix script, AIX. I am calling a C program from a Unix shell script and the C Program executes some SQLs on Teradata Database. (3 Replies)
Discussion started by: yschd
3 Replies

8. Shell Programming and Scripting

Connect two servers in shell script

Hello all, I know that is a question which has made too many times, and I have been looking into the threads but all posted was not sucessfully for me so... I need a shell script which connect two unix servers, but NOT using ssh... Is there another way to do it? I've tried ssh but it didn't... (1 Reply)
Discussion started by: Geller
1 Replies

9. Shell Programming and Scripting

Shell/perl script to connect to different servers in single login in teradata

Hi, I want to write a shell script to compare two tables in teradata.these tables are present on different servers. I want to connect to both servers in single login in order to fetch and compare the data in one go. Thanks (1 Reply)
Discussion started by: monika
1 Replies
Login or Register to Ask a Question