Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Automatic backup task


Automatic backup task

Author
Message
pdanes
pdanes
SSC-Addicted
SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)

Group: General Forum Members
Points: 446 Visits: 1350
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.
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3116 Visits: 1439
Did you try this link http://technet.microsoft.com/en-us/library/dd851678.aspx




My blog

pdanes
pdanes
SSC-Addicted
SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)

Group: General Forum Members
Points: 446 Visits: 1350
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.
pdanes
pdanes
SSC-Addicted
SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)

Group: General Forum Members
Points: 446 Visits: 1350
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.
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3116 Visits: 1439
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

Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3116 Visits: 1439
This link http://www.beyondpictures.com/blog/tech/2008/03/rights-required-to-run-scheduled-tasks.html may also help.




My blog

pdanes
pdanes
SSC-Addicted
SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)SSC-Addicted (446 reputation)

Group: General Forum Members
Points: 446 Visits: 1350
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.
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3116 Visits: 1439
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

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search