Please note: The following guide only applies to PDM Professional using SQL Standard. PDM Standard can only use SQL Express, which does not include these options.
Check out our PDM Standard SQL Backup guide for more information on your environment if you use PDM Standard.
SQL jobs and maintenance plans create workflows for the tasks needed to keep your database optimized, regularly backed up, and free of inconsistencies.
“Why do I need to create SQL-specific backup plans at all, though?” These days, this seems unnecessary when you’re likely already backing up the entire server with one tool. If you’ve read our PDM Backups Master List guide, however, you’ve likely learned why a snapshot isn't enough to ensure data retention in the event of a PDM server failure. Due to the nature of PDM’s SQL database usage, a snapshot may leave you with a mid-transaction database upon restore, and there’s a chance you’re left with a corrupt database afterwards.
Additionally, the databases’ log file does not truncate (complete, compress, and physically log the information) until an actual SQL-aware backup is completed. If that backup is not performed, the log will just keep growing until it fills the disk entirely. Backups are needed to preserve disk space. Snapshots are not SQL-aware – they don’t pause the database activity, and they don’t truncate your logs, which could leave you in a bad spot when you’re already in the middle of a disaster recovery scenario.
Maintenance plans and jobs configured through SQL Server Maintenance Studio will allow you to automate this action. Having frequent and regular database backups available will allow you to recover your data in the event of a failure.
There are two ways to set up backups in SQL:
Maintenance Plans (SQL 2022 and earlier): In SQL 2022 and earlier, the SQL Server Integration Services (SSIS) module was easily selectable as part of the base install. SSIS is what includes the Maintenance Plans section of SQL Server Management Studio (SSMS). So for SQL 2022 and earlier, we recommend Maintenance Plans.
Jobs (SQL 2025 and later): With SQL 2025 and beyond, SSIS is no longer a core component, and it requires some finagling with Visual Studio to get added back into your install. This is primarily because Microsoft is starting to push Maintenance plans into the “legacy” category, and therefore, move companies away from using them. Maintenance plans are extremely reliable and easy to use, but they can lack some scalability for larger or more complex environments. So, in looking to the future, we want to allow users a way to future-proof their setups now while still safely backing up their vault DB’s.
To use either of these options, you will need to have SQL Server Management Studio (SSMS) installed. If you don't, you can get it here.
You’ll also need to ensure the SQL Server Agent is running on the SQL server in order to process the required tasks.
The Maintenance Plan Wizard includes prebuilt core plans, but manually creating plans gives more flexibility in execution.
Additionally, when implementing an SQL Server Maintenance Plan:










Tables in the Vault Database contain indexes, which ensure efficient lookups. This is automatically maintained by the SQL Server, whenever an insert, update, or delete type change is made in the underlying data. Over time, due to growth, indexes get a bit fragmented. Updating and refreshing the indexes will help with more severely fragmented instances. In turn, the maintenance plan will improve performance for searching, browsing, and other interactions with the File Vault.










Default is “C:\Program Files\Microsoft SQL Server\MSSQL##.MSSQLSERVER\MSSQL\Backup”. 
DECLARE @FilePath NVARCHAR(500);
DECLARE @DateSuffix NVARCHAR(50);
-- Get current date and time formatted as YYYYMMDD
SET @DateSuffix = FORMAT(GETDATE(), 'yyyMMdd');
-- Construct the full file path with the date and time suffix
SET @FilePath = '[Path]\[VaultName]_'+ @DateSuffix +'.bak';
-- Perform the backup using dynamic SQL
BACKUP DATABASE [VaultName]
TO DISK = @FilePath
WITH INIT;
When you've finished configuring the step, click OK to go back to the main Steps page. Repeat for each database.
After adding a step for each database in your environment (you should have at least 2 – one for each vault and one ConisioMasterDb), you'll need to add a step for cleaning up the old backup files. We only need one step to perform the cleanup action, as it captures all “.bak” files in the designated folder.
-- Delete backup files older than 30 days
DECLARE @cutoff DATETIME;
SET @cutoff = DATEADD(DAY, -30, GETDATE());
EXEC xp_delete_file 0, N'[path]', N'bak', @cutoff, 1;

When you’ve finished configuring the step, click OK to go back to the main Steps page.

You’ll want to create a separate job for index rebuild and reorganization, as each job can only follow one schedule for all steps. We definitely want at least daily backups, but index rebuild and reorganization could cause performance issues if run that often. Usually, you want to run index maintenance no more than weekly. Though monthly would suffice for most environments.

/* Official SOLIDWORKS index maintenance script (KB QA00000123139)
Checks fragmentation on each index and acts based on thresholds:
- Under 5%: No action taken
- Between 5% and 30%: Reorganize (lighter, online operation)
- Above 30%: Rebuild (full reconstruction)
Only processes indexes with more than 1000 pages (small indexes are not worth maintaining) */
USE [VaultName]
DECLARE
@id int,
@dbname SYSNAME,
@cmd1 nvarchar(max)
SET @dbname = DB_NAME();
IF OBJECT_ID('tempdb..#work_table') IS NOT NULL DROP TABLE #work_table
CREATE TABLE #work_table
(
Task int IDENTITY (1,1) NOT NULL,
ObjectName sysname,
IndexName sysname,
SchemaName sysname,
IndexFragm float
)
SET @Cmd1= N'USE ['+ @dbname + N'] ;
INSERT INTO #work_table
SELECT
o.name AS objectName,
i.name AS indexName,
s.name AS schemaname,
p.avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, null) AS p
INNER JOIN sys.objects AS o ON p.object_id = o.object_id
INNER JOIN sys.schemas AS s ON s.schema_id = o.schema_id
INNER JOIN sys.indexes AS i ON p.object_id = i.object_id
AND i.index_id = p.index_id
WHERE p.page_count > 1000
AND p.avg_fragmentation_in_percent > 5
AND p.index_id > 0
AND s.name <> ''sys'';'
EXEC sp_executesql @CMD1
DECLARE
@Object_name sysname,
@index_name sysname,
@SchemaName sysname,
@Fragmentation float,
@command1 nvarchar(max),
@command2 nvarchar(max),
@task int
SET @task = 1
WHILE (1=1)
BEGIN
SELECT
@Object_name = ObjectName,
@index_name = IndexName,
@SchemaName = SchemaName,
@Fragmentation = IndexFragm
FROM #work_table
WHERE task = @task
IF @@ROWCOUNT = 0
BREAK
IF (@Fragmentation > 30) -- Rebuild
BEGIN
SET @Command1 = N'USE [' + @Dbname + '] ; ALTER INDEX [' + @index_name + '] ON '
+ @SchemaName + '.[' + @Object_name + ']'
+ N' REBUILD WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)'
PRINT (@Command1)
EXEC sp_executesql @command1
END
IF (@Fragmentation > 5 AND @Fragmentation < 30) -- Reorganize
BEGIN
SET @Command2 = N'USE [' + @Dbname + ']; ALTER INDEX [' + @index_name + '] ON '
+ @SchemaName + '.[' + @Object_name + ']'
+ N' REORGANIZE WITH (LOB_COMPACTION = ON)'
PRINT @command2
EXEC sp_executesql @command2
END
SET @task = @task + 1
END
DROP TABLE #work_table

If GoEngineer is your reseller and you have any questions or issues, please reach out to our Support Team for more help! We’d be happy to assist.
Additionally, you can join the GoEngineer Community to participate in conversations, create forum posts, and answer questions from other SOLIDWORKS users.
Editor's Note: This article was originally published in January 2025 and has been updated by our Technical Team for accuracy and comprehensiveness.
SOLIDWORKS PDM 2025 - What's New
Configuration Properties in SOLIDWORKS PDM Data Cards
SOLIDWORKS PDM - Implement Working Revisions
How to Create Dynamic Lists in SOLIDWORKS PDM Standard Data Cards
About Rowan Gray
Rowan Gray is a Technical Support Manager at GoEngineer and CPPA/CPAP 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, D&D, multimedia crafting, and spoiling their pets.
Get our wide array of technical resources delivered right to your inbox.
Unsubscribe at any time.