Monday, February 20, 2012

problems when run xp_cmdshell

when I run the next procedure :

CREATE PROCEDURE usp_hh_runpackage AS

EXECUTE master..xp_cmdshell 'dtsrun /SMCMSEG001DBS /Ugefaweb /P2s3rg3f4w3b /NDTS_HHReport'
GO

I get the following error:

'dtsrun' is not recognized as an internal or external command,
operable program or batch file.

Can you help me?Do you have the sql server binn directory in the path of the login used on the sql server machine ? Do you have dtsrun.exe on the sql server machine ?|||Originally posted by rnealejr
Do you have the sql server binn directory in the path of the login used on the sql server machine ? Do you have dtsrun.exe on the sql server machine ?

yes i give the instruccion on the control panel enviroments variables for execution in anywhere i am but it doesnt work.|||Run xp_cmdshell with the 'set' command and see what it returns. The problem is that either xp_cmdshell cannot find the file or that the file does not exist.|||Originally posted by mcarrillo
yes i give the instruccion on the control panel enviroments variables for execution in anywhere i am but it doesnt work.

Open a new console windows to see if you can run dtsrun from command line.
If not you need to modify your PATH variable to add the mssql path

set mssql_binhome=x:\msssql\binn

set PATH = %mssql_binhome%;%PATH%|||Originally posted by omiossec
Open a new console windows to see if you can run dtsrun from command line.
If not you need to modify your PATH variable to add the mssql path

set mssql_binhome=x:\msssql\binn

set PATH = %mssql_binhome%;%PATH%


I can run the dtsrun in ms-dos but when I run the application I receive that message. I modify the path but i get the same error. do you have another options?

thanks.|||Originally posted by omiossec
Open a new console windows to see if you can run dtsrun from command line.
If not you need to modify your PATH variable to add the mssql path

set mssql_binhome=x:\msssql\binn

set PATH = %mssql_binhome%;%PATH%


I can run the dtsrun in ms-dos but when I run the application I receive that message. I modify the path but i get the same error. do you have another options?

thanks.|||Can you run your the xp_cmdshell in query analyzer - or does it fail ?|||Originally posted by rnealejr
Can you run your the xp_cmdshell in query analyzer - or does it fail ?

When I run in the query analyzer the xp_cmdshell to run the dtsrun command is when fail. and give me this error:

'dtsrun' is not recognized as an internal or external command,
operable program or batch file.|||What is returned when you run xp_cmdshell 'set path' ?|||The xp_cmdshell probably does not recognize the path to your dtsrun on the server machine. You probably need to have that path set on the server machine. Or try putting full path such as xp_cmdshell 'x:\mssql\binn\dtsrun....'

:::radzi::

Originally posted by mcarrillo
when I run the next procedure :

CREATE PROCEDURE usp_hh_runpackage AS

EXECUTE master..xp_cmdshell 'dtsrun /SMCMSEG001DBS /Ugefaweb /P2s3rg3f4w3b /NDTS_HHReport'
GO

I get the following error:

'dtsrun' is not recognized as an internal or external command,
operable program or batch file.

Can you help me?|||Thanks to all, I found that if I put the command in the directory of
\winnt\system32 it works !!!

Thanks and regards.

Mirtha|||That is fine to help you discover the problem but don't keep the dtsrun.exe file in that directory (that is a system directory) - you need to solve the initial problem. Keep dtsrun.exe where is belongs - moving the file creates many problems - just maintenance alone is a problem. Again, this is a path problem so verify your path.|||Originally posted by rnealejr
That is fine to help you discover the problem but don't keep the dtsrun.exe file in that directory (that is a system directory) - you need to solve the initial problem. Keep dtsrun.exe where is belongs - moving the file creates many problems - just maintenance alone is a problem. Again, this is a path problem so verify your path.

Well I am in another question because I see if I run in ms-dos that it works but the query analizer dont find the correct path.
could you be more specific where I have to make the correct path ?

Thanks .and you are right .

No comments:

Post a Comment