Using backupdb.bat and restoredb.bat: How to back up and restore the Sophos databases

  • Article ID: 110380
  • Rating:
  • 6 customers rated this article 3.2 out of 6
  • Updated: 03 Jun 2013

We strongly recommend that you make a backup of the Sophos database before making any alterations to it.  

Note: For reference, article 17323 lists the database names associated with the version of the console.

To backup your database you can use the script BackupDB.bat and to restore a backup you can use the RestoreDB.bat script.

Known to apply to the following Sophos product and version 


Sophos Enterprise Manager 4.7.0
Sophos Control Center
Enterprise Console 5.2.0
Enterprise Console 5.1.0
Enterprise Console 5.0.0
Enterprise Console 4.7.0
Enterprise Console 4.5.0
Enterprise Console 4.0.0

What to do

  1. On the Sophos Management server, stop the following services (Start | run | services.msc) if they exist:
    • Sophos Management Service
    • Sophos Encryption Business Logic Service
    • Sophos Patch Endpoint Communicator Service
  2. On the computer hosting the Sophos databases, open a command prompt (Start | run | cmd.exe).
  3. Change directory to the following location using the 'CD' command:

    For Sophos Enterprise Console 4.x/Enterprise Manager 4.x:
    Sophos Enterprise Console: \%programfiles%\Sophos\Enterprise Console\DB\
    Sophos Enterprise Manager: \%programfiles%\Sophos\Enterprise Manager\DB\

    For Sophos Control Center (SCC)
    \%programfiles%\Sophos\SCC\DB\

    For Sophos Enterprise Console 5.x:
    Sophos Enterprise Console: \%programfiles%\Sophos\Enterprise Console\DB\Core\

    Note: If you have run the Enterprise Console installers previously, the batch files can also be found in the following location, providing the default location was not changed: "C:\sec_[Version]\ServerInstaller\DB\".

  4. Run:
    backupdb.bat /?
    ...to show the usage options.
  5. Run backupdb.bat with the required parameters. See the example below for more information.

If you do not know the name of the instance in which the Sophos database is installed, follow the instructions in How to check which SQL instance your Enterprise Console database is installed in to find out.

Restore the Sophos database

  1. On the computer hosting the Sophos databases, open a command prompt (Start | run | cmd.exe).
  2. Change directory to the following location using the 'CD' command:
    For Sophos Enterprise Console 4.x/Enterprise Manager 4.x:
    Sophos Enterprise Console: \%programfiles%\Sophos\Enterprise Console\DB\
    Sophos Enterprise Manager: \%programfiles%\Sophos\Enterprise Manager\DB\

    For Sophos Control Center (SCC)
    \%programfiles%\Sophos\SCC\DB\

    For Sophos Enterprise Console 5.x:
    Sophos Enterprise Console: \%programfiles%\Sophos\Enterprise Console\DB\Core\

    Note: If you have run the Enterprise Console installers previously, the batch files can also be found in the following location, providing the default location was not changed: "C:\sec_[Version]\ServerInstaller\DB\".

  3. Run:
    restoredb.bat /?
    ...to show the usage options.
  4. Run restoredb.bat with the required parameters. See the example below for more information.

Examples

backupdb.bat /?
displays usage options

backupdb.bat C:\Windows\temp\sophos50db.bak .\sophos SOPHOS50
backs up a SOPHOS50 database on the local SQL server (housed in a SQL instance called 'sophos') to the file C:\Windows\temp\sophos50db.bak

backupdb.bat C:\Windows\temp\sophos4db.bak .\sophos SOPHOS4
backs up a SOPHOS4database (e.g. for Sophos Control Center) on the local SQL server (housed in a SQL instance called 'sophos') to the file C:\Windows\temp\sophos4db.bak

restoredb.bat /?
displays usage options

restoredb.bat C:\Windows\temp\sophos50db.bak .\sophos SOPHOS50
restores a SOPHOS50 database to local SQL server to the SQL instance called 'sophos' from the file C:\Windows\temp\sophos50db.bak

Technical Information

  1. If the backup file specified (i.e. C:\Windows\temp\sophos50db.bak) already exists BackupDB.bat will append to it, rather than overwrite it. This can cause the backup file to grow to an unexpected size. To avoid this issue use the current date and/ or time in the backup file's name to ensure a new file is always created alongside any existing backup files. Example: 'C:\Windows\temp\sophos50db2010_Oct_25_0930am.bak'.
  2. If you attempt to backup the database to a location the SQL server does not have permissions to write to, you may receive an error. Therefore use a path to a temporary location.
  3. RestoreDB.bat may only work if a database of the same name was previously attached to the SQL instance and has not been dropped.

 
If you need more information or guidance, then please contact technical support.

Rate this article

Very poor Excellent

Comments