Automate Milestone XProtect Updates: SQL Query for Backing Up and Verifying Milestone Databases

Streamline your Milestone XProtect upgrades by using a SQL script to automate the backup and verification of your databases, ensuring data security and efficiency.
Table of Contents

Let’s be honest—upgrading Milestone XProtect can be an exercise in tediousness. While essential, the repetitive nature of these tasks can drive even the most patient admin up the wall. That’s why I turned to automation to save time and sanity. This is the third installment in my series aimed at streamlining Milestone XProtect upgrades by automating those mind-numbing tasks.

The script included in this blog focuses on backing up and verifying databases, a crucial step before any upgrade or hotfix installation. 

This process, although vital, can be incredibly repetitive. To make life easier, I created a SQL script that automates the backup and verification of all Milestone and Boring databases to the C:\Temp folder.

👉 PS. I am not responsible for any mishaps that may happen with your update. Do your own research, testing, and critical thinking. I am merely a human with a passion for security solutions that wants to share my knowledge and experience with you in hopes it helps make your job a little less boring.

Why Database Backups Matter

Before diving into the script, let’s touch on why database backups are so important. Backing up your databases ensures that you have a recovery point in case something goes wrong during an upgrade or hotfix installation. Verification of these backups ensures their integrity, giving you peace of mind that your data is safe and sound.

SQL Query to Back Up and Verify Your Surveillance Databases

This script backs up each of your Milestone and Boring databases and verifies the backups to ensure they are reliable. Here’s a little more detail on what exactly the script does:

  • Backs Up Databases: Creates a backup of each specified database to the C:\Temp folder.
  • Verifies Backups: Uses the RESTORE VERIFYONLY command to ensure that each backup is intact and can be restored if needed.
 
Here is the script I used:
				
					USE master;
GO

-- Backup and verify Surveillance
BACKUP DATABASE Surveillance
TO DISK = 'c:\Temp\Surveillance.bak'
WITH FORMAT, 
     MEDIANAME = 'SQLServerBackups',
     NAME = 'Full Backup of Surveillance';
GO

RESTORE VERIFYONLY
FROM DISK = 'c:\Temp\Surveillance.bak';
GO

-- Backup and verify BoringBase
BACKUP DATABASE BoringBase
TO DISK = 'c:\Temp\BoringBase.bak'
WITH FORMAT, 
     MEDIANAME = 'SQLServerBackups',
     NAME = 'Full Backup of BoringBase';
GO

RESTORE VERIFYONLY
FROM DISK = 'c:\Temp\BoringBase.bak';
GO

-- Backup and verify Surveillance_IDP
BACKUP DATABASE Surveillance_IDP
TO DISK = 'c:\Temp\Surveillance_IDP.bak'
WITH FORMAT, 
     MEDIANAME = 'SQLServerBackups',
     NAME = 'Full Backup of Surveillance_IDP';
GO

RESTORE VERIFYONLY
FROM DISK = 'c:\Temp\Surveillance_IDP.bak';
GO

-- Backup and verify Surveillance_IM
BACKUP DATABASE Surveillance_IM
TO DISK = 'c:\Temp\Surveillance_IM.bak'
WITH FORMAT, 
     MEDIANAME = 'SQLServerBackups',
     NAME = 'Full Backup of Surveillance_IM';
GO

RESTORE VERIFYONLY
FROM DISK = 'c:\Temp\Surveillance_IM.bak';
GO

-- Backup and verify SurveillanceLogServerV2
BACKUP DATABASE SurveillanceLogServerV2
TO DISK = 'c:\Temp\SurveillanceLogServerV2.bak'
WITH FORMAT, 
     MEDIANAME = 'SQLServerBackups',
     NAME = 'Full Backup of SurveillanceLogServerV2';
GO

RESTORE VERIFYONLY
FROM DISK = 'c:\Temp\SurveillanceLogServerV2.bak';
GO
				
			

Automating the Tedious

This script takes the repetitive task of backing up and verifying multiple databases and consolidates it into a single, efficient process. By automating these steps, you not only save time but also reduce the risk of human error, ensuring a smooth upgrade or hotfix installation.

Using this SQL script to automate the backup and verification of your Milestone  databases can significantly streamline your workflow. No more manually backing up each database one at a time—just run the script and let it handle the heavy lifting. This not only makes your job easier but also ensures that your data is secure and ready for any upgrades or hotfixes.

It’s the newsletter security professionals use to work smarter. We promise you’ll learn stuff and enjoy a few blissful moments of productive procrastination.

Team Boring

Your go-to XProtect eXPerts. We learn the technical stuff that will save you time and make it less boring.

Team Boring

Your go-to XProtect eXPerts. We learn the technical stuff that will save you time and make it less boring.

You Might Also Enjoy…