Scheduling SQL Export Backups
To create scheduled backups of the configuration database, you can use the export tool and the built-in scheduler of the CData Virtuality Server.
Windows
- Create a folder where you want to back up the dumps: drive:\path\to\backup.
Create the script backup.bat containing the following:
POWERSHELLcd drive:\path\to\backup\cli-export-1.0 set hr=%time:~0,2% if "%hr:~0,1%" equ " " set hr=0%hr:~1,1% .\export.bat --username username --password password --host localhost --file ..\%date:~-4,4%-%date:~-7,2%-%date:~-10,2%_%hr%_%time:~3,2%_%time:~6,2%_config_backup.sql
By default, the export tool is stored in C:\Data Virtuality Suite\DVServer\bin\cli-export-1.0.
If you want to schedule the execution from within Data Virtuality Server, create an SQL job:
SQLCALL SYSADMIN.CreateSQLJob ( script => 'CALL SYSADMIN.execExternalProcess( ''drive:\\path\\to\\backup\\cli-export-1.0\\backup.bat'', null )', description => 'internal db backup to drive:\path\to\backup' );
Add a schedule to this job in the jobs tab in the CData Virtuality Studio.
All backups are stored in the drive:\path\to\backup folder.
Linux
- Create a folder where you want to back up the dumps: /path/to/backup/dir.
Create the script backup.sh containing the following:
BASH#!/bin/sh OLDPWD=$PWD DIR=`dirname $0` cd $DIR ./export.sh --username username --password password --host localhost --file ../`date +"%Y-%m-%d_%H_%M_%S"`_config_backup.sql cd $OLDPWD
By default, the export tool is stored in C:\Data Virtuality Suite\DVServer\bin\cli-export-1.0.
Add execution permissions to backup.sh and export.sh (
chmod a+x <file>
).If you want to schedule the execution from within the Data Virtuality Server, create an SQL job:
SQLCALL SYSADMIN.CreateSQLJob ( script => 'CALL SYSADMIN.execExternalProcess( ''/path/to/backup/dir/cli-export-1.0/backup.sh'', null )', description => 'internal db backup to path/to/backup/dir' );
Add a schedule to this job in the jobs tab of the CData Virtuality Studio.
All backups are stored in the drive:\path\to\backup folder.