You can go two ways:
- using batch script with scheduling;
- using software with full automation.
Batch script:
Code:
@ECHO OFF
SETLOCAL
REM Get date in format YYYY-MM-DD (assumes the locale is the United States)
FOR /F “tokens=1,2,3,4 delims=/ ” %%A IN (‘Date /T’) DO SET NowDate=%%D-%%B-%%C
REM Build a list of databases to backup
SET DBList=%SystemDrive%SQLDBList.txt
SqlCmd -E -S YourSQLServer -h-1 -W -Q “SET NoCount ON; SELECT Name FROM master.dbo.sysDatabases WHERE [Name] NOT IN (‘master’,'model’,'msdb’,'tempdb’)” > “%DBList%”
REM Backup each database, prepending the date to the filename
FOR /F “tokens=*” %%I IN (%DBList%) DO (
ECHO Backing up database: %%I
SqlCmd -E -S YourSQLServer -Q “BACKUP DATABASE [%%I] TO Disk=’ftp://192.168.1.1:Backup%NowDate%_%%I.bak’”
ECHO.
)
REM Clean up the temp file
IF EXIST “%DBList%” DEL /F /Q “%DBList%”
ENDLOCAL
Then schedule this script and add net use command if it is needed.
Another way is to use ready-to-go solution like backup software. I prefer the cheapest one like Handy Backup, but you may want to use something like Norton or Acronis.