Example 3: Back Up a Database and Copy the Resulting Zip File Over a Network
This example shows how to use a batch file and 'Completion Method' to copy the ClearSCADA_Backup_<System>.zip file to a remote server over a network.
The file names and file path names in the example below are for illustrative purposes only. You will need to use file names and paths that are appropriate for your system.
The backup will run on your Main server. You need to set up the folders that you refer to in the backup settings on all the servers that might become a Main server.
Example:
In ViewX, a user creates a Backup item called 'Server Backup' which has the following settings:
- In Service: Enabled
- Severity: High
- Default Parent Directory: C:\ClearSCADA\
- Default Destination: Backup
- Trip Sequence Time: NOW
- Database: Enabled
- Registry: Enabled
- Historic Files: Disabled
- Historic Data: Enabled, Start Offset: Hour -2 Months, End Offset: Hour
- Alarm Summary: Disabled
- Event Journal: Disabled
- Configuration Changes: Disabled
- Compression Level: Optimal Compression
- Erase Files: Enabled.
Next, the user creates a batch file called CopyZippedBackup.bat in the C:\Utilities folder. The batch file contains the following command:
copy C:\ClearSCADA\Backup\ClearSCADA_Backup_<System>.zip \\RemoteServer\ClearSCADAServerABackup\ClearSCADA_Backup_<System>.zip
The user then creates a System Command database item and sets the Command to:
C:\Utilities\CopyZippedBackup.bat
The user now makes the following changes to the Backup database item:
In the Completion Method section, the user sets the Method Object to be the System Command item and sets the Method to Execute().
The user then starts the backup manually. The backup is successful, resulting in a single ClearSCADA_Backup_<System>.zip file being stored in the specified Default Destination directory. Upon completion, Geo SCADA Expert automatically triggers the Execute method for the System Command (in accordance with the Completion Method settings configured for the Backup item). The System Command runs and copies the zip file to the remote backup server.
Further Information
Configure a Completion Method: see Configure a Backup Database Item