Manual in PDF format

1. Database backup

  • The “SqlBackup.exe” program is used to back up the database. It is located in the “Backup” directory. It supports backup of both MSSQL and Firebird databases. In general, the database can be backed up in full or incrementally, but “SqlBackup.exe” only supports full backups.
  • Creating a database backup using the “SqlBackup.exe” program can only be started from the computer on which the database server is running and on which the database is physically located.
  • Use:
SqlBackup.exe [source] [target]
  • Parameter source specifies the database name (MSSQL database) or the full path to the disk database (Firebird database).
  • Parameter target specifies the name of the file in which the backup will be saved. The file name can contain the variables #year#, #month#, #day#, #dayofweek#, #dayofyear# and #week#.
  • Example:
SqlBackup.exe netgenium netgenium-#dayofweek#
  • The use of variables is advantageous not only for identifying the backed-up database, but also for choosing how large the backup we want to maintain. “SqlBackup.exe” overwrites files with the same name, so you can use the#dayofweek#variable to maintain a weekly backup (netgenium-1, netgenium-2 to netgenium-7 files will be backed up, the old backup will be overwritten when a new database is backed up).
  • If the destination parameter is not specified (only the database name or its full disk path is specified), the database is backed up to the current location in the format “yyyy-mm-dd-database_name”.
  • When backing up the MSSQL database, you can also use the optional parameter “/backuplog”, where the program also backs up the transaction log of the database with the extension “.ldf”. The backup will be performed in a separate file named “database_backup_name-log.bak” and in the same location as the database backup.
  • After a successful backup, the service named “SqlBackup” will be automatically logged into the database table “ng_windowsservice” with an interval set to 1 day.
  • When running without parameters, the program offers several options depending on the action we want to perform:

Obrázek.png

  • Choice B specifies the backup. It is important to note that the methodology of working with MSSQL and Firebird databases is different. In the case of an MSSQL server, the database is identified by the database name and an instance of the MSSQL server, while the Firebird database is identified by a direct physical path to the database. The backed up MSSQL database has the extension “.bak”. The Firebird backup has the extension “.fbk”.
  • When you select B, “SqlBackup.exe” searches for all available databases
    • in the default MSSQL server instances – (local) and (local)\SQLEXPRESS,
    • in the found instances of the MSSQL server listed in the registry,
    • and in the “E:\Firebird”, “D:\Firebird” and “C:\Firebird” directories,
    • and offers the user which database to back up.
  • The parameter can also be used when running the “SqlBackup.exe” program –S , which can be used to specify a specific instance of the MSSQL server in case one of its instances is not found automatically (ie does not have an entry in the system registry under the key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft SQL Server\Instance Names\SQL” or has a non-default instance name).
  • Example:
SqlBackup.exe –S(local)\SQLEXPRESS

Obrázek.png

  • Elections BTHIS or BT backs up the database that is listed in the “ConnectionString.txt” file in the “Config” folder.

Obrázek.png

  • Choice R restores the backed-up database (restore). “SqlBackup.exe” searches for all backups in its location from where it is run and after finding the backups, the program offers the user which database to restore. It overwrites the original database when it is restored.

Obrázek.png

  • After selecting the backup from which to restore, you will be prompted to enter the name of the new restored database.

Obrázek.png

  • For security reasons, you will also be prompted to confirm the entered name of the new restored database.

Obrázek.png

  • At the end of the recovery process, you will be asked where the recovered database should be saved in the default MSSQL / Firebird directory.

Obrázek.png

1.1. Database backup scheduling

  • “SqlBackup.exe” is a console application, so you can write a batch file to run it and have it run automatically using “Task Scheduler” in Windows. To run the batch file correctly, it is important to set the directory in which the batch is to be run. This setting can be made either directly in the batch file or in the settings of the scheduled task itself. Which option to choose depends on the number of applications that run in the batch file along with the database backup. Typically, for example, NET Genium scripts, backup of file attachments, or even updates to NET Genium to the latest version can be run together with the backup.

1.1.1. Start one or more applications that are located in the same directory

  • The user who creates the batch file in which one or more applications located in the same directory will run has a choice of two options.
    • Either use the simpler variant, using the “Run in (optional)” field in the “Task Scheduler” and thus defines the directory in which the applications called from the batch file will be run,
    • or use the more complex variant described below in chapter 1.1.2.

The simpler variant has the disadvantage that the batch file cannot be run manually with the “Run as administrator” option (right-click on the batch file). As of 2008, Windows runs batch files that run with the “Run as administrator” option from the “C:\Windows\System32” directory by default, not from the location where the batch file itself is stored.

Batch file

  • For example, to schedule a database backup, create a batch file “ BackupDatabase.bat ” and save it in the directory “ D:\Services\BackupServer\ ”.

Batch file for MSSQL database server

rem Weekly backup (7 backups back)
SqlBackup.exe netgenium netgenium-#dayofweek#
rem Monthly backup (31 backups back)
SqlBackup.exe netgenium netgenium-#day#
rem Annual backup (365 backups back)
SqlBackup.exe netgenium netgenium-#month#-#day#

Batch file for Firebird database server

rem Weekly backup (7 backups back)
SqlBackup.exe D:\Firebird\netgenium.fdb netgenium-#dayofweek#
rem Monthly backup (31 backups back)
SqlBackup.exe D:\Firebird\netgenium.fdb netgenium-#day#
rem Annual backup (365 backups back)
SqlBackup.exe D:\Firebird\netgenium.fdb netgenium-#month#-#day#

Task Scheduler

  • Open Control Panel and find the Administrative Tools category, where you can select Task Scheduler (or search for it using the Search box).
  • In the Task Scheduler, click “Create Task”.

Obrázek.png

  • In the newly opened window on the “General” tab, you can primarily define the name of the task and the user account with the necessary permissions under which the task will run. An important setting here is to check the “Run with the highest privileges” option to keep the task running.

Obrázek.png

  • On the “Actions” tab, click the “New” button to specify what the task should do. You need to run our batch file “ BackupDatabase.bat ”. It is also important to set the directory in which the scheduled task applications will run. It is therefore necessary to fill in the “Start in (optional)” field.

Obrázek.png

  • On the “Triggers” tab, click on the “New” button to specify at what time and how often the task (backup) should be performed.
  • Scheduled database backup is set up.
  • The procedure for creating a scheduled task is demonstrated on Windows 7, the procedure for Windows Server is basically similar, differing only in cosmetic differences.

1.1.2. Run multiple applications that are located in different directories

If the batch file includes the “SqlBackup.exe” application – which is an application located in the “Backup” directory – it is important to set the path in which the application is to run directly in the batch file. The backup is saved in the current directory. The advantage of batch files created in this way is also that it is possible to run them manually by selecting “Run as administrator”.

Batch file

  • For example, to schedule a database backup, create a batch file “ BackupDatabase.bat ” and save it in the directory “ D:\Services\BackupServer\ ”.

Batch file for MSSQL database server

D:\NETGenium\bin\RunScript.exe 1075
D:\NETGenium\bin\Update.exe -j

D:
cd D:\NETGenium\Backup
SqlBackup.exe netgenium netgenium-#dayofweek#
  • “RunScript.exe” can be run without the need to define the directory in which it runs
  • First it is necessary to define which disk we are working on
  • The command “cd” takes the user to the required directory in which the application will run
  • If another batch file is called in the batch file, it is necessary to state the “call” command when calling the batch file.

Batch file for Firebird database server

D:\NETGenium\bin\RunScript.exe 1075
D:\NETGenium\bin\Update.exe -j

D:
cd D:\NETGenium\Backup
SqlBackup.exe D:\Firebird\netgenium.fdb netgenium-#dayofweek#
  • You can run “RunScript.exe” without defining the directory in which it runs
  • First it is necessary to define which disk we are working on
  • The command “cd” takes the user to the required directory in which the application will run
  • If another batch file is called in the batch file, it is necessary to state the “call” command when calling the batch file.

Scheduled task

To create a scheduled task:

  • Open “Control Panel” and find the category “Administrative Tools”, where you select “Task Scheduler” (or search for it using the Search field).
  • In the Task Scheduler, click “Create Task”.

Obrázek.png

  • In the newly opened window on the “General” tab, you can primarily define the name of the task and the user account with the necessary permissions under which the task will run. An important setting here is to check the “Run with the highest privileges” option to keep the task running.

Obrázek.png

  • On the “Actions” tab, click the “New” button to specify what the task should do. You need to run our batch file “ BackupDatabase.bat ”. Because multiple applications located in different directories will run, it is not possible to set a single directory in “Task Scheduler” in which all applications will run (“Run in (optional)” field). This setting for each application takes place in a batch file.

Obrázek.png

  • On the “Triggers” tab, click on the “New” button to specify at what time and how often the task (backup) should be performed.
  • Scheduled database backup is set up.
  • The procedure for creating a scheduled task is demonstrated on Windows 7, the procedure for Windows Server is basically similar, differing only in cosmetic differences.

1.2. Restore a database backup

  • After running the “SqlBackup.exe” program, select the option R (restore). “SqlBackup.exe” searches for all backups in its location from which it is run. After finding the backups, the program will offer the user which database to restore. It overwrites the original database when it is restored. After selecting the database, you need to enter its name to which the backup will be restored. If you want to restore the currently used database, choose its same name as in the “ConnectionString.txt” file in the “Config” directory of your NET Genium. When restoring the MSSQL database, the “SqlBackup.exe” program asks if the database should be restored to the default MSSQL directory, resp. it is possible to specify a specific path to the directory to which the database is to be restored.

2. File backup

  • The “FileBackup.exe” program is intended for backing up NET Genium files. It is located in the “Backup” directory. Creating a backup consists of:
    • Backup IIS settings
    • Backup the NET Genium directory
    • Backup file attachments
  • Use:
FileBackup.exe [target]
  • Parameter target specifies the directory or network location to which the backup will be performed.
  • Other parameters can also be used:
    • /iisonly – only IIS settings are backed up (in this case there is no need to specify the parameter target )
    • /noiis – only the NET Genium directory and NET Genium file attachments are backed up
    • file.ini – only file attachments whose ID is larger than the value specified in the configuration file “file.ini” are backed up
  • If it is necessary to back up other files located outside the NET Genium directory together with the backup of the NET Genium directory and file attachments, the configuration file “FileBackup.exe.config” is used. If the “FileBackup.exe” application finds the configuration file “FileBackup.exe.config” in the “Backup” directory before creating the backup, it will create the archive “FileBackup.zip” in the same directory, which will contain the files defined in this configuration file. “FileBackup.zip” then becomes part of the NET Genium backup.
  • The following is an example configuration file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>

<add key="directory" value="D:\Services" />
<add key="excludedirectory" value="D:\Services\CRMService\POP3Downloads" />
<add key="excludefile" value="D:\Services\CRMService\*.log" />

</appSettings>
</configuration>

Where it is possible to specify:

  • Directories to be backed up – “directory” or “includedirectory” parameter
  • Directories that will not be backed up – “excludedirectory” parameter
  • Files that will not be backed up – “excludefile” parameter
    • Here it is possible to use the construction “*. extension”, which will ensure that the application will work in the directory only with files with this extension

2.1. Backing up files using the “file.ini” configuration file

  • To back up NET Genium file attachments whose ID is greater than the value specified in the “file.ini” configuration file, the “FileBackup.exe” program is run, running with the configuration file name as the only parameter. If the “FileBackup.exe” application finds a configuration file with the required name in the “Backup” directory, it continues to back up file attachments that have been created since the application was last started. If it does not find the configuration file, it creates it and asks for the destination directory or network location to which the backup will be performed, along with the initial ID of the file attachment from which the backup is to start.

2.2. Schedule file backups

  • For example, to schedule a file backup, create a batch file “ BackupFiles.bat ” and save it in the directory “ D:\Services\BackupServer\ ”. A scheduled task that will run this batch file is required in the “Task Scheduler” set in the “Run in (optional)” field the directory in which the scheduled task will run. In the event that you need to run a batch file with the “Run as administrator” option, you must also enter commands in the body of the batch file that specify the directory in which each application will run.

Option 1:

if exist Z: goto Z_OK
net use Z: \\NAS-NETGenium\Files PASSWORD /USER:LOGIN
:Z_OK
chcp 1250
FileBackup.exe Z:
  • the batch file first determines if the network drive “Z” is mapped. If not, it maps it with the “net use” command, and then the “FileBackup.exe” program backs up the files to this network drive.
  • if a user name and password are required to access the network location, “LOGIN” and “PASSWORD” are specified instead. If the name and password do not need to be specified, nothing is specified in the batch file (not even the/USER parameter)

Option 2:

FileBackup.exe \\NAS-NETGenium\Files
  • in the case of backing up files to a network location directly
  • old files are not overwritten, only newly created ones are copied (file “0.zip”, which contains the NET Genium directory, is always overwritten)
  • files changed (modified by the REDUCEATTACHMENT function) are overwritten
  • in this case it is not necessary to create a batch file, the program “FileBackup.exe” can be run in the scheduled task directly instead of specifying the batch file
  • The file attachments to be backed up are read from the “sfiles” database table from the “backupdir” column. This column stores the path where the file was backed up. If the path specified in the parameter and the path in the database match, the backup of this file will not be performed because it has already been performed previously. This ensures incremental backups of only new files. If a file attachment has been manipulated using the REDUCEATTACHMENT function, its path in the database is reset and such a file is also backed up during the next backup. After a successful backup, a service named “BackupFiles” is logged in the database table “ng_windowsservice” with an interval of 1 day.

2.3. Restore a file backup

  • First, create an empty directory where you want NET Genium to restore (for example, “D:\Inetpub\wwwroot\NETGenium”).
  • Then download “FileBackup.exe” program from “https://www.netgenium.com/download/FileBackup.exe”. Save the program in the directory you created.
  • Then run the “FileBackup.exe” program, for example in the Total Commander program, using the “FileBackup.exe\\NAS-NETGenium\Files/restore” command, where the first parameter is the path to the directory where the backup is stored. After running the command, the following dialog box is displayed and the user can choose from three items.

Obrázek.png

  • When restoring a file backup, existing files already stored in the NET Genium directory are not overwritten, which is emphasized in the dialog box. Not overwriting existing files resolves a situation where some missing files would need to be restored without rewriting those files that were newly created or modified.

2.3.1. Restore all files

  • By confirming this option, the program restores the entire NET Genium directory structure from the backup whose access path was defined as the first parameter when running the “FileBackup.exe” program. The NET Genium directory structure is restored to the directory in which the “FileBackup.exe” program was run. After the successful recovery of all files, the “FileBackup.exe” program must be deleted in the originally empty directory and the “FileBackup.exe” program from the “Backup” directory must be used for any further recovery.

After the successful recovery of the NET Genium directory structure, it is now possible to delete the “FileBackup.exe” program in the originally empty directory, and to use the “FileBackup.exe” program located in the “Backup” directory for possible further restoration of file attachments.

2.3.2. Restore all files except file attachments

  • Restoring all files can be a very time-consuming operation, depending on the size of the backup and the performance of the server. In a crisis situation, it is therefore possible to divide the backup recovery into two phases:
    • In the first phase, it is possible to restore only the NET Genium directory structure without file attachments resp. without the “Files” directory so that it is possible to run NET Genium, services, etc.,
    • and in the second phase, restore the file attachments themselves.
  • After the successful recovery of the NET Genium directory structure, it is now possible to delete the “FileBackup.exe” program in the originally empty directory, and to use the “FileBackup.exe” program located in the “Backup” directory for possible further restoration of file attachments.

2.3.3. Restore file attachments only

  • Restoring file attachments separately is important if the recovery has been divided into two phases:
    • In the first phase, it is possible to restore only the NET Genium directory structure without file attachments resp. without the “Files” directory so that it is possible to run NET Genium, services, etc.,
    • and in the second phase, restore the file attachments themselves.
  • After the successful recovery of the NET Genium directory structure, it is now possible to delete the “FileBackup.exe” program in the originally empty directory, and to use the “FileBackup.exe” program located in the “Backup” directory for possible further restoration of file attachments.

Restore all file attachments

  • The “FileBackup.exe” program restores all file attachments located in the backup that have not yet been restored to the “Files” directory.

Restore file attachments read from database

  • For this option, it is necessary to have the “FileBackup.exe” program stored in the “Backup” directory and the “NETGeniumConnection.dll” file. If this file is not in the “Backup” directory, it can be copied from the “bin” directory.
  • The “FileBackup.exe” program also displays the entry “Type of list of tables separated by semicolons:”, in which the user lists a semicolon-separated table in which file attachments stored in the “File”, “Image” or “Semicolons” controls can be found. RichTextBox”. These file attachments will be loaded with “SELECT *” and subsequently restored.

Obrázek.png

If one of the following situations occurs:

  • “NETGeniumConnection.dll” is not found
  • “ConnectionString.txt” is not found
  • the database defined in the “ConnectionString.txt” file is not found,
  • the connection to the database defined in the “ConnectionString.txt” file fails,
  • the table defined on the input is not found,
  • the found table has no column of type “File”, “Image” or “RichTextBox” or
  • if no file attachment is found in the defined input table, an error message is returned to the user and the user must re-enter the input table.

Obrázek.png

When the file attachments recovery is complete, statistics on the number of file attachments that have been placed, restored and skipped in the backup are displayed.

Obrázek.png

Restore file attachments [<fromDate>] [<toDate>]

The “FileBackup.exe” program also displays the “fromDate” and “toDate” inputs, in which the user fills in the data attachment creation data range. After filling in the individual inputs, the user must always confirm the parameters entered by him. Defining a date range ensures that only file attachments that have a creation date in the given time range and that have not yet been restored to the “Files” directory are restored. Both “fromDate” and “toDate” are not required, so

  • if both “fromDate” and “toDate” are specified, only file attachments that have a creation date greater than or equal to “fromDate” and less than or equal to “toDate” will be restored.
  • if only “fromDate” is specified, only file attachments with a creation date greater than or equal to “fromDate” will be restored,
  • if only “toDate” is specified, only file attachments with a creation date less than or equal to “toDate” will be restored,
  • if neither “fromDate” nor “toDate” is specified, the user will be prompted to re-enter the entries.

Variables and functions of NET Genium can also be inserted into individual date inputs (e.g. “ADDDAYS(#today#, -2)”). When using NET Genium variables and functions as date inputs, keep in mind that the “NETGeniumConnection.dll” file must also be stored in the “Backup” directory, where the “FileBackup.exe” program is located. If this file is not in the “Backup” directory, it can be copied from the “bin” directory.

Obrázek.png

  • When the file attachments restore is complete, statistics on the number of file attachments that have been placed, restored and skipped in the backup are displayed.

Obrázek.png

Restore file attachments [<fromId>] [<toId>]

  • The “FileBackup.exe” program also displays the “fromId” and “toId” entries, in which the user fills in the range of file attachment IDs. After filling in the individual inputs, the user must always confirm the parameters entered by him. Defining an ID range ensures that only file attachments that have an ID in that range and that have not yet been restored to the “Files” directory are restored. Both “fromId” and “toId” are not required items, so
    • if both “fromId” and “toId” are specified, only file attachments with larger IDs will be restored or equal to “fromId” and less than or equal to “toId”,
    • if only “fromId” is specified, only file attachments with larger IDs will be restored or equal to “fromId”,
    • if only “toId” is specified, only file attachments with smaller IDs will be restored or equal to “toId”,
    • if neither “fromId” nor “toId” is specified, the user will be prompted to refill the entries.

Obrázek.png

  • When the file attachments restore is complete, statistics on the number of file attachments that have been placed, restored and skipped in the backup are displayed.

Obrázek.png

3. Backup using BackupServer.exe

  • Backup using the “BackupServer.exe” program is based on the principle of creating backups on the server and their subsequent download via the Internet or via the internal computer network to the client station. Using “BackupServer.exe” it is possible to back up:
    • IIS server settings
    • Indexing Service settings
    • Database (MSSQL, Firebird)
    • NET Genium directory
  • Sample program files are always available in the NET Genium directory in the “Backup\BackupServer” directory.
  • Use:
BackupServer.exe [/config][/decrypt][/restore]
  • Optional parameters:
    • /config – creates a sample configuration file “BackupServer.exe.config” in the current location
    • /decrypt – decrypts all ZIP archives in the “Files” directory, see chapter 3.3.
    • /restore – restores all ZIP archives from the “Files” directory to backed up files, see chapter 3.3.
  • The parameter file can also be used when running the “BackupServer.exe” program which can be used to specify a specific encrypted file when backing up. In this case, the file will be decrypted.
  • Example of use:
BackupServer.exe file.zip

3.1. Server part – create a backup on the server

  • Save the program together with all its libraries and files in the directory “D:\Services\BackupServer\”
  • “BackupServer.exe” uses the saved file “BackupServer.exe.config”.
  • The following is an example configuration file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>

<add key="key1" value="abcdefgh" />
<add key="key2" value="hgfedcba" />

<add key="database" value="db1" />
<add key="database" value="(local)\SQLEXPRESS|db2" />
<add key="database" value="D:\Firebird\DB3.FDB" />

<add key="directory" value="D:\Inetpub\wwwroot" />
<add key="directory" value="D:\Services" />

<add key="excludedirectory" value="D:\Services\BackupServer\Files" />
<add key="excludedirectory" value="D:\Services\BackupServer\Temp" />
<add key="excludefile" value="D:\Services\PaymentService\*.log" />

<add key="runfile" value="D:\Services\Update\Update.exe" />

<add key="fullbackupinterval" value="7" />

<add key="logServiceConnectionString" value="driver=firebird;datasource=localhost;user=SYSDBA;password=masterkey;database=D:\Firebird\netgenium.fdb;charset=WIN1250;collation=WIN_CZ_CI_AI" />

</appSettings>
</configuration>

Where it is possible to specify:

  • One pair of keys that will be used to encrypt the created backup on the server – parameters “key1” and “key2” (the backup is decrypted again after transfer to the client)
  • Databases to be backed up – “database” parameter
    • In the case of an MSSQL database, this is the syntax “instance_name|database_name”
    • In the case of one specific Firebird database, the full path to the database file is specified
    • For all Firebird databases located in a single directory, the full path to that directory is specified and “\*.fdb” is added to the end of this path.
  • Directories to be backed up – “directory” or “includedirectory” parameter
  • Directories that will not be backed up – “excludedirectory” parameter
  • Files that will not be backed up – “excludefile” parameter
    • Here it is possible to use the construction “*.extension”, which will ensure that the application will work in the directory only with files with this extension
  • Other programs that should be run immediately after the backup is created, but before the backup is encrypted – the “runfile” parameter. This parameter is used when another application needs to be started during the backup. The advantage of the “runfile” parameter is that, for example, the NET Genium update does not have to wait until the backup is completely completed.
  • Number of days after which a full backup is created – parameter “fullbackupinterval”. If this parameter is missing in the configuration file, the default time is 1 month. This parameter is usually used in a situation where there is not enough space on the disk intended for backup, and therefore it is necessary to reduce the interval of creating full backups (which also means reducing the number of incremental backups).
  • Automatic logging of the service named “BackupServer” to the database table “ng_windowsservice” with the interval set to 1 day in case the backup was successful – parameter “logServiceConnectionString”.
  • IIS and Indexing Service settings are backed up automatically.
  • “BackupServer.exe” is started by running a scheduled task – the creation of a scheduled task is demonstrated, for example, in chapter 1.1.1. It is desirable to set this task according to the model in this chapter – mainly by selecting the options to run under the highest rights, regardless of user login and disk D. To run the scheduled task, simply call “BackupServer.exe” directly. Running the program does not require any parameters in the case of a backup.

Backup procedure:

  • Create “Files” and “Temp” directories, if they do not exist
  • Deleting the “Temp” directory, where backups of IIS settings, IIS application pools, IIS sites, Indexing Service settings, and all databases are stored
  • Back up IIS settings, IIS application pools, IIS sites, Indexing Service settings, and all databases to the “Temp” directory
    • The IIS settings backup is named “applicationHost.config”
    • The IIS application pool backup is named “apppools.xml”
    • The IIS site backup is named “sites.xml”
    • The Indexing Service settings backup is named “catalogs.IS”
    • The database backup has a name in the format “database_name.bak” (MSSQL database) or “database_name.fbk” (Firebird database)
  • Check whether a full or incremental backup will be performed
    • Full – is always performed if
      • the “Files” directory is empty (no backup has been made yet),
      • the last full deposit reaches the age of one month or
      • the time defined by the “fullbackupinterval” parameter has elapsed since the last full backup.

        The full backup is saved under the name in the format “yyyy-mm-dd-x (X).zip”, where X is the serial number of the ZIP file (ie “2014-02-06-x (35).zip”). If the total size of the last full backup is larger than 10GB, the next full backup will always be performed only on weekends.
    • Incremental – always performed if a full backup is not performed. Increments are created for files with more recent data than previously backed up files and for newly created files.
  • Delete all backups older than 1 week (full and incremental) if a full backup will be performed and at the same time:
    • the “fullbackupinterval” parameter is specified is less than 30 days or
    • is the size of the last full backup multiplied by a factor of 1.5 larger than the available disk space where the backups will be stored.
  • Creating a new backup – ZIP archive – in the “Files” directory
    • The ZIP archive is created from the contents of the “Temp” directory and from all directories defined in the configuration file.
    • The ZIP archive is packaged not only into one file, but into several ZIP files with a maximum size of one file of 1 GB. The ZIP file is named with the backup date in the format “yyyy-mm-dd(X).zip”, where X is the serial number of the ZIP file.
    • If the database backup is larger than 1 GB, this database is not inserted into a ZIP file, but directly into the “Files” directory. The file name has the name “yyyy-mm-dd-database_name.bak” (MSSQL database) or “yyyy-mm-dd-database_name.fbk” (Firebird database). This database is then deleted from the “Temp” directory.
  • Creating “FileList.txt” and “log.txt” files in the “Files” directory
    • After the backup is completed, a “FileList.txt” file is created, which contains the names of all ZIP files and any databases in this directory. Next, another “FileList.txt” is created in each created ZIP file – this list contains the paths to all files that have been backed up.
    • The “log.txt” file contains an information record that the backup was performed (e.g. “2014-01-01 05:00:00 OK”).
  • Run all programs defined in the configuration file by the “runfile” parameter. The programs are run sequentially
  • Encryption of all newly created files in the “Files” directory if the parameters “key1” and “key2” are defined in the configuration file
  • Delete all backups older than 1 week (full and incremental) if a full backup has just been performed or if the backup date is older than the date of the last full backup
  • To run the client part, the “Files” directory with the performed backups must be accessible remotely. This is accomplished by adding a new virtual directory under NET Genium.

Obrázek.png

  • For example, select the directory alias “backupserver298” or any other, and set its location to “D:\Services\BackupServer\Files\”. You need to set read permissions for this directory in the “Everyone” group (in the normal Windows rights settings).

3.2. Client part – download the backup to the client

  • The task of the client part is to download the performed backups from the server. In the “Client” subdirectory of the “BackupServer” directory, first find the “BackupServerService.exe” program. Run this program to create the “BackupServerService – console.lnk” and “BackupServerService – user.lnk” files.
  • Next, run the file “BackupServerService – user.lnk” and click on the “Install” button in the dialog – this will install the program “BackupServerService.exe” as a system service, which will start automatically after system startup and will check the download of backups every ten minutes. You can then close the dialog with a cross. “BackupServerService.exe” uses a configuration file similar to “BackupServer.exe”. Its name is “BackupServerService.exe.config”, and its contents can be as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>

<add key="url" value="https://www.netgenium.com/backupserver298" />

<add key="smtpServer" value="localhost" />
<add key="smtpUserName" value="" />
<add key="smtpPassword" value="" />

<add key="errorFrom" value="backupserverservice@netgenium.com" />
<add key="errorTo" value="support@netgenium.com" />

<add key="key1" value="abcdefgh" />
<add key="key2" value="hgfedcba" />

<add key="logServiceConnectionString" value="driver=firebird;datasource=localhost;user=SYSDBA;password=masterkey;database=D:\Firebird\netgenium.fdb;charset=WIN1250;collation=WIN_CZ_CI_AI" />

</appSettings>
</configuration>

Where it is necessary to specify:

  • The path from which the backups will be downloaded – the “url” parameter. In the example shown, “backupserver298” is a virtual directory created in IIS. We recommend setting restrictions on IP addresses for this virtual directory so that only computers from specific IP addresses can download files from this directory.
  • SMTP server address and login data for sending e-mail messages – parameters “smtpServer”, “smtpUserName” and “smtpPassword”.
  • E-mail address from which e-mails will be sent about possible errors during the download and decryption of backups – parameter “errorFrom”.
  • E-mail address to which e-mails about possible errors during the download and decryption of backups will be sent – parameter “errorTo”.
  • One pair of keys that will be used to decrypt the created backup – optional parameters “key1” and “key2”. These keys must be the same as in the configuration file on the server. If these parameters are not specified, downloaded backups will not be decrypted.
  • Automatic logging of the service named “BackupServerService” to the database table “ng_windowsserver” with the interval set to 1 day in case the backup was successful – parameter “logServiceConnectionString”.

Backup download information:

  • The backups are saved in the “Files” folder in the location where “BackupServerService.exe” is stored.
  • All ZIP archives and databases are decrypted after download if the parameters “key1” and “key2” are specified in the configuration file.
  • Each time you download backups, the age of the last backups is checked. If there are multiple full backups in the “Files” directory, the first full backup and all older full backups will be automatically deleted.

3.3. Restore a backup

The backup can be restored on the client computer by running the “BackupServer.exe” program with the “/restore” parameter.

When starting the program, you can choose from the following options:

  • Restore all databases and server settings
  • Restore all files
  • Restore all files except file attachments
  • Restore file attachments only
    • Note: To restore a backup directly on the server it is still necessary to run this program with the “/decrypt” parameter before running the “BackupServer.exe” program – the backup files on the server are encrypted, so it is necessary to decrypt them before restoring them.

3.3.1. Restore all databases and server settings

  • By confirming this option, the program will create a “Restore” directory, to which backups of all databases and server settings from the last backup performed on the server will be restored.
    • Database backups can then be restored in bulk using the “SqlBackup.exe” program by selecting the option RA (restore all).
    • The IIS backup can be restored by copying the “applicationHost.config” file to the “Windows\System32\inetsrv\config\” directory. For this purpose, a batch file “applicationHost.bat.txt” is prepared in the “Restore” directory. If the “applicationHost.config” file is not available, the IIS settings can be partially reset using the “sites.xml” and “appools.xml” files by importing into IIS.
    • The Indexing Service backup can be restored by the “ISBackup.exe” program (which is located in the common folder with the “BackupServer.exe” program) by selecting the option R (restore). The “catalogs.IS” file with the Indexing Service backup must be saved in the same location as the “ISBackup.exe” program.

3.3.2. Restore all files

  • By confirming this option, the program restores the entire directory structure, including all files from all performed backups – from the last full backup, including all subsequent incremental ones. The program first asks if the directory structure should be restored:
    • to the original location – which is the same as the location of all directories and files on the server – or
    • to any directory, from where it is then possible to move the directory structure as needed.

3.3.3. Restore all files except file attachments

  • Restoring all files can be a very time-consuming operation, depending on the size of the backup and the performance of the server. In a crisis situation, it is therefore possible to divide the backup recovery into two phases:
    • In the first phase, it is possible to restore only the directory structure without file attachments, resp. without all “Files” directories so that all NET Genium and services can be put into operation,
    • and in the second phase, restore the file attachments themselves.

3.3.4. Restore file attachments only

  • Restoring file attachments separately is important if the recovery has been divided into two phases:
    • In the first phase, it is possible to restore only the directory structure without file attachments, resp. without all “Files” directories so that all NET Genium and services can be put into operation,
    • and in the second phase, restore the file attachments themselves.