Database command execution

Database
Enthusiast

Database command execution

Just wondering if there is a way to get the database server to execute command like ftp to backup some files on another server. I connect to TD using bteq or jdbc from a windows client.

the command im trying to get executed needs to run on the server, so (bteq .OS feature is not what im after). Im happy even if i can get the server to execute a script which resides in /tmp. 

TD installed on Linux

6 REPLIES
Enthusiast

Re: Database command execution

Should have added .. looking for something similar to xp_cmdshell for MS SQL..

Senior Supporter

Re: Database command execution

Don't be sure that I get this right.

Can't you connect via ssh (user and password required) to the linux and run the command there? 

Or do you want to call the action out of an bteq or JDBC session? In this case check external stored procedures.

Enthusiast

Re: Database command execution

Unfortunately, ssh is not a option.. if that were the case, I would have loved to have a cronjob that does the trick. 

It needs to be be through bteq or JDBC.

What im trying to avoid is writing a C/C++ UDF that runs system commands..

Senior Supporter

Re: Database command execution

Will not work - TD system will not let you get access to nodw file system with native commands. At least I am not aware and I really would wonder if it will work.

Enthusiast

Re: Database command execution

I see your point.. You actually wont know which node processes the statement as a result could be I/O on any node.

This http://forums.teradata.com/forum/connectivity/how-to-write-udf-to-handle-operating-system-io-operati... led me to believe that file i/o is possible.

Interesting.. back to the drawing board.. its really sad that there is no way to get xp_cmdshell or  UTIL package like in oracle..

Teradata Employee

Re: Database command execution

There are at least a couple of ways to do this, but they are not officially supported. If you are a customer or a partner, then you should open an incident with Customer Support and we can work with you.

A couple of possibilities are:

1. The Teradata JDBC Driver can connect to the DBCCONS partition, and there is a pdewrap program that permits you to execute any arbitrary OS command. However, the DBCCONS partition is a Teradata-proprietary, unsupported feature.

2. A Java Stored Procedure can run a OS command. However, this is unsupported, because of the potential to mess up workload management on the Teradata node.