Excute Xp_cmdshell Run BCP In SQL Scheduler
Hi,
I have a schedule task with the following command:
xp_cmdshell 'bcp DBName.TBLOwner.TBLName in h:datafile.txt /fh:formatfile.fmt /Sservername /Usa /Ppassword'
The error message that I recieved is "Unable to open Host file. I can run the BCP command in Dos C prompt successfully, but
cannot run this in the SQL Server Scheduler. H drive is net use to the Server and it is where my data file and format file located.
Does anyone has any idea? I do appreciate for your help.
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Help: Why Excute A Stored Procedure Need To More 30 Seconds, But Direct Excute The Query Of This Procedure In Microsoft SQL Server Management Studio Under 1 Second
Hello to all, I have a stored procedure. If i give this command exce ShortestPath 3418, '4125', 5 in a script and excute it. It takes more 30 seconds time to be excuted. but i excute it with the same parameters direct in Microsoft SQL Server Management Studio , It takes only under 1 second time I don't know why? Maybe can somebody help me? thanks in million best Regards Pinsha My Procedure Codes are here:set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= ALTER PROCEDURE [dbo].[ShortestPath] (@IDMember int, @IDOther varchar(1000),@Level int, @Path varchar(100) = null output ) AS BEGIN if ( @Level = 1) begin select @Path = convert(varchar(100),IDMember) from wtcomValidRelationships where wtcomValidRelationships.[IDMember]= @IDMember and PATINDEX('%'+@IDOther+'%',(select RelationshipIDs from wtcomValidRelationships where IDMember = @IDMember) ) > 0 end if (@Level = 2) begin select top 1 @Path = convert(varchar(100),A.IDMember)+'-'+convert(varchar(100),B.IDMember) from wtcomValidRelationships as A, wtcomValidRelationships as B where A.IDMember = @IDMember and charindex(convert(varchar(100),B.IDMember),A.RelationshipIDS) > 0 and PATINDEX('%'+@IDOther+'%',B.RelationshipIDs) > 0 end if (@Level = 3) begin select top 1 @Path = convert(varchar(100),A.IDMember)+ '-'+convert(varchar(100),B.IDMember)+'-'+convert(varchar(100),C.IDMember) from wtcomValidRelationships as A, wtcomValidRelationships as B, wtcomValidRelationships as C where A.IDMember = @IDMember and charindex(convert(varchar(100),B.IDMember),A.RelationshipIDS) > 0 and charindex(convert(varchar(100),C.IDMember),B.RelationshipIDs) > 0 and PATINDEX('%'+@IDOther+'%',C.RelationshipIDs) > 0 end if ( @Level = 4) begin select top 1 @Path = convert(varchar(100),A.IDMember)+ '-'+convert(varchar(100),B.IDMember)+'-'+convert(varchar(100),C.IDMember)+'-'+convert(varchar(100),D.IDMember) from wtcomValidRelationships as A, wtcomValidRelationships as B, wtcomValidRelationships as C, wtcomValidRelationships as D where A.IDMember = @IDMember and charindex(convert(varchar(100),B.IDMember),A.RelationshipIDS) > 0 and charindex(convert(varchar(100),C.IDMember),B.RelationshipIDs) > 0 and charindex(convert(varchar(100),D.IDMember), C.RelationshipIDs) > 0 and PATINDEX('%'+@IDOther+'%',D.RelationshipIDs) > 0 end if (@Level = 5) begin select top 1 @Path = convert(varchar(100),A.IDMember)+ '-'+convert(varchar(100),B.IDMember)+'-'+convert(varchar(100),C.IDMember)+'-'+convert(varchar(100),D.IDMember)+'-'+convert(varchar(100),E.IDMember) from wtcomValidRelationships as A, wtcomValidRelationships as B, wtcomValidRelationships as C, wtcomValidRelationships as D, wtcomValidRelationships as E where A.IDMember = @IDMember and charindex(convert(varchar(100),B.IDMember),A.RelationshipIDS) > 0 and charindex(convert(varchar(100),C.IDMember),B.RelationshipIDs) > 0 and charindex(convert(varchar(100),D.IDMember), C.RelationshipIDs) > 0 and charindex(convert(varchar(100),E.IDMember),D.RelationshipIDs) > 0 and PATINDEX('%'+@IDOther+'%',E.RelationshipIDs) > 0 end if (@Level = 6) begin select top 1 @Path = '' from wtcomValidRelationships end END
View Replies !
View Related
Can't Excute SSIS Package
So everything was working great. Now I have a few problems. The little play button is no longer available for me to puch and when I try a right click execute package a get a "Unexpected internal error: Invalid state for operation. (Microsoft Visual Studio)". Does anyone know how to fix this? Also when I try and copy tasks from within my package I get a "An error occurred while objects were being copied. SSIS Designer could not serialize the SSIS runtime objects. (Microsoft Visual Studio)" followed by "Could not copy object 'package name' to the clipboard. (Microsoft.DataTransformationServices.Design)" and then "Invalid access to memory location. (Exception from HRESULT: 0x800703E6) (Microsoft.SqlServer.ManagedDTS)" Does anyone what might be wrong Thanks in advance
View Replies !
View Related
Question About Excute Store Procedure
Hi, all i create a function("changefilepermission") to execute a procedure ("grant_file_access") to change the file permission. i click the permission checkbox to change new permission, after that i will click the submit button to update change to the database. but it does not change to the database. this is my part of code. is anybody can give me a help? thanks in advanced!!!!!!!!! Private Sub btnsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSubmit.Click Dim FileTitle As New String("") Dim FileName As New String("") FileName = DGPermission.Items.Item(0).Cells(0).Text 'retrieve filename from datagrid FileTitle = DatabaseCommand(userid, "fa_title", filename) ' retrieve the filetitle from table Dim permission As Char ' set the permission value If (CkRead.Checked) Then Permission = "r" ElseIf (CkWrite.Checked) Then Permission = "w" ElseIf (CkExecute.Checked) Then Permission = "o" End If Try ' call the store procedure function by passing 4 value ChangeFileAccess(userid, FileName, FileTitle, Permission) ' Catch ex As Exception lblErrorMsg.Text = ex.ToString End Try End Sub ' execute store procedure function Public Sub ChangeFileAccess(ByVal userid As String, ByVal DiskFilename As String, ByVal Title As String, ByVal Access As Char) Dim UpdateCommand As SqlCommand UpdateCommand = New SqlCommand With UpdateCommand .Connection = SqlConnection .CommandType = CommandType.StoredProcedure .CommandText = "Grant_File_Access" .Parameters.Add("@vu_id", SqlDbType.VarChar, 20).Value = userid .Parameters.Add("@DiskFilename", SqlDbType.VarChar, 64).Value = DiskFilename .Parameters.Add("@Title", SqlDbType.VarChar, 50).Value = Title .Parameters.Add("@Access", SqlDbType.Char, 1).Value = Access End With Try UpdateCommand.Connection.Open() UpdateCommand.ExecuteReader() ' call the store procedure UpdateCommand.Connection.Close() Catch ex As Exception lblErrorMsg.Text = ex.ToString End Try End Sub
View Replies !
View Related
Variable Problem In Excute SQL Task
Hi there I have a bit confusing problem, In Execute SQL Task I am having a stmt like : (Select * from Emp where EmpNm=?) also I m passing variable value through Parameter Mapping. Problem I am facing is that if I remove brakets from both end task is executed successfull but if I but those braket as they are task execution fails. and i need those brakets as it is inside a if statement. Problem is with parameter passing ,even if i put some value as EmpNm="ABC " with brakets, it runs successfully Any Solution to above problem Thanks and Regards Rahul Kumar, Software Engineer
View Replies !
View Related
How Do I Excute DBCC DBreindex From Public Group
Hi All Could you guys help me i have small problem in running dbcc dbreindex.I could run this command from dbo,sysadmin and Object owner logins to rebuild the index but what i want to do is i want to run this command in a stored procedure. this is also fine if i run the stored procedure any one of above logins it executes when i grant exec permission on this procedure to public it will not execute in public group since public group is not a owner of this object.. How do i excute DBCC DBreindex from public group.Could you please help me.....................
View Replies !
View Related
Scheduler For FTP & BCP
I have a schedule job that performs the following tasks: 1). Exec xp_cmdshell 'erase c:xxxxxxx.txt' 2). Exec @result_ftp=xp_cmdshell c:xxx'ftp.bat' 3). Exec @result_bcp=xp_cmdshell 'c:xxxcp.bat' How do I make sure that the size of the file after ftp is >0 (ftp successfully)? How do I write this procedure(just check the size of the file)? If the ftp does not succefully, the BCP should not start, but the xp_cmdshell command always return 0 which means ran successfully. Does anyone has an idea? I do appreciate for your help.
View Replies !
View Related
Scheduler
I have a scheduler doing ftp and bcp to SQLserver. How do I check the file size is greater than 0 after ftp completed? (right now I am using xp_cmdshell to execute ftp command and return 0 always, even the file did not get transfer successfully). DECLARE @result_ftp int, @result_bcp int EXEC result_ftp=xp_cmdshell @ftpbat if (@result_ftp=0) ???? xp_cmdshell always return 0 ???? BEGIN EXEC result_bcp=xp_cmdshell @bcpbat if (@result_bcp=0) print ' ## BPC Successfully##' else raiserror("BCP Fail", 16,1) END ELSE print ' FTP fail' return Go
View Replies !
View Related
Job Scheduler
Dear friends, Currently i am running a large sql server 2000. Usually when i need to generate reports, i will need to query using query analyser and paste the result in excel. This process is very tedious as the query takes long time due tolarge data. Also my reports have the frequency of daily, weekly and monthly. I am looking for a job/query scheduler to automate this process and publish the result in excel. I understand that DTS can only schedule a query to run but extracting the data to excel and Reporting Services does not have scheuler. Please advise if there is any s/w or application can do this. Any freebies? Cheers, Darren
View Replies !
View Related
Job Scheduler
Hello, I am have problems running a couple of jobs. It makes no sense. I have checked and made sure the agent service is running the same user level permissions as I am. I run the job manually from SMS and it works fine. User is a Windows Login. Any suggestions would be greatly appreciated. Date 6/11/2007 6:00:01 AM Log Job History (BidBackLog) Step ID 1 Server TWSQLRPTS Job Name BidBackLog Step Name Step1 Duration 00:00:21 Sql Severity 0 Sql Message ID 0 Operator Emailed Operator Net sent Operator Paged Retries Attempted 0 Message Executed as user: TWDOMAINSQLADMIN. ... 9.00.3042.00 for 64-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 6:00:01 AM Error: 2007-06-11 06:00:22.50 Code: 0xC0202009 Source: BidBacklog Connection manager "TWSQLRPTS.HomeBASE" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Login failed for user 'TWDOMAINSQLADMIN'.". An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Cannot open database "HomeBASE" requested by the login. The login failed.". End Error Error: 2007-06-11 06:00:22.50 Code: 0xC020801C Source: DTSTask_DTSDataPumpTask_1 OLE DB Source [1] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager ... The package execution fa... The step failed.
View Replies !
View Related
How Do I Start A Transaction :-Dataflow Task + Excute SQL Task
1 :Control Flow Excute SQL task: Truncate Table 2: Dataflow Task: Datareader--Script componant--OLE DB Destination (SQL Server 2005--a single table --always around 600,000 rows) How do I set up a transaction where if there is a failure the Truncate Table command will roll back---and the OLE Destination (A single SQL Server table) will be left the same as before the load started. Another question with that volume of data --600,000 rows will a truncate table be pratical in a transaction Any ides welcome thanks in advance David
View Replies !
View Related
UMS Scheduler Hang
Hi Guru,Our HR sql 2000 production server is 800.760 built (SP3a) with 2GB ofRAM and 2 CPU hiper threading. This server is very low activity whereprocessor runs average 1-3 during the day. However, in the last twomonths, I've seen the following message occurred a few times on thisserver.Error: 17883, Severity: 1, State: 0The Scheduler 2 appears to be hung. SPID 0, ECID 0, UMS Context0x0381F660.I did extensive research and read both KB 815056 and 10885 but I couldnot correlate these KBs in to my issue. The reason is, I don't thinkour server is very busy to cause the checkpoint process to be delayed.The database keeps growing only 5-10MB in a week and I allocated thespace during off hour.What is the solution to fix this issue? Will I fix this issue byapplying the hotfix MS03-031?Thanks so much,Silaphet,
View Replies !
View Related
Scheduler Not Yielding?
All, I'm getting the following error in my SQL logs: Process 51:16 (2bc) UMS Context 0x1249F118 appears to be non-yielding on Scheduler 0. I killed the process, but it's been rolling back for 3 hours. It's done zero IO and consumed a TON of CPU time. Any suggestions as to what I can do? Thanks, Isaac
View Replies !
View Related
Batch Job In Scheduler
What is the best way to run a scheduled task that fires off three scripts that need to be run sequentially? I could set up three different tasks but I don't know exactly how long each will take and they are interdependent.
View Replies !
View Related
DTS Execution Using The Scheduler
I have several DTS packages that I run in steps thru the scheduler. The only one that is giving me grief is one that extracts large amounts of data from an Oracle database. Any extract that is less than 30,000 rows is fine but more than that, only the last completed batch that keeps the rows returned under 30,000 will write out to either a new table or to a file. Not only do the rows not return, but it holds open any file that is being used (the one it is writing out to as well as the errorlog file.) I have changed batch sizes, max error counts, timeouts and every other variable I could find to no avail...The job immediately 'completes' its execution with a good return code but that appears only to be 'I sent your request off to Oracle' which releases the next step even though the data hasn't been returned (an issue I will tackle once I get all the data.) My Network folks and Oracle DBA are telling me that there are no size restrictions for passing the data back. Any ideas where I have strayed off the path? Thanks for your help. Marianne G. Burhans Sr. Database Administrator
View Replies !
View Related
DTS Packages & Scheduler
I created a DTS package that copies some data (only 3290 rows) from ORACLE db to SQL Server. Executed it, works fine. I tried to schedule this package and run it as a job. The execution takes forever, doesn't insert any rows. Do you have any ideas why doesn't it work? Thank you
View Replies !
View Related
Non-yielding Scheduler SQL 05
our sql 05 server running on 64 bit slowed down and became non-responsive after getting this initial message Non-yielding Scheduler and then flooding the system with this message and become non-responsive. Process 62:0:0 (0x11a0) Worker 0x00000001371DE1C0 appears to be non-yielding on Scheduler 0. Thread creation time: 12828422717058. Approx Thread CPU Used: kernel 0 ms, user 0 ms. Process Utilization 0%. System Idle 96%. Interval: 70050 ms. i restarted the server as , i could not stop the services running , as the view processess window in sql server had become non responsive and i could not kill or even view the processes ... no idea what caused it or how this can be stopped from happening again, please advise if you have encountered this problem thanks
View Replies !
View Related
SQL Scheduler Job Problem
We have created a Job in the SQL server Agent to execute some of the tasks which will load the data from XML to DB. These jobs will run exactly 15 days then they will get hanged. We need to restart the server to start the job again. Could anybody give the suggestion to solve this problem. Thanks in Advance and Regards, Vasant Ghooli
View Replies !
View Related
Windows Task Scheduler...
Hi, I'm developing an Ads system, which will have an scheduler functionality. Here's how it works: each hour a process will verify and publish an XML file with Ads that have to be shown at that hour. To display the Ad, the "NextDisplay" table's field has to be equal to currently date/HOUR. Then the process will update the "LastDisplay" field with the currently time and call a MsSQL stored procedure that will recalculate the NextDisplay time of the Ad. My problem is doing this stored procedure. I've based my tables to allow the same schedule rules of the Windows Task Scheduler, so I have to verify each rule to calculate the next display time, but it's a difficult process, 'cause there are a lot of details to be considered. I thought interoping with Windows Task Scheduler or seeing some code that do something like that, to have some ideas about how to implement it. Suggestions? Thx!
View Replies !
View Related
SQL Server Scheduler Problem
Our Scheduler stopped working suddenly (it worked without any problem before). SQL Executive returns: + DBLib Message Handler: Login failed- User: sa Reason: Not associated with a trusted SQL Server connection. ! DBLib Error Handler: Login incorrect in its error log. We do not use trusted connection (we use standard security) Password is OK. Everything else seems to work fine. We have support for TCP/IP, Named Pipes, and Multiprotocol on the server. Can anybody tell where to look for the answer? Thank you, Alex.
View Replies !
View Related
Running Sp_proc From Scheduler
I am calling a sp_procedure from a scheduled task, it seems to complete ok , it has a return code = 0 in the history and the output looks ok. The problems is that in the summary page its last_run_status it shows a a failed. I think is due to the system output messages from dropping a table and doing a bcp. My questions is how do I mask the output for this system messages? Thanks, josie
View Replies !
View Related
SQL Server Scheduler Not Running
When I try to execute Schedule jobs in SQL Server ver 6.5, I am getting the following error message 'Error 21003:[SQL Server] Error executing xp_schedulersignal extended stored procedure: SQL Executive is not running' But the SQL Executive is running. Any suggestions? Thanks. Caren
View Replies !
View Related
Scheduler 0 Appears To Be Hung
Hello, The users of my microsoft SQLServer 7 database could not log on to the database after the following message has appeared in the log file; The Scheduler 0 appears to be hung. PSS 0x5B1630C8, EC 0x5B163278, UMS Context 0x3FC37E88 The problem was solved after I have restarted the database. I would be grateful if you could show me how to avoid such a problem in the near future. Regards, Albert
View Replies !
View Related
SQL Server Agent Scheduler
I have a job that was running on the SQL Server every business day. Once I disabled the scheduler for a day or two and then enabled it again. Well, now every once in a while my scheduler disables itself. Is there any logical explanation of this phenomenon?
View Replies !
View Related
Scheduler 2 Appears To Be Hung.??
Hi, Below messages got throwed to sql ErrorLog. I could'nt understand what it means.. any help is appericated. The Scheduler 2 appears to be hung. SPID 0, ECID 0, UMS Context 0x03CBAA40. Error: 17883, Severity: 1, State: 0 WARNING: EC 36b9c098, 8 waited 300 sec. on latch 444f3b84. Not a BUF latch. thanks, -J
View Replies !
View Related
DTS: Want To Execute From Within A Sql 7.0 Scheduler Step
I have a DTS package that I want to execute from within a sql 7.0 scheduled task step. I tried the following and got the following error on the DTS step: Operating System Task: dtsrun /S 'Server1' /E /N'REFRESH' Error Thrown: DTSRun: Loading... Error: -2147008507 (80074005); Provider Error: 0 (0) Error string: Unspecified error Error source: Microsoft Data Transformation Services (DTS) Package Help file: sqldts.hlp Help context: 713 Error: -2147467259 (80004005); Provider Error: 11 (B) Error string: [DBMSSOCN]General network error. Can someone help me with the syntax? Suggestions?
View Replies !
View Related
Scheduler Brings Down The System???
I am hoping this is something simple, a security piece I've messed up. When I run my dts package manually I get no errors and sucessful completion of each step. So I set my SQL Agent to run thepackage 15 minutes after every hour between 5am and 5pm, these being 15 minutes after the times the new data files are dropped to me. But instead of running the package it disconnects all the remote desktop users and fails. When remote users can get back on we are faced with a system has recovered from a serious error message. The error message posted to the event logs is empty though. Any one have any ideas? We are running MS Server 2003 and SQL Server 2000 Thanks, Carrie
View Replies !
View Related
Service Broker As Job Scheduler
Hi, I have read that service broker can be used to manage and schedule jobs. but how is this more of an advantage compared to the current sql server job scheduling using the sql server agent. thanks in advance. Would appreciate if somebody can answer immediately
View Replies !
View Related
External Scheduler For Reports
Hi, here is my problem: Because of some usability terms, I need to use SSRS scheduler to determine reports creation frequency (minimum frequency is once a day)I need to use an external scheduler to SSRS in order to launch reports creation daily, after some other batch tasks execution that must be completed before launching report creation. And I have no idea on how to do that properly. Can somebody help me? Thanks!
View Replies !
View Related
SQL Scheduler Problem (task Sticks)
I'm running a SQL 6.5 (SQL SP4) Server which has multiple tasks run throughout the day. One of my tasks runs every ten minutes that transports vendor information inserted and updated from an outbox on one system to an inbox on another SQL 6.5 (SQL SP4) Server. About two to three times a day I'll get a call from my Accounting department that they can't see the vendor information in the second system. I'll go to task manager and in the running tasks tab the task will be sitting there started about thirty to forty five minutes ago even though the task has never taken more than one minute to complete successfully, if the task does this then it won't start again. The only way to get the task running again is to delete the task completely and recreate it. Also there's no spid for the process when it's stuck like this so I know it's not running. It's only this task, which basically just calls a stored proc that grabs the info and hands it to an rpc to put in the inbox. Microsoft hasn't been able to give me a solution yet. If anyone has encountered this and solved it please let me know. Thanks, Rick
View Replies !
View Related
UMS Context Appears To Be Non-yielding On Scheduler
Hi, We are running SQL Server 2000 SP3 + security patches on Windows 2000 Advance Server. After we did the security updates released before Jan 8th, We are getting the below error 2 times within a month and the sql server is not responding after this error. After rebooting the server, it responds and works normally. please give me a solution for this 2005-02-13 07:16:22.54 server Error: 17883, Severity: 1, State: 0 2005-02-13 07:16:22.54 server Process 89:0 (12a68) UMS Context 0x129E1EE8 appears to be non-yielding on Scheduler 0. 2005-02-13 07:16:26.27 server Stack Signature for the dump is 0x00000000 2005-02-13 07:16:26.27 server Error: 17883, Severity: 1, State: 0 2005-02-13 07:16:26.27 server Process 86:0 (1418c) UMS Context 0x12A36D98 appears to be non-yielding on Scheduler 5.
View Replies !
View Related
Enterprise Manager Job Scheduler Vrs Query Analyzer???
I run a stored procedure manually each day without fail using QueryAnalyzer.I.E. I right click in the browser window on the storedprocedure hit open and execute. I am trying to get my "DBA" toschedule this job in Enterprise manager and they keep getting syntaxerrors that make no sense and keep asking me to fix the code.Is there any difference in how the job scheduler executes a procedurevrs doing it in Query analyzer via Open/Execute that requires adifferent SQL syntax??? Im thinking that this problem is not the codebut a permissions issue What are your thoughts?
View Replies !
View Related
|