Skip to main content

Backing up Microsoft SQL Server databases

With the SQL Server add-on, GBM AI Server has SQL Server back up its own databases, full, differential or log, warns before a log can fill the disk, and brings a database back to any moment its backups reach.

Updated
On this page

A database job on GBM AI Server with the SQL Server add-on backs up the databases of a Microsoft SQL Server on the same server, SQL Server Express included. On each run, SQL Server itself backs up each database: a full, a differential or a log backup. GBM AI then stores those files like any other: compressed, encrypted if the job is, checked, kept by its retention and copied to its second place. A database comes back to its newest moment, or to any moment its backups reach, to the second.

Before you start#

  • The edition: SQL Server databases need GBM AI Server with the SQL Server add-on, one purchase for the server. The Server trial includes it. MySQL and MariaDB have an add-on of their own. On a Server licence without it, Buy the add-on under Databases opens the store for this licence. Once paid, the add-on switches on by itself, usually within a minute; Account ▸ Check licence now asks at once.
  • GBM AI on the database's server. GBM AI backs up the SQL Server instances of the PC it runs on, whichever protocols they use: SQL Server Express comes with network access switched off, and that is fine.
  • The right to back up. GBM AI's backup service signs in to SQL Server as itself, NT AUTHORITY\SYSTEM. SQL Server's setup does not make it an administrator, so it first needs the right to back up your databases. The wizard gives it that right in one click (see below), never sysadmin.
  • Files and databases are two jobs. A job backs up files and folders, or databases. To back up both, make one job of each.

Step 1: Make a database job#

  1. Click New backup. On the Job step, under What does this job back up?, choose Databases and give the job a name. (On a new server, the welcome screen's Databases card does the same.)
  2. Where: choose where the backups go, as for any job.
  3. What: choose SQL Server.
  4. Instance: the instances of this server are listed. When the default instance is not installed, GBM AI picks the one that is, for example SQLEXPRESS.
  5. Sign in: As the backup service (the usual choice: nothing to type), or With a SQL login and its password. The password is stored encrypted on this PC and kept for that instance and login only.
  6. GBM AI signs in and lists the instance's databases, each with its recovery model (Full, Bulk-logged or Simple) and size.
  7. Which databases: Every database, new ones too, or Only these and tick them. SQL Server's system databases (master, model, msdb, tempdb) and its logins are not included: after a server is lost, recreate the logins before your applications sign in.

Wizard step 3 - SQL ServerWizard step 3 - SQL Server

Give GBM AI the right to back up#

When the backup service may not back up some databases yet, the panel names them and offers Give GBM AI the right to back up:

  • Click it while signed in to Windows as the person who installed SQL Server. That account is an administrator of SQL Server, and GBM AI uses it once to give the backup service db_backupoperator in the job's databases: the right to back them up, nothing more.
  • Also let it restore databases (ticked) also gives the server role dbcreator, which GBM AI needs to restore a database. That role can also create and drop any database; untick it if you restore with another account.
  • Or choose Use a SQL login instead and sign in as an administrator of SQL Server, such as sa. The password is used once and never kept.
  • If neither of you is an administrator of SQL Server, GBM AI shows the script that gives these rights, with Copy the script. Hand it to whoever looks after SQL Server, then sign in again.

If you save the job while some databases still lack the right, GBM AI asks first: until the right is given, every run reports them as not backed up and alerts you.

Step 2: The type and the schedule#

On Settings, the type decides what each run takes, and brings its schedule:

TypeEach runThe schedule it starts on
Incremental (recommended)A log backup of each Full-model database; one differential a day of each Simple-model databaseA full every Sunday at 01:00 and a log backup every 15 minutes
DifferentialA differential since the last fullA full every Sunday at 01:00 and a differential every day at 01:00
FullA full backup of each databaseA full every day at 01:00
  • A log backup saves every change since the one before, so the database can be brought back to any moment, to the second. That needs the Full recovery model.
  • A database in the Simple model has no log: it comes back to the moment of one of its backups. A differential holds everything since the full and grows all week, so the 15-minute runs take one a day, at the time of the first; the other runs leave it alone.
  • Full-model databases need log backups. Their log file grows until it is backed up, and a full disk stops the database. With the Full or Differential type, or a manual schedule, the Settings and Schedule steps name those databases and offer Use Incremental. Or switch them to the Simple recovery model in SQL Server.
  • On the Schedule step, an Incremental or Differential job has two rules, Full backups and Log backups (or Differential backups). A Full job has one, Full backups. A line under the modes says what the job will take, and Next runs marks the fulls.
  • A database job runs on a clock, not at sign-in, and runs on battery too. Don't start between stops log backups during those hours as well, and the step says so.
  • Retention: Restore to any moment in the last 35 days (or the days you choose). The line below says about how many fulls that keeps and how much room they take before compression, from the databases' sizes.
  • Staging folder: each run makes every database's backup in this folder first, then stores it and empties the folder. It is GBM AI's own folder on the system drive unless you choose another. Choose a data drive with room for the biggest full: the system drive also holds SQL Server and Windows. Before each database, GBM AI checks the room left; a database whose backup would not fit is not backed up, and the run says so, rather than filling the drive.

What a run does#

  • SQL Server checks each page as it backs it up (CHECKSUM): a damaged page fails the backup rather than going into it.
  • Beside each backup file GBM AI keeps a small description: when it was made and where it sits in the chain. A restore is planned from those, so it works on another server too, after a disaster.
  • The run's report has a Databases list: each database with the backup taken and its size, None due for one that rested (a Simple-model database's differential of the day was taken), or Not backed up and why.

When something else backs up the same database#

  • Another backup program or a maintenance plan that takes the database's log backups, or full backups again and again: GBM AI takes a copy-only full of it on the job's full runs, so the other program's chain stays whole, and leaves it alone on the other runs. The report says so.
  • One backup someone takes by hand (before an upgrade, from SSMS) changes nothing: GBM AI's log backups go on. If it moved the base of the differentials, GBM AI takes a full in the same run.
  • A database restored since its last backup, by GBM AI or anyone: the next backup is a full, which starts its chain again.

When a database is not backed up#

A database the run could not back up (no right, a database the job names that is gone, no room in the staging folder, an error from SQL Server) is a failure for the job's alerts: the notification and the e-mail say "1 of 3 databases was not backed up" and name it. The other databases are backed up all the same. The same databases missed again are told once a day.

GBM AI also watches the job between runs, even when the trial has paused or the job is switched off:

  • Log backups of a Full-model database have stopped: none for an hour (or three of the job's log intervals). Its log is growing.
  • No full backup for 8 days. Every restore replays everything since the last full.

Each is told once a day: in the window, as a Windows notification when it is closed (When a backup fails), and by e-mail when e-mail is on.

Restoring a database#

  1. On Restore, open a point of the job. The Databases card lists its SQL Server databases, with how far back each can go from this point.
  2. Click Into the server… beside the one you want.
  3. Choose where it goes:
    • As a new database (the default): give it a name the instance does not have yet. The database already there is not touched.
    • Over the database it was made of. Its users are disconnected first. SQL Server saves it as it is now (a copy-only backup that GBM AI keeps for 7 days in databases\before-restore), the database goes offline, and the restore replaces it. If the restore fails, it puts that copy back and the database comes online again. Type the database's name to confirm.
      • A damaged database. SQL Server cannot save a database that is damaged, offline or suspect, and then the restore changes nothing. Tick Restore over it even if it can't be saved first and the restore goes ahead without that copy. Without the copy there is nothing to put back if the restore fails: the database stays as the restore left it, and you restore again.
  4. Bring it back to: Newest, or A moment: any time along the log backups after the point's newest full or differential, to the second, or the moment of one of its backups. For a moment further back, open the point made soon after it.
  5. GBM AI restores as the backup service. Use a SQL login if you prefer another account that may create databases.
  6. The dialog says about how much room the restore needs on this PC: the backups come back here first, and only those its plan needs.

Restore - a SQL Server database to a momentRestore - a SQL Server database to a moment

The report says which database it went into and the moment it was brought back to; over a database, it also says where the copy of the one it replaced is kept.

To get the backup files themselves (.bak, .trn), restore them from the point's files to another folder. In their own place, the job's staging folder, the next run would empty them.

Windows Server Core and scripts#

text
gbm db check --sqlserver --instance SQLEXPRESS
gbm db grant --instance SQLEXPRESS
gbm job import shop-sql.json
gbm job run "Shop SQL"
gbm restore --set latest --job "Shop SQL" --databases
gbm restore --set latest --job "Shop SQL" --database shop --as shop_then --at "2026-10-24 14:30:15"
gbm restore --set latest --job "Shop SQL" --database shop --over
gbm restore --set latest --job "Shop SQL" --database shop --over --even-if-damaged
  • gbm db check --sqlserver signs in as the job would and lists the databases, their recovery model and those the service may not back up yet (it fails while there are some).
  • gbm db grant gives that right. Run it as the Windows account that administers SQL Server, or add --admin-user sa --password-stdin.
  • gbm job run --json prints the run's record, with its databases: each database's backup, rested or missed and why.
  • gbm restore --databases lists the databases a point holds and how far back each goes from it. Add --json for a script.
  • --at takes this PC's time (2026-10-24 14:30:15) or an RFC 3339 time; without it, the newest moment.
  • --even-if-damaged, with --over: when SQL Server cannot save the database as it is now (damaged, offline or suspect), the restore goes ahead without that copy instead of changing nothing.

In the job file the databases look like this:

json
"databases": { "kind": "sqlserver", "host": "SQLEXPRESS", "user": "", "names": ["shop", "crm"], "staging": "D:\\GBM staging" }

host is the instance (empty for the default one); an empty user signs in as the backup service. Leave names out to back up every database, new ones too, and staging out to use GBM AI's own folder.

Troubleshooting#

CodeWhat happenedWhat to do
E-SQL-001SQL Server refused GBM AI's sign-in, or did not answerCheck that the instance is running (its SQL Server service), and the SQL login and password in the job
E-SQL-002GBM AI may not back up a databaseOpen the job (What) and choose Give GBM AI the right to back up, or ask an administrator of SQL Server to add the backup service to db_backupoperator in that database
E-SQL-003A database the job names is not on the instanceIt was renamed or dropped: open the job and choose its databases again. The others are backed up meanwhile
E-SQL-004SQL Server could not back up a database, or its backup would not fit in the staging folder, or the database is not online (suspect, offline, recovery pending)The report names the database and why. Free room, or choose another staging folder in the job's settings. A damaged page fails the backup's check: run DBCC CHECKDB on the database. A database that is not online is backed up again once SQL Server brings it online; its backups up to then are kept
E-SQL-005A database could not be restoredThe report says what SQL Server said. Over a database, it is back as it was. A new database needs a name not on the instance yet; a moment must lie within the point's span
E-LIC-011 on a database job's runsThe job was made in the Server trial and the Server licence has no SQL Server add-onAdd the SQL Server add-on in Editions & store. Restoring the job's backups keeps working without it

Was this article helpful?