Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hugor99
Starting Member
5 Posts |
Posted - 2005-02-16 : 17:10:18
|
| Hi,I have SQL server 2000 (SP3) set up to run a job when one of the replication agents fails.The job owner is SQLServer, my sqlserver user account. It is a member of the users group. The users group has permissions to read and execute in the folder where the batch file is.The job has one step, set up as an operating system command (cmdexec):d:\alerts\sendmail.exe /s localhost /f "Vancouver One <Vancouver1@mydomain.com>" /t "My Name<m.name@mydomain.com>" /j "Merge Failure" /m MergeFailure.txtI have tried this command, and the job shows that it is successful, but no mail ever gets sent. I have put this command into a batch file (with .bat or .cmd extension) and tried that as well, but it shows as failed. I get this error:The job failed. The Job was invoked by User VANCOUVER1\administrator. The last step to run was step 1 (Send Merge Failure Mail).I have made sure that the vancouver1\administrator account is listed in the system administrators role for the sql server.If I run the batch file manually or type the above command into a command prompt, it executes properly. There is no user interaction required. With the batch file, a command window opens, the sendmail.exe does it's thing, and then the command window closes.What am I doing wrong? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-02-16 : 18:24:19
|
| Logon to the database server using the account that the service runs under. Then run the batch file manually. Does it work? If so, then does the job work when the job's owner is set to sa?Tara |
 |
|
|
hugor99
Starting Member
5 Posts |
Posted - 2005-02-17 : 18:35:51
|
| Hi,Thanks for the help. I used Query Analyzer to log into the server and used xp_cmdshell to execute the batch file.It was then that I was able to see what the errors were. Any paths that are in the batch file need to be absolute (i.e. not just "sendmail.exe", but "d:\alerts\sendmail.exe"). Once I changed those, it all worked great. |
 |
|
|
|
|
|
|
|