DB Snapshoot

We neet Powershell tool to start stop the service

To install Run powershell as administrator to install toll

Install-Module -Name d365fo.tools
Import-Module -Name d365fo.tools

stop the all services with powershell

Stop-D365Environment -All

Create a Snapshoot

CREATE DATABASE axDB_Snapshot_20250911 ON
( NAME = 'axDB',
FILENAME = 'J:\Snapshots\axDB_Snapshot_20250911.ss' )
AS SNAPSHOT OF axDB;

test snapshoot

SELECT
name AS snapshot_name,
database_id,
source_database_id,
create_date,
state_desc
FROM sys.databases
WHERE source_database_id = DB_ID('axDB');

start all services with powershell

Start-D365Environment -All

Work normally and do samething..

To restore Snapshoot

stop the all services with powershell

Stop-D365Environment -All

To restore List the sessions on snapshoot

USE master;
SELECT
session_id,
login_name,
program_name
FROM sys.dm_exec_sessions
WHERE database_id = DB_ID('axDB_Snapshot_20250911');

Kill the processes if exixs

Kill 999;

Restore The Snapshoot

USE master;
ALTER DATABASE axDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
RESTORE DATABASE axDB FROM DATABASE_SNAPSHOT = 'axDB_Snapshot_20250911';
ALTER DATABASE axDB SET MULTI_USER;

start all services with powershell

Start-D365Environment -All

To Drop a snapshoot

DROP DATABASE axDB_Snapshot_20250911;

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *