- Rights required to restore a backup
- Restore operation performed from the HFSQL Control Center
<Connection variable>.RestoreBackup (Function) In french: <Variable Connexion>.RestaureSauvegarde
Not available
Available only with this kind of connection
Used to restore: The restored backup can be a full backup or a differential backup.Caution: restoring a backup must be done with great care. To perform this operation, you must have the rights to perform a backup (hRightsBackup) as well as the rights to lock the database (hRightsLock). To restore the entire server (or the __jnl and __trs databases), no other application must be connected to the server. The connection used must not be attached to a database (during the call to <Connection variable>.OpenConnection, the <Database> parameter must correspond to an empty string ("")). To restore the databases, no connection must be established on the database to restore. Duplicating a database: A special syntax of <Connection variable>.RestoreBackup (syntax 2) is used to restore the backup of a database under a different name. This allows you to perform a copy of a database by renaming it. For example: to perform a copy of the MyDatabase2008 database by renaming it into MyDatabase2009, all you have to do is perform a backup of MyDatabase2008 and restore it under the MyDatabase2009 name.
ctServer is Connection // Restore a backup IF ctServer.RestoreBackup(BackupID) = False THEN Error("Failure restoring the backup" + HErrorInfo(hErrMessage)) END
ctServer is Connection // Restore a full and differential backup BackupInfo = ctServer.InfoBackup(BackupID) BackupPath_Diff = ExtractString(BackupInfo, 4, TAB) BackupInfo = ctServer.InfoBackup(nBackupID_Full) BackupPath_Comp = ExtractString(BackupInfo, 4, TAB) IF ctServer.RestoreBackup(BackupPath_Comp, BackupPath_Diff) = False THEN Error("Failure restoring the backup" + HErrorInfo(hErrMessage)) END
Syntax
Restoring a backup from its identifier or from its path Hide the details
<Result> = <Connection>.RestoreBackup(<Backup> [, <Progress Bar>])
<Result>: Boolean - True if the backup was restored,
- False otherwise. HError is used to identify the error.
<Connection>: Connection variable Name of the Connection variable that describes the connection to the server on which the backup will be restored. <Backup>: Integer or character string Can correspond to:- Backup identifier. This identifier can correspond to the identifier of full backup or to the identifier of differential backup.
During an immediate backup, this identifier is returned by <Connection variable>.Backup. This identifier can also be returned by <Connection variable>.InfoBackup. In a scheduled backup, this identifier corresponds to the Identifier property of the hBackupDescription variable. - Path and name of backup to restore. This name was specified during the backup. This name can also be returned by <Connection variable>.InfoBackup. If this name corresponds to a relative path, the backup will be sought in the "Backup" subdirectory of HFSQL server. To specify the directory of Manta service, simply use "%%EXE%%".
<Progress Bar>: Optional window name, optional control name or optional integer - Name of the window where the progress bar will be displayed or name of the Progress Bar control.
- Handle of the window that displays the progress bar.
Restoring a backup under a different database name Hide the details
<Result> = <Connection>.RestoreBackup(<Backup> , <Source database> , <Destination database> [, <Progress Bar>])
<Result>: Boolean - True if the backup was restored,
- False otherwise. HError is used to identify the error.
<Connection>: Connection variable Name of the Connection variable that describes the connection to the server on which the backup will be restored. <Backup>: Integer or character string Can correspond to:- Backup identifier, returned by <Connection variable>.Backup. This identifier can also be returned by <Connection variable>.InfoBackup.
- Path and name of backup to restore. This name was specified during the backup. This name can also be returned by <Connection variable>.InfoBackup. If this name corresponds to a relative path, the backup will be sought in the "Backup" subdirectory of HFSQL server. To specify the directory of Manta service, simply use "%%EXE%%".
<Source database>: Character string Name of database to restore found in the backup. This syntax allows you to restore a single database found in the backup. <Destination database>: Character string Name of database that will be restored. This name may be different from the source database. In this case, the function allows you to make a copy of the database and rename it. <Progress Bar>: Optional window name, optional control name or optional integer - Name of the window where the progress bar will be displayed or name of the Progress Bar control.
- Handle of the window that displays the progress bar.
Restoring a differential backup found in a specific directory (available from version 15) Hide the details
<Result> = <Connection>.RestoreBackup(<Full backup> , <Differential backup> [, <Progress Bar>])
<Result>: Boolean - True if the backup was restored,
- False otherwise. HError is used to identify the error.
<Connection>: Connection variable Name of the Connection variable that describes the connection to the server on which the backup will be restored. <Full backup>: Character string Path and name of the full backup to restore. This name was specified during the backup. This name can also be returned by <Connection variable>.InfoBackup. If this name corresponds to a relative path, the backup will be sought in the "Backup" subdirectory of HFSQL server. To specify the directory of Manta service, simply use "%%EXE%%". <Differential backup>: Character string Path and name of the differential backup that must be applied to the full backup. This name was specified during the backup. This name can also be returned by <Connection variable>.InfoBackup. If this name corresponds to a relative path, the backup will be sought in the "Backup" subdirectory of HFSQL server. To specify the directory of Manta service, simply use "%%EXE%%". <Progress Bar>: Optional window name, optional control name or optional integer - Name of the window where the progress bar will be displayed or name of the Progress Bar control.
- Handle of the window that displays the progress bar.
Remarks Rights required to restore a backup To restore 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.
- the rights to lock the database (hRightsLock constant). These rights apply to the databases.
Restore operation performed from the HFSQL Control Center A backup can be restored from the HFSQL Control Center. This backup is available in the "Backups" tab of the server description.
This page is also available for…
|
|
|
|