Does Xp_cmdshell Work In SQL Server 7
Jan 31, 2002And can I send an argument with the command in the commandline.
Thanks in advance from a student in Norway
And can I send an argument with the command in the commandline.
Thanks in advance from a student in Norway
I have copied a script from the web that allows me to run scripts from a file over multiple databases(have attached file). Now everything works fine on my local SQL server but when I try to run it on my web server I get this msg
''isql' is not recognized as an internal or external command, operable program or batch file.'
I have tried to use the full path to the isql.exe file but still get the msg
Thats about as much info I can provide, my understanding of this is very slight
I am trying to issue an xp_cmdshell command via a guest account. I have given the guest user in the master db exec rights, and when I do something simple like
execute xp_cmdshell 'dir c:'
I just get the reply that the command completed without any returned data. However when I am on as 'sa' I get the results back as expected.
Any ideas anyone!
I have an external program which runs by the xp_cmdshell. This program get data from serial port and then store it back to the database (directly, by JDBC) It seems to me that when xp_cmdshell is running a program, the whole SQL server stop responding to any other request. (Is this normal?) Anyways, I insert a record into a table and this triggers an external program to run. But then the whole SQL server is hold at that stage. Logins are ok but no SQL or T-SQL commands are accepted. It seems to me like the SQL server (xp_cmdshell in specific) is waiting for the external program to terminate but the external program is waiting for the server is be ready to accept data. They are both waiting for each other. Any suggestions here?
View 3 Replies View Relatedhi,does anybody know how to enable/disable xp_cmdshell in sql server2000.i our server this sp has been disbaled for security puropse.but i needto use it in a job.so please can any body guide me?thanks for the help.-Shark.
View 1 Replies View Relatedhow i can clear sql server logs by run xp_cmdshell stored procedure.
(my user in sql server is a admin).
i don't want use enterprise manager . i want write a query and use at xp_cmdshell .
befor thx.
Hi,
I have to named instances on one server. I'd like to use xp_cmdshell for some interfaces.
I've "activated" the xp_cmdshell feature. I set a proxy account und and gave the sql user the right to exec xp_cmdshell.
Unfortunately the command
EXEC sp_xp_cmdshell_proxy_account 'DOMAINproxyaccount','APassword'
throws following error:
Msg 15121, Level 16, State 200, Procedure xp_cmdshell, Line 1
An error occurred during the execution of xp_cmdshell. A call to 'LogonUserW' failed with error code: '1326'.
... and yes, the username and password should be valid ;-)
When I exec (makes no sense, I now...)
EXEC xp_cmdshell 'echo 123'
The following error occurs:
Msg 15121, Level 16, State 200, Procedure xp_cmdshell, Line 1
An error occurred during the execution of xp_cmdshell. A call to 'LogonUserW' failed with error code: '1326'.
Has anyone of you an idea?
Thank you very much, Frederik
SQL Server 2005: Microsoft SQL Server Enterprise Edition (64-bit)
Microsoft Windows NT 5.2 (3790)
SQL Version 9.00.3175.00
I have 2 identical servers... one for DEV and one for TEST. On the DEV server, I can use xp_cmsdhell to execute "administrative commands" such as NET SHARE and AT. On the identically configured TEST server, I can not. Those command return the "System error 5 has occurred. Access is denied" error. I CAN run other commands via xp_cmdshell (DIR, NET USE, etc.). This is true regardless of the account I connect as.
The SQL Server service accounts in both instances are domain accounts belonging to the local admin group.
I "know" that I ran across this when setting up the DEV server and am "fairly sure" I found a reference to a known problem with 2005's xp_cmdshell and administrative commands. But for the life of me I can not now find any such reference, nor can I find any differences between the DEV and TEST servers in the area of users, groups, policies, or anything else security-related. (99.9% of the internet searches I do end up being about either enabling xp_cmdshell -- done -- or setting up an xp_cmdshell proxy account -- not needed).
Any input is greatly appreciated.
Thanks!
-dave
I am using XP_CMDSHELL to run 2 Windows commands (from a SQL 2005 SP2 server) that access files on a remote server (called webserver). The two commands are:
1. cscript.exe \webserverwwwrootEur_SaveProductImages.vbs
2. dir \webserverwwwroot
Up until very recently this worked fine. Now I am getting Access Is Denied errors:
For #1:
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
CScript Error: Loading script "\webserverwwwrootEur_SaveProductImages.vbs" failed (Access is denied. ).
For #2:
Access is denied.
This happens if the above commands are run through a job, or directly with Query Analyzer as SA.
I understand that XP_CMDSHELL commands are run in the security context of the SQL Server startup account. The SQL Server startup account is called SQLServer and this account exists on both webserver and the database server. On both servers the username & password are identical and the user is in the local Administrators group. The two servers are in a workgroup.
Things I have tried (with no effect):
1. Restarted the servers
2. Deleted and recreated the SQLServer login on both servers
3. Changed the startup account for SQL Server through the SQL Server Configuration Manager to another account and back to SQLServer.
The most revealing tests are these:
1. If I log into the database server myself using the SQLServer account I can run the above commands in a Command Prompt with no problem
2. I installed SQL 2005 Express SP2 on webserver using the same startup account (SQLServer). If I run the same XP_CMDSHELL commands as above but accessing files on the database server, the commands work!
So, an XP_CMDSHELL command run under SQL Express using the local SQLServer account to access a remote server works, but an XP_CMDSHELL command run under SQL Server using a local SQLServer account (that is supposedly identical to the same named account on the other server) does not work !!?!?!?
It is almost as if XP_CMDSHELL commands run under SQL Server are NOT using the SQLServer startup account, but using some other weaker account. How can I tell if this is true?
How can I get this back working (as it was a week ago). The only thing I can think that happened on the servers to cause this is the installation of Windows Updates.
Thanks
Hi allI have a stored procedure that has the lineEXEC master..xp_cmdshell 'dtsrun /Stestjob1 /N testdts /E'If I run the SP from an access front end as a trusted user or from ascheduled job it runs fine and exectues the dts.If I run the stored procedure using VB6 as a standard connection the dtsjobwont run. I get back Execute permissions denied on xp_cmd.. on databasemasterdb_connect_string = "Provider=SQLOLEDB.1;Persist Security Info=False;UserID=test_connect;PWD=pw1test;Initial Catalog=testdb;Data Source=" &database_name....Set cmd = New ADODB.Commandcmd.ActiveConnection = db_connect_stringcmd.CommandType = adCmdStoredProccmd.CommandText = "testStoredProcedure"cmd.ExecuteDo I need to give test_connect permisions to run the test stored procedure.I hoped that because the VB called a stored procedure and the connection hadpermissions to execute the SP then it would be the SP that called thexp_command....can anyone tell me the accepted way to do thismany thanksAndy
View 2 Replies View RelatedHow to write errors in event log of machine from SQL Server through XP_Cmdshell
View 1 Replies View RelatedI am using the xp_cmdshell to run a batch file that is trying to open the Adobe Acrobat Reader.
When I run the batch file in the command prompt, it opens perfectly.
When I run it in SQL with xp_cmdshell, it returns the contents fine, and I notice it tries to open Acrobat, but it is under the username "system". And I cannot get it to load in a visible area, and for some reason it doesnt seem to load properly under system.
Any ideas? Any Suggestions?
Please advise.
Marco
Using a 32-Bit SQL Server 2008 Express on my LOCAL PC. I downloaded the Advantage 8.1 OLE DB Provider and created a linked server to a REMOTE Advantage 8.1 database server. There is no data dictionary on the Advantage server.
Here is my linked server:
EXEC master.dbo.sp_addlinkedserver @server = N'1xx.1xx.xx.1xx', @srvproduct=N'Advantage', @provider=N'Advantage OLE DB Provider', @datasrc=N'1xx.1xx.xx.1xxeccET', @provstr=N'servertype=ads_local_server;tabletype=ads_cdx;'--tabletype=’ADS_ADT’ (this test works too)
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'1xx.1xx.xx.1xx',@useself=N'False',@locallogin=Null,@rmtuser='adssys',@rmtpassword=Null
Testing the link succeeds with above. Using “ads_REMOTE_server” instead of “ads_local_server” and the test fails. Here is my problem, using the following queries will not work. Perhaps it’s a permissions issue? When I specify my local credentials for the remote server in the linked server it still does not work.
SELECT * FROM OPENQUERY([1xx.1xx.xx.1xx], 'SELECT * FROM ActType')
OLE DB provider "Advantage OLE DB Provider" for linked server "1xx.1xx.xx.1xx" returned message "Error 7200: AQE Error: State = HY000; NativeError = 5004; [Extended Systems][Advantage SQL][ASA] Error 5004: Either ACE could not find the specified file, or you do not have sufficient rights to access the file. Table name: ActType SELECT * FROM ActType".
Msg 7321, Level 16, State 2, Line 2
An error occurred while preparing the query "SELECT * FROM ActType" for execution against OLE DB provider "Advantage OLE DB Provider" for linked server "1xx.1xx.xx.1xx".
I'm new to SQL. I have a scenario, Where customer want to move all the jobs from original SQL server to some remote SQL server and want to trigger jobs on remote server to do its work on original server.
View 4 Replies View Related
Hello all,
I have 2 networked PC's both running vista ultimate
1st is Laptop and is running its own SQL Server at laptoplaptopSQL
2nd is Desktop and is running its own SQL Server at desktopdesktopSQL
Now both machines have seperate windows login accounts.
When I go SQL Server management studio I go to browse and each machine can see the other machines SQL Server, but when I go to login I get SQL Login falied for users" The user is not associaed with a trusted SQL server connection".
So I then go to logins new login and try to add my other pc's user account.
The problem I see is that when I go to search and then location it only shows its own PC's location and not the location of my other networked pc? So if I am on Desktop and in my theory want to add laptopuser to the desktop SQL Server logins I get:
"create failed for login laptopuser
An exception occurred while executing Transact SQL statement laptopuser is not a valid windows NT name. give the complete name
Not sure on where to go from here.
Any help would be great
or is there any resource about it?
View 3 Replies View RelatedHello!
We just upgraded to SQL Server 2005 from SQL Server 2000. The DB was backed up using Enterprise Manager and restored with SQL Server Management Studio Express CTP. Everything went as expected (no errors, warnings, or any other indicator of problems).
The DB resides in a DB Server (Server1) and the application we are running is a Client/Server system where the AppServer resides on Server2.
During the application's operation all read, create, and delete transactions work fine but no update works. When viewing details in Trace Log I see this message after attempting any update:
Could not find server 'Server1' in sysservers. Execute sp_addlinkedserver to add the server to sysservers. (7202)
Any help is greatly appreciated,
Lucio Gayosso
I am getting an error saying incorrect syntax near fIt works in SQL Server 2005, but I cannot get it to work in SQL Server 2000 The error appears to be in the section that I marked in Bold. CREATE PROCEDURE [dbo].[pe_getReport] -- Add the parameters for the stored procedure here @BranchID INT, @InvestorID INT, @Status INT, @QCAssigned INT, @LoanOfficer nvarChar(40), @FromCloseDate DateTime, @ToCloseDate DateTime, @OrderBy nvarChar(50)ASDECLARE @l_Sql NVarChar(4000), @l_OrderBy NVarChar(500), @l_OrderCol NVarChar(150), @l_CountSql NVarChar(4000), @l_Where NVarChar(4000), @l_SortDir nvarChar(4)BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; SET @l_Where = N' Where 1=1' IF (@BranchID IS NOT NULL) SET @l_Where = @l_Where + N' AND f.BranchID=' + CAST(@BranchID As NVarChar) IF (@Status IS NOT NULL) SET @l_Where = @l_Where + N' AND f.Status=' + CAST(@Status As NVarChar) IF (@InvestorID IS NOT NULL) SET @l_Where = @l_Where + N' AND f.InvestorID=' + CAST(@InvestorID As NVarChar) IF (@QCAssigned IS NOT NULL) SET @l_Where = @l_Where + N' AND f.QCAssigned=' + CAST(@QCAssigned As NVarChar) IF (@LoanOfficer IS NOT NULL) SET @l_Where = @l_Where + N' AND f.LoanOfficer LIKE ''' + @LoanOfficer + '%''' IF (@FromCloseDate IS NOT NULL) SET @l_Where = @l_Where + N' AND f.ClosingDate>=''' + CAST(@FromCloseDate AS NVarChar) + '''' IF (@ToCloseDate IS NOT NULL) SET @l_Where = @l_Where + N' AND f.ClosingDate<=''' + CAST(@ToCloseDate AS NVarChar) + '''' IF @OrderBy IS NULL SET @OrderBy = 'DateEntered DESC' SET @l_SortDir = SUBSTRING(@OrderBy, CHARINDEX(' ', @OrderBy) + 1, LEN(@OrderBy)) SET @l_OrderCol = SUBSTRING(@OrderBy, 1, NULLIF(CHARINDEX(' ', @OrderBy) - 1, -1)) IF @l_OrderCol = 'InvestorName' SET @l_OrderBy = 'i.InvestorName ' + @l_SortDir ELSE IF @l_OrderCol = 'BName' SET @l_OrderBy = 'b.BName ' + @l_SortDir ELSE IF @l_OrderCol = 'StatusDesc' SET @l_OrderBy = 's.StatusDesc ' + @l_SortDir ELSE IF @l_OrderCol = 'QCAssigned' SET @l_OrderBy = 'q.LoginName ' + @l_SortDir ELSE SET @l_OrderBy = 'f.' + @l_OrderCol + ' ' + @l_SortDir SET @l_CountSql = 'SELECT f.FundedID As FundedID FROM FundedInfo AS f LEFT OUTER JOIN Investors AS i ON f.InvestorID = i.InvestorID LEFT OUTER JOIN Branches AS b ON f.BranchID = b.BranchID LEFT OUTER JOIN Status AS s ON f.Status = s.StatusID LEFT OUTER JOIN QCLogins AS q f.QCAssigned = q.LoginID ' + @l_Where + ' ORDER BY ' + @l_OrderBy CREATE TABLE #RsltTable (ID int IDENTITY PRIMARY KEY, FundedID int) INSERT INTO #RsltTable(FundedID) EXECUTE (@l_CountSql)SELECT f.DateEntered As DateEntered, f.LastName As LastName, f.LoanNumber As LoanNumber, f.LoanOfficer As LoanOfficer, f.ClosingDate As ClosingDate, i.InvestorName As InvestorName, b.BName As BName, s.StatusDesc As StatusDesc, q.LoginName As LoginNameFROM FundedInfo AS f LEFT OUTER JOIN Investors AS i ON f.InvestorID = i.InvestorID LEFT OUTER JOIN Branches AS b ON f.BranchID = b.BranchID LEFT OUTER JOIN Status AS s ON f.Status = s.StatusID LEFT OUTER JOIN QCLogins As q ON f.QCAssigned = q.LoginID WHERE FundedID IN(SELECT FundedID FROM #rsltTable) ORDER BY CASE @OrderBy WHEN 'DateEntered ASC' THEN f.DateEntered END ASC, CASE @OrderBy WHEN 'DateEntered DESC' THEN f.DateEntered END DESC, CASE @OrderBy WHEN 'LastName ASC' THEN f.LastName END ASC, CASE @OrderBy WHEN 'LastName DESC' THEN f.LastName END DESC, CASE @OrderBy WHEN 'LoanNumber ASC' THEN f.LoanNumber END ASC, CASE @OrderBy WHEN 'LoanNumber DESC' THEN f.LoanNumber END DESC, CASE @OrderBy WHEN 'LoanOfficer ASC' THEN f.LoanOfficer END ASC, CASE @OrderBy WHEN 'LoanOfficer DESC' THEN f.LoanOfficer END DESC, CASE @OrderBy WHEN 'ClosingDate ASC' THEN f.ClosingDate END ASC, CASE @OrderBy WHEN 'ClosingDate DESC' THEN f.ClosingDate END DESC, CASE @OrderBy WHEN 'InvestorName ASC' THEN i.InvestorName END ASC, CASE @OrderBy WHEN 'InvestorName DESC' THEN i.InvestorName END DESC, CASE @OrderBy WHEN 'BName ASC' THEN b.BName END ASC, CASE @OrderBy WHEN 'BName DESC' THEN b.BName END DESC, CASE @OrderBy WHEN 'StatusDesc ASC' THEN s.StatusDesc END ASC, CASE @OrderBy WHEN 'StatusDesc DESC' THEN s.StatusDesc END DESC, CASE @OrderBy WHEN 'LoginName ASC' THEN q.LoginName END ASC, CASE @OrderBy WHEN 'LoginName DESC' THEN q.LoginName END DESCENDGO
View 2 Replies View RelatedCan I use SQL Server Management Studio Express to work with
this...SQL Server Everywhere?
I bought VS2005 Pro and installed everything, including the Developers edition
of SQL Server 2005.
I would love to play with this and try converting old Access desktop
applications.
Unfortunately I am unsure how to create and modify a new database for SQL Server Everywhere using SSMSE.
I have several tables that have a thousand records or so
used for Look-Up tables and really need a way to import those tables.
Working within VS2005 and manually creating tables just isnt
cutting the mustard here
What can I do?
Hello
In my application I check in which state is SQL Server - run/paused/stopped
I do it with object SQLServer from SQLDMO.dll.
After program compilation in BIN floder created file Interop.SQLDMO.dll
And in SQLServer folder (in which whole stuff of SQL Server is) there is
file SQLDMO.dll. My application indeed checks states of SERVER.
Now I need this application will work on another computer in which SQL Server
installed too. I place there EXEs and all DLLs compiled by my program into single folder (include SQLDMO.dll) but the desired checks do not work there.
What I need to do in order application can use SQLDMO.dll features on another computer too ?
Thank you
Yosef Fishov
What should I do if I want my asp.net 1.1 work with sql server 2005I get wrong message : SQL Server does not exist or access denied
View 5 Replies View RelatedIs there any way we can work with SQL Server 7.0 Database with ASP.net 2.0 ?
I plan on replacing a SQL2000 database with MSDE for lowering budget.
Can we script up the SQL database (with SPs, triggers, and UDFs) and recreate it in MSDE?
Thanks.
For some reasons, I uninstalled and reinstalled SQL server in local pc. Now, none of my app is working. My pc is XP professional with sp2 and VS.NET is 2003.
I spent a couple of days but no luck. It drived me crazy!
Help!!!
I'm new to the world of SQL and queries. There was an existing SQL server when I took the job and have been learning what I can as it comes up. My problem is that installed a new SQL server and moved everything to it. Everything seems to be working with the exception of the existing queries. I have changed the server in the ODBC Administrator but I still get the following error:
Connection Failed:
SQLState: 01000
SQL SErer Error: 10060 & 10061
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen (Connect()).
Connection Failed:
SQLState: 08001
SQL SErer Error: 17
[Microsoft][ODBC SQL Server Driver][SQL Server does not exist or access denied.
I have also checked to make sure that the server is listening for incoming sockets connections. (Port 1433) It is.
I don't know if there are files (DSN) that need too be moved to the new server or if there is another place to change the server the queries are pointed to. I hope someone can help me.
Thanks,
Jo
I am moving my site to a host that has SQL Server 2005. I am pretty goodwith Access, but I don't know much about SQL Server.I'm currently using SQL Server 2000, and I access it with Access 2000, whichmeans I can't do a lot.Would I be able to work in it using SAL Server Express? What I amparticularly interested in, is being able to run queries (views).I need to update stock every day. If I was using Access I would import orlink the new stock table, and then join the 2 tables by the product number -(the product table and the new stock table), and pull the records where thestock amounts were different, then copy the column from the stock table tothe product table (or do an update query, although copying is usuallyquicker and easier).I would do that, not just for stock amounts, but for price changes, to adddescriptions, and a few other things.How can I do that in SQL Server 2005? What program do I need to have on mydesktop to do that?Please explain in baby terms, if possible!Thanks!
View 1 Replies View RelatedHello ia m trying to install SQL Server 2005 but i am unable to run it. I installed Net Framework 2.0
Then i have tried the following files:
SQLEXPR.EXE
SQLEXPR_ADV.EXE
Then i installed Service PAck 1 for that but an error occoured during the install.
Basiclly i have no idea what i am doing here. It creates a configuration tools start menu item but it seems just like configuration. In C:Program FilesMicrosoft SQL ServerMSSQL.2MSSQLBinn there is a file called sqlservr.exe but all it does is create a black console window and does nothing.
OS: XP Pro + SP2
How to get it to work?
Thank You
I have an Access 2003 application that works well in a LAN environment with a Jet based back end. However, I would like to move this back end to a SQL Server database hosted on a website so that my users could run the application from any Internet-connected PC, using a modified version of my Access front end.
Is this a perfectly normal way of using SQL Server? Is response time likely to be an issue or can careful design make performance similar to that with a LAN based back end?
I installed SQL Server 2005.
View 9 Replies View RelatedHi,
I'm getting ready to deploy an ASP.NET application to a server that does not support SQL Express, but does support MS Access and SQL Server. Is there any easy way to convert my SQL Express code to either Access or regular SQL Server code, without having to change very much code in my application. I really like the integration that SQL Express has with Visual Web Developer, and would like to be able to keep that sort of integration if at all possible.
Thanks,Drew
I have some ASP.NET C# code which executes a stored procedure in SQL Server via the SqlCommand and SqlConnection classes.
One of the stored procedures that gets executed is giving the error: "Transaction (Process ID 272) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction." This only happens occassionally.
Is there a way to get around this in my ASP.Net application? One thing I tried is ensuring that no 2 users entered the stored procedure concurrently:object synclock = new object() ;
lock (synclock) {
// execute SQL stored procedure
...
} This did not solve the problem, and I'm not even sure if that is the correct implementation to ensure sequential execution of the stored procedure.
Can someone tell what could possibly be the problem with SQL7 not running backups that were created and scheduled using the maintance plan wizar. There is no job history, or any record of the backups running. However, I did notice that the SQL Server Agent was set to manual. Could that perhaps have something to do with the jobs not running. If possible could some give me possible solutions or answers as to why these jobs didn't run.
Thanx
I have a stored procedure that works on my development server but when I placed it on the server that is to be the prodcuction server i get the following response:
output ----------------
The name specified is not recognized as an internal or external command, operable program or batch file.
This is the procedure:
CREATE PROCEDURE sp_OutputClaim @OutFile varchar(255), @CurAns char(8) AS
declare @CmdLine varchar(255)
select FieldX into ##TempTable from Table where FieldY = @CurAns
select @CmdLine = "exec master..xp_cmdshell 'bcp tempdb.dbo.##TempTable out
c:est" + @OutFile + " /Uxx /Pxxx /Sxx /f c:estcp.fmt'"
exec (@CmdLine)
drop table tempdb..##TempTable
Thanks for any help !!!!
Rob