Automate my Teradata queries

Database
Enthusiast

Automate my Teradata queries

Hi,

I have some teradata codes which I want to automate. It should be done in a way that they can execute themselves on a specific date/time of a month. 

Any help will be appreciated.

Regards,

Prateek

Tags (1)
8 REPLIES
Senior Supporter

Re: Automate my Teradata queries

Calling the SQLs from BTEQ and schedule the BTEQ calls with a scheduler, cron etc....

Enthusiast

Re: Automate my Teradata queries

Hey, thank for replying. Can you please elaborate a bit?

Enthusiast

Re: Automate my Teradata queries

Hi Parteek,

You need to put your SQL code inside Bteq as said by Ulrich. BTEQ is a Teradata sql processing tool, if you need further information about Bteq, do let me know. if you have an idea of Bteq then put your code in Bteq and use some job schedular to automate the Bteq script calls.

There are numerous job schedulars available in market, a list is available at

http://en.wikipedia.org/wiki/List_of_job_scheduler_software

You can also use linux feature as given at below URL

http://www.ibm.com/developerworks/opensource/library/l-job-scheduling/index.html

Khurram
Enthusiast

Re: Automate my Teradata queries

You can read the following blog to have a basic idea of Bteq

http://www.teradatahelp.com/2010/09/introduction-to-teradata-utilities-bteq_02.html

Khurram
Enthusiast

Re: Automate my Teradata queries

Hi Prateek,

You can put your modularized codes according to the way they can execute themselves with all the logics, conditional and branching required with date/time inside a stored procedure. If it is just one one chunk of function or subject area, then you can put in one proc. If you have many procs and inter dependencies, then you can use schedulers. The best practice is to have audit log and restartability.

There are so many schedulers available.

Thanks and regards,

Raja

Enthusiast

Re: Automate my Teradata queries

Thanks guys, this was helpfull. :)

Enthusiast

Re: Automate my Teradata queries

Dear all, 

I have the same enquiry: I want to schedule my Teradata query to run every day at a given time but I am not sure I have understood the approach with BTEQ... Could you please elaborate more about this solution? An example would be more than appreciated. 

Best regards. 

Ckp
Enthusiast

Re: Automate my Teradata queries

Say if I need to refresh the content of my table at 1:00 AM every friday,

I will use the following btq script (which includes insert query) and unix scheduler like cron:

btq script example :

.logon <teradata serverName>/<UserId>,<Password>;;

drop table DB.<Table>;

create table DB.<Table>

(store_Id smallint);

.IMPORT DATA FILE=/<path to file>/in.dat

.QUIET ON

.REPEAT *

USING  storeId (smallint)

insert into DB.<Table>(store_Id) values (:storeId)

;

.logoff;

.quit;

 

CRON Example :

00 1 * * 5 sh  /<path to your script>/Script.sh 1>>/<path to log>/Script.log 2>&1

00- Minutes

1 -  Hour

* - Every

5 - 5th day of week (Starting from Monday so in this case Friday)