Results 1 to 12 of 12
-
04-29-2009, 05:18 PM #1Member
- Join Date
- Apr 2009
- Posts
- 22
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Can't run SQLFULL script from SQL agent
I created a SQLFULL.CMD script for a full backup. The script runs fine when exectud from within windows. However, it fails when ran from a SQLagent or a query. I have enabled xp_cmdshell.
In the query window:
This works: execxp_cmdshell'ping localhost';
This fails with "null": execxp_cmdshell'C:\Progra~1\Micros~1\MSSQL.1\MSSQL\Backup\sqlfull .cmd';
I am not getting any info in the event log or the dsierror.log file to help troubleshoot.
The baffling part is that I can run it withing Windows but not SQL. any ideas?
-
04-29-2009, 05:47 PM #2
I don't know anything about execxp_cmdshell, but is that a space in the file name of the CMD file that you are trying to run?
SQLFULL .CMD???
-
04-29-2009, 05:56 PM #3Member
- Join Date
- Apr 2009
- Posts
- 22
- Thanks
- 0
- Thanked 0 Times in 0 Posts
wow that looks strange. It should read:
exec xp_cmdshell 'C:\Progra~1\Micros~1\MSSQL.1\MSSQL\Backup\sqlfull .cmd';
-
04-29-2009, 09:22 PM #4
\sqlfull .cmd';
That is a space, right? In between the red and the blue? I can't imagine that would work, if it is.
-
04-30-2009, 09:57 AM #5Member
- Join Date
- Apr 2009
- Posts
- 22
- Thanks
- 0
- Thanked 0 Times in 0 Posts
-
04-30-2009, 10:27 AM #6
Tell you what...how about you post the contents of sqlfull.cmd? Maybe there's a variable that isn't being defined, or something.
-
04-30-2009, 11:28 AM #7Member
- Join Date
- Apr 2009
- Posts
- 22
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Remember, the script runs when exectued directly in Explorer, but not as a query in Studio.
set tsm_dir=C:\Progra~1\Tivoli\TSM\TDPSql
set sql_dir=C:\Progra~1\Micros~3\MSSQL.1\MSSQL\Backup
date < NUL >> %sql_dir%\sqlsched.log
time < NUL >> %sql_dir%\sqlsched.log
%tsm_dir%\tdpsqlc backup * full /tsmnode=zzzzzzzzz /tsmp=xxxxxxxx /tsmoptfile=%tsm_dir%\dsm.opt /logfile=%sql_dir%\sqlfull.log >> %sql_dir%\sqlsched.log
-
04-30-2009, 11:39 AM #8
-
04-30-2009, 11:48 AM #9
Also, check out this article: http://support.microsoft.com/kb/q255749/
Again, I know next to nothing about xp_cmdshell...but a Google search showed me a lot of forums with users having flaky little problems with it.
-
04-30-2009, 11:56 AM #10Member
- Join Date
- Apr 2009
- Posts
- 22
- Thanks
- 0
- Thanked 0 Times in 0 Posts
-
04-30-2009, 12:31 PM #11
-
04-30-2009, 02:13 PM #12Senior Member
- Join Date
- Nov 2005
- Location
- Montreal, CA
- Posts
- 636
- Thanks
- 0
- Thanked 4 Times in 4 Posts
Hi,
How do you know that execxp_cmdshell'ping localhost' works? Any log?
Try this:
exec xp_cmdshell 'start /w C:\Progra~1\Micros~1\MSSQL.1\MSSQL\Backup\sqlfull. cmd';
Rudy
Edit: without the space after sqlfull.
Similar Threads
-
Script to run LOG backup
By osi9400 in forum Microsoft SQL ServerReplies: 12Last Post: 04-20-2009, 10:33 AM -
How to run a single script across multiple instances and servers
By jimlane in forum Administrative ClientReplies: 15Last Post: 05-20-2008, 02:59 PM -
script to run delete volume from a storage pool
By cadele in forum ScriptingReplies: 4Last Post: 02-11-2008, 12:32 PM -
Run BASH Script with Schedule (Linux)
By byu_tsm in forum Backup / Archive DiscussionReplies: 2Last Post: 03-08-2006, 04:43 PM -
How to run Unix Script before/after TSM schedule
By sasa in forum Backup / Archive DiscussionReplies: 5Last Post: 08-18-2005, 09:36 AM


Reply With Quote
