Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

How to stop and start services everynight automatically

  • 30-04-2008 2:58pm
    #1
    Registered Users, Registered Users 2 Posts: 3,717 ✭✭✭


    OS is Windows server 2000 with Sql express.

    I need to get some SQL databases backed up every night on a server and I don't exactly know how to go about it.

    Please see attached. If I can get these services paused or stopped between 12 midnight and 6am, I could run the backup. I'm sure there must be a way to do this with a batch file. Can anyone point me in the right direction.

    The expensive solution to my problem is to get the SQL plugin for backup exec but it's very expensive and I know there has to be way around this!

    Thanks for your help in advance :)


Comments

  • Registered Users, Registered Users 2 Posts: 3,405 ✭✭✭nc6000


    Schedule two batch jobs. One with a Net Stop command to run before the backup and another with a Net Start to run after the backup window.


  • Registered Users, Registered Users 2 Posts: 17,727 ✭✭✭✭Sherifu


    Batchfiles + Scheduled tasks.

    net stop servicename

    net start servicename


  • Registered Users, Registered Users 2 Posts: 3,405 ✭✭✭nc6000


    Just too late.....;)


  • Registered Users, Registered Users 2 Posts: 17,727 ✭✭✭✭Sherifu


    nc6000 wrote: »
    Just too late.....;)
    That's what she said last night?


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    If you double-click on the service, you'll get the service name

    The command "NET STOP <SERVICE NAME>" will stop it, and "NET START <SERVICE NAME>" will restart it.

    For SQL Server, you'll need to stop the service in order to backup the databases, pausing it won't work as it'll keep the files locked.

    Although the SQL Express server doesn't come with the tools to do scheduled backups, it will still allow you to run SQL Queries to back up the database to disk. Instead of taking the server offline, you could schedule a batch file to run the backup query against the database. The benefit being that you can run this batch file any time you want to back up the database day or night, without having to take it offline.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,405 ✭✭✭nc6000


    Sherifu wrote: »
    That's what she said last night?


    Your Ma ?


    Couldn't resist.


  • Registered Users, Registered Users 2 Posts: 379 ✭✭jim_bob


    rather than use Scheduled tasks just use the pre /post commands under settings of the backup job thats what it is there for , so if you back does not run some nights at least the services won;t be stopped


  • Registered Users, Registered Users 2 Posts: 3,717 ✭✭✭Praetorian


    Wow, thanks for the super quick feedback guys. I'll give it a go


  • Registered Users, Registered Users 2 Posts: 3,717 ✭✭✭Praetorian


    Once again my appreciation for the replies. I haven't made any glaringly obvious mistakes? (please see attached)!

    Thanks again lads. :D


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    The AD Helper service is disabled, so you don't need to start/stop that.

    Also, the MSSQL Service should the last one that you stop and the first one that you start.

    As general rule with services, you stop the dependent services first and start them last, (sort of a FIFO arrangment).


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,717 ✭✭✭Praetorian


    Cheers seamus.


Advertisement