Individual server: Backing up data¶
The versiondog system offers the option of backing up the server archive data manually or automatically at regular intervals using a batch file.
Prerequisites¶
To perform a data backup of the server archive, the following mandatory prerequisites must be met:
- The user who performs the data backup manually must have administrative rights on the server system.
- The VDog MasterService must be terminated before the data is backed up.
- The PostgreSQL database system (
PostgreSQL.exe
application) is terminated with the VDog MasterService. For security, you can check this in the Service Control Manager.
If these requirements are not met, the server archive may be destroyed and data may be lost.
Warning
The system is not available during the data backup. It is recommended to perform the data backup during off-peak times, for example at night or at weekends.
Options for saving storage space:
- The
VD_TMP_VD
directory in the server archive only contains temporary files. Back up the server archive without theVD_TMP_VD
directory. - The
vdServerArchive
directory can be compressed before backing up. A corresponding ZIP application must be installed for compression.
Backing up data manually¶
Warning
If you use a remote archive, you must always back up both the remote archive and the local server archive.
Local archive¶
Copy the local directory vdServerArchive
to the desired storage location, e.g. to an external hard disk.
Remote archive¶
Copy the vdServerArchive
directory of the remote share to the desired storage location, e.g. to an external hard disk.
Backing up data automatically¶
You can back up the vdServerArchive
directory automatically by creating a batch file and executing it at a specific time using the Windows Task Scheduler.
Example: Backup.bat file¶
Info
To use the batch file from the example for your system, adapt all path specifications in the file to your system.
set SERVERARCHIVE="D:\vdServerArchive\*"
rem If no remote archive, set the variable remotearchive to an empty value.
rem set REMOTEARCHIVE=""
set REMOTEARCHIVE="\\storage\share\vdServerArchive\*"
set OUTFILE="D:\vdServerBackup.zip"
set 7ZIP="%PROGRAMFILES(x86)%\7-Zip\7z.exe"
net stop "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop server
exit /B %ERRORLEVEL%
)
)
tasklist /fi "ImageName eq VDog*" /fo csv 2>NUL | find /I "VDog">NUL
if "%ERRORLEVEL%"=="0" (
echo Server processes still running
tasklist /fi "ImageName eq VDog*" /fo csv
exit /B 1
)
tasklist /fi "ImageName eq postgres.exe" /fo csv 2>NUL | find /I "postgres.exe">NUL
if "%ERRORLEVEL%"=="0" (
tasklist /fi "ImageName eq postgres.exe" /fo csv
echo Database processes still running
exit /B 1
)
REM Backup local server archive with 7-zip
"%7ZIP%" u -t7z -r %OUTFILE% %SERVERARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip server archive
exit /B %ERRORLEVEL%
)
if "%REMOTEARCHIVE%" == "" GOTO startms
REM Backup remote server archive with 7-zip
"%7ZIP%" u -t7z -r %OUTFILE% %REMOTEARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip remote archive
exit /B %ERRORLEVEL%
)
:startms
net start "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start server
exit /B %ERRORLEVEL%
)
echo "success"
pause