SOLIDWORKS PDM Standard Automated SQL Backups

Article by Rowan Gray on Jan 16, 2025

SOLIDWORKS PDM Standard is a great data management tool included with SOLIDWORKS Professional and SOLIDWORKS Premium. However, it is built on an SQL Express database, which unfortunately means there are no automated maintenance plans in SQL Server Management Studio. This makes automating the SQL backup procedure more difficult, but it’s absolutely still possible, and you even have a few different options to suit your needs.

Note: GoEngineer offers these solutions as-is as a courtesy to our customers, but our support team is unable to assist with implementing, configuring, or troubleshooting automated SQL Express backups.

First, we need to clarify some assumptions. The information below assumes you have SQL Express, SQL Server Management Studio, and PDM Standard already installed on a server. If you need assistance installing the software, please feel free to contact our services team for information. If you recently completed a PDM Jumpstart with GoEngineer, all the necessary PDM components have been installed as a part of your services.

Even if you used GoEngineer’s Jumpstart services for PDM Standard implementation, GoEngineer is not directly responsible for your backups and is not specifically recommending any of the methods below. It is your company’s responsibility to look over the information and decide the best course of action for your team.

Method 1: Third-Party Tools

There are various utilities on the internet to accomplish backups, including a few paid and free utilities for backing up SQL Express. Different tools will have different levels of capability, including local vs offsite/cloud backups, success and failure notifications, and historical retention and clean-up utilities.

Note: GoEngineer does not specifically recommend these products and cannot guarantee their efficacy. These utilities are third-party products, and they are provided for information purposes only. Please do your own research before implementing any third-party software in your environments.

Some options we’re aware of are shared below, but this is far from an exhaustive list, and we recommend looking at various options to see what you like best.

Method 2: Batch File

This method uses a slightly modified version of a script provided directly from Microsoft (KB2019698). It’s a single Windows batch file containing SQL commands that create the database backup file. It will back up all databases (including system databases) found in the specified SQL instance. Variables are used to set instance\database name, backup file location\name, script location, and the number of backups to keep. The file can be run manually, or it can be automated using Windows Task Scheduler.

Prerequisites:

  • This method requires the SQL command utility to be installed. This is included with the installation of SQL Express 2014 and 2019, and SQL 2022. It must be downloaded and installed separately for SQL 2016 and 2017.
  • A stored procedure must be added to the master database in the SQL instance.

Creating the Stored Procedure

  1. Log into your SQL server, open SQL Server Management Studio, and connect to the SQL Express instance.
  2. Click New Query and select the “master” database from the dropdown at the top.

    New Query Selection from Master Database SOLIDWORKS PDM Standard SQL Automated Backups

  3. Paste the contents of the “SQL Express Backups” script into the new query window and click Execute. You should get a message saying the commands completed successfully.

    Completed SQL Backups SOLIDWORKS Standard

  4. Executing the query adds the stored procedure to the master database. Confirm that it exists by going into Object Explorer and expanding Databases > System Databases > Master > Programmability > Stored Procedures. If you see dbo.sp_BackupDatabases, then you’re good to go!

    SOLIDWORKS PDM Standard Auomated SQL Backups Object Explorer

Creating the Batch File

  1. Start a new text document using your preferred text editor.
  2. Copy and paste the “Batch File Text” script below into the document.
  3. Modify the below variables to fit your environment (the corresponding text to change in the script is highlighted in yellow):
    1. BACKUPPATH” is the file path where you’ll be storing the backups on your SQL server. This needs to be a local folder.
    2. numbackups” is the desired number of backups.
      1. It is currently set to 7 but can be any number higher than 0.
    3. SQLINSTANCENAME” is the instance name of your SQL server. If you are using the default instance, set this to MSSQLSERVER.
      1. If you’re unsure of your instance name, log into SQL Server Management Studio and check the name via Object Explorer. If you’re using a named instance, it will be included after your SQL server name with a \ (i.e., Server\Instance). If there’s nothing after the server name, you’re using the default instance.

        Creating Batch File SOLIDWORKS PDM Standard Automated SQL Backups

  4. Save the file with the name “SQL Backup Batch”. Once saved, change the file extension from “.txt” to “.bat”.

Batch File Text:

::Specify Folder Location For SQL Database Backups

set BACKUPPATH=c:\SQL Backup

::Specify How Many Days Of Backups To Keep

set numbackups=7

sqlcmd -S .\SQLINSTANCENAME -E -Q"EXEC sp_BackupDatabases @backupLocation='%BACKUPPATH%\', @backupType=F"

forfiles /P "%BACKUPPATH%" /S /M *.BAK /D -%numbackups% /C "cmd /c del @PATH"

Scheduling with Task Scheduler

You’ll then take the batch file you created and import it into Windows Task Scheduler to automate it.

  1. Start Task Scheduler by searching for it from the Start menu, and selecting Create Basic Task…

    Create Basic Task… Option SOLIDWORKS PDM Automated SQL Backups Task Scheduled Library

  2. Name the task. Click Next.

    Create Basic Task Wizard SOLIDWORKS PDM Standard Database Backup

  3. Set the trigger to run Daily (or whatever interval you’d prefer). Click Next.

    Set Trigger SOLIDWORKS PDM Create Basic Task Wizard for SQL Automation

  4. Set a time for the task to start. Generally, this should be after-hours so all user changes for the day are captured. Click Next.

    Set Time SOLIDWORKS PDM Standard SQL Backup

  5. Set the type of action to Start a program. Click Next.

    Start a Program SOLIDWORKS PDM Standard Automated SQL Backup Tutorial

  6. Browse to the backup script .bat file created earlier. Click Next.

    SOLIDWORKS PDM Standard Automated SQL Backup Start Program Option

  7. Review the information in the summary. Select Finish to create the Windows schedule.

    Automating SOLIDWORKS PDM Standard Backups

Summary

Once you’ve configured the task, it should then run based on the schedule you set. Always be sure to check periodically whether the files are being created properly by going to check the output location you specified after the scheduled run time. If GoEngineer is your VAR, you can always reach out to Technical Support if you have questions or require other assistance!

Related Articles

SOLIDWORKS PDM Professional Automated SQL Backups

SOLIDWORKS PDM 2025 - What's New

How to Install the SOLIDWORKS PDM Server

Configuration Properties in SOLIDWORKS PDM Data Cards

How to Create Dynamic Lists in SOLIDWORKS PDM Standard Data Cards

VIEW ALL PDM ARTICLES

 

About Rowan Gray

Rowan Gray is a Technical Support Team Lead at GoEngineer with a specialty in SOLIDWORKS PDM and related data/lifecycle management. They have been with GoEngineer since 2020, and have a strong IT background that helps them more fully support customers with whatever issues may arise in their PDM environment. In their free time they enjoy playing video games, crocheting, and spoiling their pets.

View all posts by Rowan Gray