|
|
|
|
- Rights required to perform a backup
- Characteristics of the backup
- Backup performed from the HFSQL Control Center
- Scheduled backups
HBackup (Function) In french: HSauvegarde
Available only with this kind of connection
Makes a backup copy of the content of an HFSQL server: all databases on the server, one or more databases, one or more data files. This backup can be performed while one or more databases are being used. The database will be backed up at its state at the beginning of the backup: the backed up database is consistent. Some operations are not allowed during the backup: deleting the data files and the databases, updating the stored procedures. The backup can be described using a variable of type hBackupDescription. In this case, you have the ability to define: - a stored procedure to run BEFORE the backup. This procedure can cancel the backup if necessary.
- a stored procedure to run AFTER the backup.
MyConnection is Connection Backup_Doc is hBackupDescription Backup_Doc.Description = "Doc Backup" Backup_Doc.WithIndex = True Backup_Doc.Destination = "Doc/Backup" Backup_Doc.Source = "Doc/*" Backup_Doc.ProcedureBefore = "mydatabase:DocCol.Check" Backup_Doc.ProcedureAfter = "mydatabase:DocCol.CheckBackup" HBackup(MyConnection, Backup_Doc)
gctConnection is Connection // Back up the wdaccounts database in the "Backup" directory IF HBackup(gctConnection, "wdaccounts/*", "wdaccounts/Backup", True, ... "Backup " + DateSys()) = 0 THEN Error(HErrorInfo(hErrFullDetails)) END
Syntax
Syntax that is using the hBackupDescription type (with call to stored procedures) Hide the details
<Result> = HBackup(<Connection> , <Backup definition>)
<Result>: Integer - Identifier of backup,
- 0 if an error occurs. HErrorInfo is used to identify the error.
HBackup is a non-blocking function: it starts the backup and gives control back to the application.Remark: If a stored procedure is run before the backup and if it returns False, the backup is canceled.
<Connection>: Character string or Connection variable Connection to the server to back up. This connection corresponds to: <Backup definition>: hBackupDescription variable Name of the hBackupDescription variable that contains the description of the backup to perform. In this type of variable, you have the ability to define a stored procedure to run before the backup and a stored procedure to run after the backup.
Syntax kept for backward compatibility with version 12 Hide the details
<Result> = HBackup(<Connection> , <Data to back up> , <Backup destination> [, <Backup of indexes> [, <Description> [, <Progress Bar>]]])
<Result>: Integer - Identifier of backup,
- 0 if an error occurs. HErrorInfo is used to identify the error.
HBackup is a non-blocking function: it starts the backup and gives control back to the application.
<Connection>: Character string or Connection variable Connection to the server to back up. This connection corresponds to: <Data to back up>: Character string Filter used to describe the information to back up. The possible values are as follows: | | * | Backs up all server databases, logs and system databases (users, groups, rights). | Database name/* | Backs up the entire database: data files, links, stored procedures, triggers. | Database name/Name file 1 | Backs up the <Name file 1> data file of the <Database name> database. | Name database 1/Name file 1 + TAB + Name database 2/Name file 2 + ... | List of elements to back up. The separator can be the tabulation (TAB) or the semicolon (";"). | System | Backs up the system databases (users, groups, rights). |
<Backup destination>: Character string Name and destination of the backup. The backup will be preformed on the server, in a location defined by this name. If this name corresponds to a relative path, the backup will be placed in the "Backup" subdirectory of the HFSQL server. To specify:- the directory of the Manta service, use the "%%EXE%%" character string.
- the year, use the "%%YEAR%%" character string (2008 for example).
- the month on 2 digits, use the "%%MONTH%%" character string (03 for example).
- the day, use the "%%DAY%%" character string.
- the hour, use the "%%HOUR%%" character string.
- the minutes, use the "%%MINUTE%%" character string.
<Backup of indexes>: Optional boolean - True (default value) to back up the indexes,
- False not to back them up. Not saving the indexes reduces the size of the backups. However, rebuilding the indexes will increase the restore time.
<Description>: Optional character string Description of the backup. <Progress Bar>: Optional control name Name of the Progress Bar control in the window. This control is used to view the progress of the initialization step of the backup (and not the progress of the backup). This option is available in WINDEV only. Remarks Rights required to perform a backup To perform a backup, the user or the group must have the rights to perform backups (hRightsBackup constant). These rights apply to the servers and to the databases. Characteristics of the backup The backup performed will correspond to the status of the database at the beginning of backup. During the backup, you are not allowed to: - delete files and databases,
- update the stored procedures.
Backup performed from the HFSQL Control Center A backup can be performed from the HFSQL Control Center. This backup is available in the "Backups" tab of the server description ("New backup" button). Scheduled backups You have the ability to schedule the backups performed on the server: - via the scheduled tasks managed by WLanguage (HAddTask).
- via the HFSQL Control Center ("Scheduled Tasks" tab of the server description).
Related Examples:
|
Training (WINDEV): WD Duplication
[ + ] This educational example explains how to duplicate a database on a server. The duplication is performed by programming and it allows you to give a new name to the database. The example is based on the functions for saving and restoring a HFSQL backup.
|
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|