How to Move the Sophos Database to a Different Drive on the Same Computer

  • Article ID: 114108
  • Rating:
  • 2 customers rated this article 4.0 out of 6
  • Updated: 15 Mar 2013

By default the Sophos database will restore to the C drive on the server, this cannot be changed during installation. In order to change the drive that the database files are located it is necessary to backup the database, drop it, then restore to the new location. This article will guide you through each of these required steps and should be used when a specific storage location is needed for the database other than the default set by Microsoft SQL Server.

This article does not apply if you want to move the database to another computer, this is covered in the following articles:

  • Default installation: 28276
  • Distributed installation: 22468

Known to apply to the following Sophos product(s) and version(s)

Sophos Control Center
Enterprise Console

What To Do

Before proceeding you will need to have installed SQL Server Management Studio Express and have Sophos Enterprise Console closed to avoid database connection errors during the steps.

1. Backup the database

This will create a backup (.bak file) which we will restore in the desired location in step 3. Refer to Sophos article 17323 to obtain a list of database names based on the installed version, make a note of these as they will be required at various stages in the article.

  1. On the Sophos Management server open a command prompt (Start | Run | cmd.exe)
  2. Browse to the following location:
    • Sophos Enterprise Console: \%programfiles%\Sophos\Enterprise Console\DB\Core\
    • Sophos Enterprise Manager: \%programfiles%\Sophos\Enterprise Manager\DB\
  3. Run: 'BackupDB.bat /?'to show the usage options, for further information see Sophos article 110380
  4. Run BackupDB.bat with the required parameters to create your database backup. If performing these steps for Enterprise Console 5 and above you will need to repeat the steps for the additional databases.

2. Drop the database

This will delete the database and any connections to the database, it would be advisable to do this out of hours to avoid any possible disruption. The below assumes you are using the default SQL instance named Sophos, please amend .\SOPHOS if you are using a different named instance

  1. Refer to Sophos article 17323 to get the database name for your install.
  2. On the Sophos Management server open a command prompt (Start | run | cmd.exe).
  3. Run the below command replacing SOPHOSXXwith the name of the database to drop obtained from step 1:
    sqlcmd -E -S .\SOPHOS -Q "DROP DATABASE SOPHOSXX"

If performing these steps for Enterprise Console 5 and above you will need to repeat the above steps for the additional databases.

3. Restoring the database

  1. Create the folder where you want the database files to be stored. You will need to ensure that the 'SYSTEM' account has full control of this folder and may also require 'NETWORK SERVICE' to be included with full control.
  2. Open SQL Management Studio (Start | All Programs | Microsoft SQL Server 2005/2008 | SQL Server Management Studio)
  3. On the left hand view, right click Databases and select 'Restore Database'.
  4. Under the 'Destination for Restore' section, enter the database name as obtained in Section 2 step 1 above (e.g. SOPHOS52)
  5. The restore is being performed using a backup so select 'From device'.
  6. Click the '…' button.
  7. Navigate to the .bak file created in Section 1 and double click. 
  8. Check the 'Restore' box to select this backup set to restore.
  9. To change the physical path of the database files click the 'Options' button at the top left.
  10. In the column named 'Restore As', modify each file to reflect the new folder path for the files (as specified in step 3.1), by default these will be:
    • Rows Data: C:\Program Files\Microsoft SQL Server\MSSQL10.SOPHOS\MSSQL\DATA\databasename.mdf 
    • Log: C:\Program Files\Microsoft SQL Server\MSSQL10.SOPHOS\MSSQL\DATA\databasename_1.ldf
  11. Check overwrite existing database to ensure that any legacy files are overwritten.
  12. Click OK to perform the restore.
  13. Once complete, the database has now been moved to the designated drive/folder.
  14. If performing these steps for Enterprise Console 5 and above you will need to repeat the above steps for the additional databases.
  15. Restart the Sophos Management Service on the management server before attempting to open the Sophos Enterprise Console. 

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

Rate this article

Very poor Excellent

Comments