Shell script within Stored Procedure
65 pts.
0
Q:
Shell script within Stored Procedure
How do I execute a UNIX shell (.sh) script from within an MS SQL Stored Procedure?
ASKED: Apr 7 2009  2:11 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
65 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Last Answered: Apr 7 2009  2:11 PM GMT by VelameLaCosa   65 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Mshen   23535 pts.  |   Apr 8 2009  2:10AM GMT

What version of Unix/Linux are you using or is it on a windows machine?

 

mrdenny   46765 pts.  |   Apr 8 2009  8:41PM GMT

As SQL Server only runs on Windows, are you trying to run a Unix script on Windows, or do you need to log into a Unix server then run the Unix script?

 

VelameLaCosa   65 pts.  |   Apr 16 2009  5:32PM GMT

The stored procedure itself will run on a Windows 2003 Server (SQL 2005).
The script should connect to a Solaris 10 (UNIX) box to execute some commands.

 

Petkoa   1005 pts.  |   Apr 20 2009  11:07PM GMT

>
> The stored procedure itself will run on a Windows 2003 Server (SQL 2005).
> The script should connect to a Solaris 10 (UNIX) box to execute some commands.
>

So, then the easiest way will be to write and put shell script on the UNIX box, then the stored procedure should just call rsh/ssh client and execute the script.

Sure, you should (1) install some windows port of rsh/ssh on win2003 system, and (2) make arrangements for the non-interactive login (e.g., non-password protected ssh private key on win2003 system, or some rhosts assignments on the solaris system - of course, the environment should be secure enough). My advice would be to go with ssh - not because of encryption and security, unattended login should create security hole anyway, but because of ease of setup: rsh is a protocol quite tricky for firewalls.

BR and good luck,

Petko

 
0