[KB7978] Create a backup of the ESET PROTECT On-Prem database

Issue

Required user permissions

This article assumes that you have the appropriate access rights and permissions to perform the tasks below.

If you use the default Administrator user or are unable to perform the tasks below (the option is unavailable), create a second administrator user with all access rights.

Solution

Use the backup later during migration

The backup can also be used later when migrating ESET PROTECT On-Prem to a new server.

Illustrated examples are with default settings

The following examples are intended for use with default settings (for example, default database name and database connection settings). Customize your backup script to accommodate any changes you make to default settings.

Create and restore MS SQL database backup

To back up and restore an MS SQL database to a file, follow the examples shown below:

One-time database backup

Open a Windows command prompt and type the following command to create a backup file named BACKUPFILE:

SQLCMD -S HOST\ERASQL -Q "BACKUP DATABASE ERA_DB TO DISK = N'BACKUPFILE'"

HOST - IP address or hostname
ERASQL - name of the MS SQL server instance

Regular database backup with SQL script

Choose one of the following SQL scripts:

  • Create regular backups and store them based on the date of creation:

    1. @ECHO OFF

    2. SQLCMD.EXE -S HOST\ERASQL -d ERA_DB -E -Q "BACKUP DATABASE ERA_DB TO DISK = N'BACKUPFILE' WITH NOFORMAT, INIT, NAME = N'ERA_DB', SKIP, NOREWIND, NOUNLOAD, STOP_ON_ERROR, CHECKSUM, STATS=10"

    3. REN BACKUPFILE BACKUPFILE-[%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%_T%TIME:~0,2%%TIME:~3,2%].bac
  • Append your backup to a file:

    1. @ECHO OFF

    2. SQLCMD.EXE -S HOST\ERASQL -d ERA_DB -E -Q "BACKUP DATABASE ERA_DB TO DISK = N'BACKUPFILE' WITH NOFORMAT, NOINIT, NAME = N'ERA_DB', SKIP, NOREWIND, NOUNLOAD, STOP_ON_ERROR, CHECKSUM, STATS=10"

For more information on Microsoft SQL Server backup, see the Microsoft Documentation article.

Restore MS SQL backup

Execute one of the following commands according to your situation:

  • To restore an MS SQL database from a file on an environment with an existing ERA_DB database, execute this command:

SQLCMD.EXE -S HOST\ERASQL -d ERA_DB -E -Q "RESTORE DATABASE ERA_DB FROM DISK = N'C:\USERS\ADMINISTRATOR\DESKTOP\BACKUPFILE'"

  • To restore an MS SQL database from a file on an environment without an existing ERA_DB database, execute this command:

SQLCMD.EXE -S HOST\ERASQL -E -Q "RESTORE DATABASE ERA_DB FROM DISK = N'C:\USERS\ADMINISTRATOR\DESKTOP\BACKUPFILE'"


Create and restore MySQL database backup

MySQL backup

To create a backup of a MySQL database to a file, follow the examples shown below:

mysqldump --host HOST --disable-keys --extended-insert --routines -u ROOTLOGIN -p ERADBNAME > BACKUPFILE

HOST - IP address or hostname of MySQL server
ROOTLOGIN - Root MySQL server account
ERADBNAME - ESET PROTECT On-Prem database name

For more information on MySQL Server backup visit the MySQL documentation website.

MySQL restore

To restore a MySQL database from a file, execute this command:

mysql --host HOST -u ROOTLOGIN -p ERADBNAME < BACKUPFILE

Asistencia adicional