0

I am trying to create a backup schedule in Microsoft SQL Server Management Studio that is creating backups every night of the SQL. (This works) But i want it to create the backup in multiple folders. One local, two on other PCs on the same local domain.

Right now I can´t find a way to create the backup on multiple folder on the local server (have not setup all the PCs yet). Is there any way to do that on one single schedule or do i need to create 3 different ones?

The plan is doing more then only backup, it first do "Check Database Integrity", then "Update Statistics and Clean up History" then the backup is done.

I don´t want to use any 3rd party backup program.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nivres
  • 125
  • 2
  • 8
  • 1
    What about using Task Scheduler to just copy the single backup to multiple locations? UNC backup only works in more recent SQL (through the front-end). – Anthony Horne May 09 '14 at 14:11
  • The problem with that is the name of the .bak file. "Name_backup_yyyy_mm_dd_hhmmss_(7 numbers).bak" The 7 numbers i don´t know what they are. – Nivres May 09 '14 at 14:21
  • See my answer below regarding Date/Time requirements. – Anthony Horne May 09 '14 at 14:31

1 Answers1

0

You should be able to accomplish that with Task runner. For your additional requirements, you should be able to accomplish that using batch programming (batch file). Code sample requires an answer (formatted):

echo on
 @REM Seamonkey’s quick date batch (MMDDYYYY format)
 @REM Set ups %date variable
 @REM First parses month, day, and year into mm , dd, yyyy formats and then combines to be MMDDYYYY

FOR /F “TOKENS=1* DELIMS= ” %%A IN (‘DATE/T’) DO SET CDATE=%%B
 FOR /F “TOKENS=1,2 eol=/ DELIMS=/ ” %%A IN (‘DATE/T’) DO SET mm=%%B
 FOR /F “TOKENS=1,2 DELIMS=/ eol=/” %%A IN (‘echo %CDATE%’) DO SET dd=%%B
 FOR /F “TOKENS=2,3 DELIMS=/ ” %%A IN (‘echo %CDATE%’) DO SET yyyy=%%B
 SET date=%mm%%dd%%yyyy% 

You get the idea.. (PFE: http://www.tech-recipes.com/rx/956/windows-batch-file-bat-to-get-current-date-in-mmddyyyy-format/)

Anthony Horne
  • 2,522
  • 2
  • 29
  • 51