Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Automatic backup task Expand / Collapse
Author
Message
Posted Saturday, October 27, 2012 4:48 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 8:06 AM
Points: 354, Visits: 1,029
I recently completed setting up what I thought was a pretty good system for performing automated backups, but I can't get it to work. This isn't strictly SQL Server stuff, only partly, but there are a lot of sharp people on this forum - maybe someone here has some thoughts or experience with a similar problem.

I'm using SQL Server 2008 R2 Express (paid version already sitting on my desk, installation in the task pipeline), so I wrote a T-SQL stored procedure that looks at the time and recent activity in the DB, and acts according to what it finds:

- If it's the first fifteen minutes after 11pm and the database has changed that day, it does a full backup.

- If it's between 6am and 11pm, and in the first fifteen minutes of the hour, and the database was changed sometime during the previous hour, it does a differential backup.

- If it's between 6am and 11pm, sometime during the second, third or fourth fifteen minutes of the hour, and the database was changed sometime during the previous fifteen-minute block, it does a transaction log backup.

This works fine.

I then have a VBScript task that wipes all .bak files from the database folder, executes this procedure, then scans again for .bak files, zipping any that it finds to another folder, from where the .zip files are subsequently copied to further backup storage, both on and off site.

This also works fine.

What's not fine is the Windows Scheduled Task. I have this in the list of scheduled tasks to run every fifteen minutes, the schedule window gives the correct time for next scheduled run, the history window shows that it attempted the task, but nothing happens. The log shows only an "execution failed" error message, with no details. I've tried all the stuff I could find on the net about scheduled tasks, but nothing helps. A couple of times it seemed to be on the right track, but then suddenly stopped executing again, for no reason that I can see. I've tried setting execute with highest privelege, using my own admin account, using the system account, while logged on, while logged off, setting run regardless of logged-in status, wake machine to run task, putting the script name directly as a task, putting {full path}Wscript.exe as the task and the script name with full path as a parameter, including the folder in which to run - every option I can think of and every option I've seen posted somewhere as a posible solution - nothing has helped.

The scheduled time comes and goes, the task history updates that it attempted execution, but zilch. And yet when I simply double-click the script to run it manually, it works perfectly. No parameters, no external information to confuse anything.
Post #1377937
Posted Saturday, October 27, 2012 1:00 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, November 5, 2014 3:47 PM
Points: 3,087, Visits: 1,437
Did you try this link http://technet.microsoft.com/en-us/library/dd851678.aspx




My blog
Post #1377976
Posted Saturday, October 27, 2012 2:44 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 8:06 AM
Points: 354, Visits: 1,029
Ignacio A. Salom Rangel (10/27/2012)
Did you try this link http://technet.microsoft.com/en-us/library/dd851678.aspx
No, that's something new, thank you. I'm not at work and have a slow connection here, but I'll try it as soon as I get in tomorrow.
Post #1377981
Posted Monday, October 29, 2012 5:53 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 8:06 AM
Points: 354, Visits: 1,029
Ignacio A. Salom Rangel (10/27/2012)
Did you try this link http://technet.microsoft.com/en-us/library/dd851678.aspx
Ok, unfortunately, that's not something I can work with. I am not a domain administrator. I have local admin privileges on the server, but not domain admin privileges.
Post #1378203
Posted Monday, October 29, 2012 6:54 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, November 5, 2014 3:47 PM
Points: 3,087, Visits: 1,437
pdanes (10/29/2012)
Ignacio A. Salom Rangel (10/27/2012)
Did you try this link http://technet.microsoft.com/en-us/library/dd851678.aspx
Ok, unfortunately, that's not something I can work with. I am not a domain administrator. I have local admin privileges on the server, but not domain admin privileges.
Did you give the user the "log on as batch job" permission on the server. Check http://social.technet.microsoft.com/Forums/en-US/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe. Good luck!





My blog
Post #1378230
Posted Monday, October 29, 2012 6:56 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, November 5, 2014 3:47 PM
Points: 3,087, Visits: 1,437
This link http://www.beyondpictures.com/blog/tech/2008/03/rights-required-to-run-scheduled-tasks.html may also help.




My blog
Post #1378232
Posted Tuesday, October 30, 2012 10:32 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 8:06 AM
Points: 354, Visits: 1,029
Okay, it's running. I'm not quite sure exactly what finally did the trick - I played with modifying the access privileges, as one of the articles suggested, and I restarted the task, which I hadn't always done before, as well as fiddled again with some of the account settings. Maybe a task restart is also necesary when something changes, although I would expect it would make the attempt and fail each time, if it was a privilege issue. Otherwise, it would indicate that the task was storing the privileges it read on the first attempt and never actually trying it again.

Regardless, I now have a working configuration, so I can experiment with one setting at a time to find out what I actually need and what makes it fail again. Many thanks, Ignacio.
Post #1378883
Posted Tuesday, October 30, 2012 11:23 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, November 5, 2014 3:47 PM
Points: 3,087, Visits: 1,437
pdanes (10/30/2012)
Okay, it's running. I'm not quite sure exactly what finally did the trick - I played with modifying the access privileges, as one of the articles suggested, and I restarted the task, which I hadn't always done before, as well as fiddled again with some of the account settings. Maybe a task restart is also necesary when something changes, although I would expect it would make the attempt and fail each time, if it was a privilege issue. Otherwise, it would indicate that the task was storing the privileges it read on the first attempt and never actually trying it again.

Regardless, I now have a working configuration, so I can experiment with one setting at a time to find out what I actually need and what makes it fail again. Many thanks, Ignacio.

Great to hear you got it working. It will be nice to share the exact solution once you are able to figure out what was the problem. I'm really happy to hear you manage to get it working.





My blog
Post #1378909
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse