Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
Automatic backup task
Automatic backup task
Rate Topic
Display Mode
Topic Options
Author
Message
pdanes
pdanes
Posted Saturday, October 27, 2012 4:48 AM
SSC Veteran
Group: General Forum Members
Last Login: Tuesday, June 04, 2013 12:32 AM
Points: 257,
Visits: 692
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
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Posted Saturday, October 27, 2012 1:00 PM
Hall of Fame
Group: General Forum Members
Last Login: Yesterday @ 5:05 PM
Points: 3,051,
Visits: 1,364
Did you try this link
http://technet.microsoft.com/en-us/library/dd851678.aspx
My blog
Post #1377976
pdanes
pdanes
Posted Saturday, October 27, 2012 2:44 PM
SSC Veteran
Group: General Forum Members
Last Login: Tuesday, June 04, 2013 12:32 AM
Points: 257,
Visits: 692
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
pdanes
pdanes
Posted Monday, October 29, 2012 5:53 AM
SSC Veteran
Group: General Forum Members
Last Login: Tuesday, June 04, 2013 12:32 AM
Points: 257,
Visits: 692
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
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Posted Monday, October 29, 2012 6:54 AM
Hall of Fame
Group: General Forum Members
Last Login: Yesterday @ 5:05 PM
Points: 3,051,
Visits: 1,364
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
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Posted Monday, October 29, 2012 6:56 AM
Hall of Fame
Group: General Forum Members
Last Login: Yesterday @ 5:05 PM
Points: 3,051,
Visits: 1,364
This link
http://www.beyondpictures.com/blog/tech/2008/03/rights-required-to-run-scheduled-tasks.html
may also help.
My blog
Post #1378232
pdanes
pdanes
Posted Tuesday, October 30, 2012 10:32 AM
SSC Veteran
Group: General Forum Members
Last Login: Tuesday, June 04, 2013 12:32 AM
Points: 257,
Visits: 692
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
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Posted Tuesday, October 30, 2012 11:23 AM
Hall of Fame
Group: General Forum Members
Last Login: Yesterday @ 5:05 PM
Points: 3,051,
Visits: 1,364
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 »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.