At Veeam forums you can find a .bat script that backups Veeambackup database I've made some changes to fit my own scenario:
@Echo Off
REM Set All=%date:~6,4%%date:~3,2%%date:~0,2%
REM Use above to keep one every day for ever
Set All=%date:~0,2%
Rem Use above to keep just 30 days
rem Echo %ALL%
SQLCMD -S .\VEEAM -E -Q "BACKUP DATABASE VeeamBackup TO DISK='C:\backup\VeeamBackupdb_%All%.bak' WITH FORMAT"
rem Echo .\VEEAM -E -Q "BACKUP DATABASE VeeamBackup TO DISK='C:\backup\VeeamBackupdb_%All%.bak' WITH FORMAT"
You can restore a backup file with the following script:
@Echo Off
:Loop
IF "%1"=="" GOTO Continue
IF "%FILE%"=="" (SET FILE=%1) ELSE (SET FILE=%FILE% %1)
SHIFT
GOTO Loop
:Continue
IF "%FILE%"=="" GOTO NOFILE
if NOT EXIST "%FILE%" GOTO NOTFOUND
NET STOP "Veeam Backup Service"
SQLCMD -S .\VEEAM -E -Q "RESTORE DATABASE VeeamBackup FROM DISK='%FILE%'"
rem Echo .\VEEAM -E -Q "RESTORE DATABASE VeeamBackup FROM DISK='%FILE%'"
NET START "Veeam Backup Service"
GOTO FIN
:NOTFOUND
ECHO.
ECHO ERROR: Backup file '%FILE%' not found.
ECHO VEEAM database has not been restored.
ECHO.
pause
GOTO FIN
:NOFILE
ECHO.
ECHO VEEAM Database Restore Utility. BitBat (c) 2011.
ECHO.
ECHO USAGE: %0 BackupFile
ECHO Where:
ECHO - BackupFile: File that contains a previous Veeam database backup.
ECHO.
pause
:FIN
SET FILE=
No comments:
Post a Comment