Error/Issue: One day you wake up the sun is out you feel great but low and behold your windows scheduled tasks are no longer working. You will either get
(0x1) - For the Last Run Time
or they will run for eternity and not actually do anything.
Have had this error on windows server 2012 but not 2008 so I'm not sure what the difference is , anyway onto the FIX.
The FIX:
You will have to alter the jobs slightly to make them run again under your scheduled tasks.
example SQLCMD and VBS Script
SQLCMD
Task: To Backup all SQL Databases and dump .bak files into directory on local server
Settings:
- Run whether user is logged on or not
- Run with highest privileges
Actions
- Start a program
- Program/Script: "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE" (or your location)
- Add arguments (optional):
-S SQLBOX\SQL2016 -d master -E -Q "EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES', @Directory = 'E:\BackupLocation', @BackupType = 'FULL'" -b
If your looking for the database backup procedure you can grab it at https://ola.hallengren.com
VBS Example
Task: To delete any files older than 60 days in a directory, handy for cleaning up old backups
Settings:
- Run whether user is logged on or not
- Run with highest privileges
- Start a program
- Program/Script: C:\Windows\System32\cscript.exe
- Add arguments (optional): "E:\Folder\CleanOld Files.VBS" (quotation marks needed as there are spaces)
- Start in (optional) : C:\Windows\System32\
- Run whether user is logged on or not
- Run with highest privileges
- Start a program
- Program/Script: C:\Windows\System32\cscript.exe
- Add arguments (optional): "E:\Folder\CleanOld Files.VBS" (quotation marks needed as there are spaces)
- Start in (optional) : C:\Windows\System32\
that is it you are now up and running
No comments:
Post a Comment