# Microsoft SQL database backup

#### In Xopero ONE, you can back up a variety of databases, including Oracle, MySQL, PostgreSQL, and Microsoft SQL.

***

## General information

The **Microsoft SQL** database backup process in **Xopero ONE** consists of two steps:

1. Creating a database dump using backup scripts.
2. Backing up the database dump.

The first step is performed through **Xopero ONE** using the **backup scripts** feature. The second step is a standard **file-level** or **image-level** backup executed directly by **Xopero ONE**.

***

## Backup configuration

{% hint style="info" %}
If a file-level backup plan has already been created and is running, you can skip directly to **step 6**.
{% endhint %}

{% stepper %}
{% step %}
Log in to [**XMS**](#user-content-fn-1)[^1], go to the **Backup** tab (**Plans** > **Backup**) and click the **+ Add plan** button in the top toolbar.

<figure><img src="/files/4vnONYo4CncYWJyACJ9Z" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Select **Devices** from the platforms list.

<figure><img src="/files/yVkZcxR0fqG19URiCqnW" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
In the next aside, select **one of the available** options and choose one or more devices for the plan to apply to (you can also select the plan to include all activated devices).

<figure><img src="/files/Tq72SHtO1SUJpUTacYBE" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Define the name of the backup plan.
{% endstep %}

{% step %}
Configure your backup plan according to your needs (more information about the backup plan setup can be found in [File-level backup](/xopero-one-en/backup-and-recovery/workstations-and-servers/file-level-backup.md) and [Image-level backup](/xopero-one-en/backup-and-recovery/workstations-and-servers/image-level-backup.md) articles).
{% endstep %}

{% step %}
Go to the **Advanced settings** section and click **Edit** to customize additional options.

<figure><img src="/files/MH4lFcHW2rABhPcc2YwI" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Scroll down to the **Backup scripts** section and click the **Pre-task script** toggle to turn it on.

<figure><img src="/files/wTJul7KL3MX6GnyRTHwM" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Select the script dedicated to backing up the **Microsoft SQL** database environment (**Windows**).

<figure><img src="/files/n4BLLNycpH3O3DP7jgWa" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Type your database **username** into the **Database user** field.

{% hint style="warning" %}
It is strongly recommended to create a dedicated user specifically for database backup operations.
{% endhint %}

<figure><img src="/files/4GgbokupHRqTT2f0CrKw" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Choose the user password by opening the **Password Manager**, where you can either add a new password or select an existing one.

{% hint style="danger" %}
The user entered in the **Database user** field must use **SQL Server** authentication.
{% endhint %}

<figure><img src="/files/dyFXVhHIYcawS2QmOsaO" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Set up the script arguments — it should be entered in the **Script arguments** field as follows:

{% code overflow="wrap" %}

```
copy_type server_name "output_dir" database1 database2 ... databaseN
```

{% endcode %}

1. `copy_type` — defines the type of copy to be performed. You can choose one of three options: `full_only`, `full_diff`, or `copy_only`:
   1. `full_only` — always performs a full copy.
   2. `full_diff` — performs differential copies with periodic full copies.
   3. `copy_only` — creates a full database copy without affecting the regular backup cycle.

{% hint style="danger" %}
If your operating system runs other backup software or schedulers that perform additional database dumps, use `full_only` dumps. Using other types (`full_diff` or `copy_only`) may cause issues when other processes on the system also create database dumps.
{% endhint %}

{% hint style="info" %}
**Full copies** are executed according to the defined schedule. **Differential copies** are performed whenever **differential** or **incremental** backups are scheduled. If a file containing a **differential copy** is deleted, the next **differential copy** will be created based on the most recent **full copy**.
{% endhint %}

2. `server_name` — the name of the **Microsoft SQL** server along with its instance.
3. `output_dir` — the directory where database dumps will be saved. This directory must also be selected as the location to back up.
4. `database1` `database2` (...) — names of databases to be backed up, separated by spaces. You can leave this parameter empty — if no database is specified, **Xopero ONE** will automatically back up all databases from the server specified in the database access parameters.

{% code title="Example database script arguments" overflow="wrap" %}

```
full_diff WINSRV-2019\SQLEXPRESS "C:\MsSQLDumps" database1 database2
```

{% endcode %}
{% endstep %}

{% step %}
You can enable the two additional options using the checkboxes:

1. **Wait for the script to continue the task** — the application will wait until the dump is ready.
2. **Fail the task if the script fails** — if the script fails, the system will notify you of the backup error.

<figure><img src="/files/SUjRkBxzsLWWkrf1w2Tn" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Double-check your settings and click **Save** to close the **Advanced settings** aside.
{% endstep %}

{% step %}
After completing the configuration, click the **Save** button. The protection plan will then automatically begin protecting your devices and databases according to the schedule you defined.

{% hint style="success" %}
You can also click **Save\&Run** button to immediately start the backup process, regardless of schedule.
{% endhint %}
{% endstep %}

{% step %}
That’s all you need to do to create the database dump — this file should now be included in the **Data to protect** section if you are performing a **file-level backup** (to back up only the database). Alternatively, you can run an **image-level backup** to protect the entire drive.
{% endstep %}
{% endstepper %}

[^1]: Xopero ONE Management Service


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpcenter.xopero.com/xopero-one-en/backup-and-recovery/workstations-and-servers/database-backup/microsoft-sql-database-backup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
