Running Xp_cmdshell

Jun 15, 2004

Hi all,
Pls let me know how to run xp_cmdshell command for a user who does not belong to sysadmin role.
Rgds
Srinivas varanasi

View 1 Replies


ADVERTISEMENT

Error Running Xp_cmdshell

May 24, 2000

Hi everybody,

I am getting an error while running the XP_CMDSHELL 'NET USER /DOMAIN'.
But when I run the same command for sp_cmdshell 'net user' it works fine. It giving me the local users that are available on the my local pc. But now i want the domain users on my network which is not working with the xp_cmdshell..


Thanks in advance......

View 1 Replies View Related

Xp_cmdshell Running As A Sql Agent Job

Feb 9, 2007

I have created a job that runs this code:

exec master..xp_cmdshell 'D:Trace_outputAuto_perfmonAutoperfmon.bat'

This runs fine as long as I place the counter.txt file in the windowssystem32 dir.

The bat file has this code:


typeperf -cf counter.txt -o D:Trace_outputAuto_perfMonautoperf

This starts without any issues and i see typeperf.exe in the taskmanger.

The question i have is how can i stop this without having to go into taskmanager and killing typeperf.exe?

thanks for your time

View 1 Replies View Related

How To Check If Xp_cmdshell Is Running Or Not?

May 2, 2008

If possible, in both platforms, 2000 and 2005.


---
http://www.ssisdude.blogspot.com/

View 2 Replies View Related

Error While Running Xp_cmdshell

Jul 23, 2005

I am getting the following error when running a command in QueryAnalyzer.Msg 50001, Level 1, State 50001xpsql.cpp: Error 5 from CreateProcess on line 675Here is the command that I am running that generates this errormessage:xp_cmdshell "@ECHO test message > c: empewtemp.txt"The command inside the xp_cmdshell command runs successfully from aWindows command prompt. Simpler commands also fail with the same errormessage. For example:xp_cmdshell 'dir'Can anyone suggest a solution to this problem? I assume this problem isdue to a permissions/security issue. I have given Everyone Full Controlover c: emp.Windows 2000SQL Server 2000Thanks for any help.

View 4 Replies View Related

Kill Process That's Running Xp_cmdshell

Feb 1, 2001

I executed xp_cmdshell command.
More than 24 hours this process still running.
I tried killing this process with enterprise manager and query analyser, both
gave me a message saying its successfully killed. But when i do a sp_who,
the process still their executing.

how can I kill this process that's running xp_cmdshell

thanks

View 1 Replies View Related

Security Problem Running Xp_cmdshell From Non-sa Account

Dec 17, 1999

Our system is MS SQL Server v7 and NT 4. We have a stored procedure that exec's xp_cmdshell to run an external program located on the server. When a user who has 'sa' rights runs this stored procedure it works fine. When a 'non-sa' user (via the "BuiltinUsers" NT account) runs it, xp_cmdshell produces the following error:

Msg 50001, Level 1, State 50001
xpsql.c: Error 1385 from LogonUser on line 476

Is there an NT security or SQL Server setting I've overlooked that can be changed to allow non-sa users to xp_cmdshell programs?

n.b. The BuiltinUsers account does already have execute permission on the xp_cmdshell procedure.

View 3 Replies View Related

TempDB Log File Running Out Of Free Space While Running DBCC CheckDB On Large Database

May 28, 2015

In my environment, there is maintenance plan configured on one of the server and while running DBCC checkdb on a database of size around 200GB, log file usage of tempdb is increasing and causing the maintenance job to fail.

What can I do to make the maintenance job run successfully, size of the tempdb database is only 50GB and recovery model is set to simple. It cannot be increased as the mount point on which it is residing is 50GB.

View 3 Replies View Related

How To Kill A Long Running Query Running On A Background Thread.

Sep 1, 2006


If I start a long running query running on a background thread is there a way to abort the query so that it does not continue running on SQL server?

The query would be running on SQL Server 2005 from a Windows form application using the Background worker component. So the query would have been started from the background workers DoWork event using ado.net. If the user clicks an abort button in the UI I would want the query to die so that it does not continue to use sql server resources.

Is there a way to do this?

Thanks


View 1 Replies View Related

Stored Proc Is Running Much Slower Than Running The Script Directly

Mar 14, 2008

One of my stored procs, taking one parameter, is running about 2+ minutes. But if I run the same script in the stored proc with the same parameter hardcoded, the query only runs in a couple of seconds. The execution plans are different as well. Any reason why this could happen? TIA.

View 6 Replies View Related

DTS & Xp_cmdshell

May 15, 2001

Hello,

I am trying to create a directory containing the date and then copy all the files in the current directory to it.

If I run the T-SQL script found below within Query Analyser it works fine (directory is created and files are copied in to it).

But if I run it as SQL task within DTS, only the directory is created. The files are not copied in to it!?!

I thought it maybe a permissions problem, but the SQL Server/Agent account is a local administrator and has sysadmin role with SQL Server.

I would be grateful of any assistance in this problem.

Thanks in advance,
Chris.

SQL:

declare @directoryname varchar(200)
declare @doscmd varchar(255)

select @directoryname = 'e:Audit_table_archive' + rtrim(cast(day(getdate())as char)) + rtrim(cast(month(getdate())as char)) + rtrim(cast(year(getdate())as char))

select @doscmd = 'mkdir ' + @directoryname

exec master..xp_cmdshell @doscmd

select @doscmd = 'copy e:Audit_table_archive*.* e:Audit_table_archive' + rtrim(cast(day(getdate())as char)) + rtrim(cast(month(getdate())as char)) + rtrim(cast(year(getdate())as char)) + '*.*'

exec master..xp_cmdshell @doscmd

View 1 Replies View Related

Ftp Through Xp_cmdshell Help?

Jul 9, 2001

does anyone know how to execute a FTP command through sql server 7? I am creation a table and need to ftp the result set. I have it currently creation the table, turning it into a CSV txt file and placing it in a directory. I have to then manually ftp the txt file. I want to automate this process but I cant get the FTP command to execute throught the xp_cmdshell. It will work at the DOS prompt though so I know the syntax is correct. Any sugetsions would be appreciated.
-Nathan

View 2 Replies View Related

Xp_cmdshell

Aug 10, 2001

hi everybody
My requirement is, I have to transfer database backup files from one server to another server to take tape backup. Generally in my backup folder there will be 4days backups. I want to schedule a job so that after database backed up, today’s backup file only copied to the other server. I wrote following code, upto xp_cmdshell every thing is working fine.
But xp_cmdshell statement is giving error. I have to use variable value with sp_cmdshell. Please give me the solution for this.



declare @year1 as varchar(4),@month1 as varchar(2),@day1 varchar(2),@filename varchar(40)
set @year1=ltrim(str(year(getdate())))
if month(getdate())<10
set @month1='0'+ltrim(str(month(getdate())))
else
set @month1=ltrim(str(month(getdate())))
if day(getdate())-1 <10
set @day1='0'+ltrim(str(day(getdate())-1))
else
set @day1=ltrim(str(day(getdate())-1))

set @filename='EMPTest_db_'+ @year1+@month1+@day1+'*.bak'

xp_cmdshell @a



thanks
Keerthi

View 1 Replies View Related

Xp_cmdshell

Aug 17, 2001

I am trying to run a Visual Basic Script using the xp_cmdshell stored procedure. When I try to run the file, the MS Script Debugger application is started.

I run the script like this: "xp_cmdshell 'D:ScriptFilesSpaceMail.vbs'"

I can run it from the DOS prompt successfully, but not from Query Analyzer. Does anyone have any suggestions on how to prevent the MS Script Debugger from running?

Chris

View 1 Replies View Related

Xp_cmdshell

Sep 7, 2001

Hi,

I am trying to run bcp with xp_cmdshell inside a trigger. Whenver I update table the server is hanging. It creates the file in specified location but of ZERO size and I cannot delete it unless I stop SQL server service.

The smae code runs from a stored procedure without any problem.

Can you pl tell me if there are any LIMITATIONS with xp_cmdshell and Trigger.

Thanks

sekhar

View 1 Replies View Related

Xp_cmdshell

Apr 14, 2000

Hi!!!

Can someone help me?
How can I get the result of following execution in some stored procedure, and work with it:

exec xp_cmdshell 'dir c:'

Thanx in advance
Laert

View 1 Replies View Related

Using Xp_cmdshell

Nov 1, 2000

Hi,
while using XP_cmdshell for renaming a file , can I concatenate the current date to the file?
Ramam

View 1 Replies View Related

Xp_cmdshell

Nov 28, 2000

Hi,

What is best way to compare two files and get the most recent one using xp_cmdshell?

Thanks

TT

View 1 Replies View Related

Xp_cmdshell

Nov 28, 2000

Hi,

I am trying to execute this command.
use master
exec xp_cmdshell..'dir estserverest_dataInventory_Files*.txt /b'

I am getting the following error..

output
------------------------------------------------------------------------------Logon failure: unknown user name or bad password.

I am logged on as 'sa' for that server.

Any suggestion on how to resolve this?

Thanks in advance.

View 1 Replies View Related

Xp_cmdshell

Mar 8, 2000

Hai ,

I beleive this is simple question but I have problem using this command

I was trying to delete contents of a temp folder thru TSQL.
Correct me if wrong
For example
xp_cmdshell " del c:emp*.*"
This is leading me to prompt 'Are you sure to delete Y/N'.
How do I write a command to say Y.
I want to schedule this every week. Is there any other way to do this task
like using AT command ,etc.

Thank you in advance
Surya

View 1 Replies View Related

Xp_cmdshell

Mar 1, 2000

Hi !

I am trying to use xp_cmdshell
---
xp_cmdshell 'dir abcc$'

---
where abc is host name
and C$ is shared name

I get the following error message
"Logon failure: unknown user name or bad password."
I execute the same command at the dos prompt , I get the directory listing

Any suggestions??

Thanks.
KMM

View 2 Replies View Related

Using Xp_cmdshell To Run An .EXE

Jul 6, 2000

Hi Guys,
i am trying to run an .exe file from queryanalyzer for my testing.I am using the following command
exec master..xp_Cmdshell 'C:extEXEproject1.exe -SCHEETAH -Uvijay -Pbell'
CHEETAH is my server name
User :vijay
pwd:bell
the problem is its running forever in QueryAnalyzer,when i tried to run the
same thing from dosprompt its executing fine.
Please help me in this
thanks for any help

View 1 Replies View Related

Xp_cmdshell

Jun 6, 2003

SQL 7.0
I have given a non sa user permissions to run xp_cmdshell via his NT logon. When he runs it and does a "dir" of the server it works. When he trys to do a "dir" of his own machine it comes up with "Logon failure unknown user name or bad password".
SQL Agent is running under a domain admin account. I have placed SQLAgentCmdExec in the servers local administrators group. I have de-selected the option from SQLAgent propertiesJob System which restricts non sa users executing CmdExec stuff. I did attempt to Reset Proxy Account and Reset Proxy Password. When I clicked on these it just gave me message that the account and password had successfully been reset without asking me for username, password or domain.

View 5 Replies View Related

Xp_cmdshell

Sep 24, 2003

Hello, friends,
This is probably not a question for DBA forum, but may be someone knows the answer.
In the stored procedure I'm using xp_cmdshell command to copy file from one dir to another.
How I can receive any indication what the process succeded?
xp_cmdshell return 1 or 0 if the stored procedure was invoked,
I would like to receive an indication that the file was copied.

View 2 Replies View Related

XP_CMDSHELL

Aug 22, 2001

How to create directory and file using xp_cmdshell..?

Thanks,
Harish

View 1 Replies View Related

Xp_cmdshell In 6.5.7.0

May 12, 1999

I tried to use the external procddure - xp_cmdshell - to copy a file from a local drive to a network drive, but failed. Yet the attempt succeeded if I tried to copy a file from one place to another in local drive.

It seems that SQL Server 6.5/7.0 did not recognize any network drive.
I greatly appreciate your help/assistance and/or any hint(s). Thanks a lot

View 1 Replies View Related

Xp_cmdshell

Nov 2, 1998

Hi there!
Is it possible to supply variable for the xp_cmdshell parameter?
here's an example:

declare @@okay char(20)
select @@okay = "dir c:mssqlinn"
exec master..xp_cmdshell @@okay

but this doesn't work. is there any workaround on this? instead
of writing a new extended sp to cater for this.

thanks in advance.

dion

View 6 Replies View Related

Xp_cmdshell

Apr 13, 2005

I was able to run DTS using xp_cmdshell. In my dts I have 3 global variables which I would like to pass. Can I pass a variable values using xp_cmdshell?
xp_cmdshell 'DTSRUN /S ServerName /U user/P pass /N "DTS_Name" '

View 3 Replies View Related

Xp_cmdshell Help

Jun 15, 2004

Hi,

I need to do FTP using a FTP script...here is the syntax that i am using

ftp -s:c: empftpcmd.txt > c: emplog.txt

when i run it thru the command line, log.txt file has the following
==================================================
ftp> Connected to 9.999.99.999.

open 9.999.99.999
220-YYYY1 XXX FTP CS V1R2 at XXXXXX.XXXXXX.XXX.COM, 16:55:07 on 2004-06-15.
220 Connection will close if idle for more than 5 minutes.
User (9.999.99.999:(none)):
331 Send password please.

230 USERNAME is logged on. Working directory is "USERNAME.".
ftp> Invalid command.

ftp>
ascii
200 Representation type is Ascii NonPrint
ftp> get 'XXX.YYY.ZZZ.ACCOUNT' c: empXXX.YYY.ZZZ.ACCOUNT.txt
200 Port request OK.
125 Sending data set XXX.YYY.ZZZ.ACCOUNT FIXrecfm 22
250 Transfer completed successfully.
ftp: 1172544 bytes received in 3.31Seconds 353.82Kbytes/sec.

ftp> quit
221 Quit command received. Goodbye.
=================================================

but when i run it from inside a query...using

declare @cmd varchar(1000)
select @cmd = 'ftp -s:c: empftpcmd.txt > c: emplog.txt'
exec master..xp_cmdshell @cmd

the log.txt file has
=================================================
User (3.172.28.153:(none)): open 3.172.28.153
Invalid command.




ascii
get XXX.YYY.ZZZ.ACCOUNT' c: empXXX.YYY.ZZZ.ACCOUNT.txt
quit
=================================================

why is this differnece? what can i do so that i get full details in the log file.
please help.

thanks
rohit

View 9 Replies View Related

Xp_cmdshell

Apr 27, 2007

Where should i read up on using
dos commands in conjunction with the xp_cmdshell extended stored procedure..
I need to manipulate file names....
move copy take off ... parts of the filename and replace... them...
etc... any good sites or topics... so that I can learn how to do this...
thanks...
jonathan

View 13 Replies View Related

Xp_cmdshell

Oct 4, 2007

Hi All,

I've recently installed SQL Server 2005 and now trying to enable xp_cmdshell through SQL Server 2005 Surface Area Configuration. However, I am getting the following error:

User does not have permission to perform this action.
You do not have permission to run the RECONFIGURE statement.

I am logged in as "sa".

How can I make it work?

Thanks.

View 4 Replies View Related

Xp_cmdshell

Feb 25, 2004

how to enable xp_cmdshell

View 2 Replies View Related

Xp_cmdshell And Ftp

Mar 10, 2004

Basic problem:

When xp_cmdshell interacts with FTP it doesn't log the FTP return codes.

History:
I found Nigel Rivett's T-SQL FTP scripts http://www.nigelrivett.net/ and concatenated them together with some modifications so I could have a process that actually errors when an FTP fails.

The process FTP's a file, disconnects, and then reconnects to do a dir and then select from the returned listing to see if the file name exists.

I wanted to review the initial log from the put and check for a valid FTP return code of 250 that says "Transfer completed successfully"

Log Snippets:

A normal FTP log shows:
ftp> put foo 'mainframe.node.structure.foo'
200 Port request OK.
125 Storing data set MAINFRAME.NODE.STRUCTURE.FOO
250 Transfer completed successfully.
ftp: 7972888 bytes sent in 99.63Seconds 80.03Kbytes/sec.
ftp> quit
221 Quit command received. Goodbye.

xp_cmdshell log shows (with FTP debug on) shows:
7 put foo 'mainframe.node.structure.foo'
8 PORT 10,99,11,16,7,30
9 ---> STOR MAINFRAME.NODE.STRUCTURE.FOO
10 ---> quit
11 QUIT
12 (null)

As you can see, the return codes and some other messages are missing.

I've messed around with various options and can't seem to get any return codes in the log at all.

Any ideas?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved