tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

NBackup support in FirebirdClient

5 Sep 2013 1 mins .NET, Firebird

Today I had a little of spare time and I had in my head support for NBackup via Services API in FirebirdClient for a long time. Especially since NBackup saved me on Azure Websites.I was guessing it should not take that long to implement it, if you’re in a good mood. Surprisingly I was right with my estimate.

So let me introduce to you two new classes you will be able to use in next version. It’s FbNBackup and FbNRestore (I’m still validating the naming in my head). You have all the switches and option from command line available (“no database triggers”, “direct IO”, …).

To create a level 0 backup you can just call:

var nbak = new FbNBackup();
nbak.ConnectionString = "..."
nbak.Level = 0;
nbak.BackupFile = "database.fnbk0"
nbak.DirectIO = true;
nbak.Options = FbNBackupFlags.NoDatabaseTriggers;

Changing to nbak.Level = 1; you’ll create another level and so on.

Restoring is even simpler. You just need your chain of backups and call:

var nrest = new FbNRestore();
nrest.ConnectionString = "..."
nrest.BackupFiles = new[] { "database.fnbk0", "database.fnbk1" };
nrest.DirectIO = true;

It’s pretty much same API as with regular FbBackup and FbRestore, just with incremental-ish backup flavor. What else you’d like to see in foreseeable future in FirebirdClient?

Profile Picture Jiří Činčura is .NET, C# and Firebird expert. He focuses on data and business layers, language constructs, parallelism, databases and performance. For almost two decades he contributes to open-source, i.e. FirebirdClient. He works as a senior software engineer for Microsoft. Frequent speaker and blogger at