Firebird ADO.NET Provider SDK Documentation - v1.7

FbRestore Class

Restore a database from backup files. This class cannot be inherited.

For a list of all members of this type, see FbRestore Members.

System.Object
   FirebirdSql.Data.Firebird.Services.FbService
      FirebirdSql.Data.Firebird.Services.FbRestore

[Visual Basic]
NotInheritable Public Class FbRestore
    Inherits FbService
[C#]
public sealed class FbRestore : FbService

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The username and password used to connect to the services manager will be used to connect to the database for restore. This helps add some degree of security for this operation.

Only the SYSDBA or owner of a database may use Replace to overwrite an existing database.

Example

The following example makes a restore of a database from a single backup file and display server output on Console.

[STAThread]
static void Main(string[] args)
{
    FbConnectionStringBuilder cs = new FbConnectionStringBuilder();

    cs.UserID   = "SYSDBA";
    cs.Password = "masterkey";
    cs.Database = "nunit_testdb";

    FbRestore restoreSvc = new FbRestore();

    restoreSvc.ConnectionString = cs.ToString();
    restoreSvc.BackupFiles.Add(new FbBackupFile(@"c:\testdb.gbk", 2048));
    restoreSvc.Verbose = true;
    restoreSvc.PageSize = 4096;
    restoreSvc.Options = FbRestoreFlags.Create | FbRestoreFlags.Replace;

    restoreSvc.ServiceOutput += new ServiceOutputEventHandler(ServiceOutput);

    restoreSvc.Execute();
}

static void ServiceOutput(object sender, ServiceOutputEventArgs e)
{
    Console.WriteLine(e.Message);
}
                

Requirements

Namespace: FirebirdSql.Data.Firebird.Services

Assembly: FirebirdSql.Data.Firebird (in FirebirdSql.Data.Firebird.dll)

See Also

FbRestore Members | FirebirdSql.Data.Firebird.Services Namespace