DB Snapshoot
We neet Powershell tool to start stop the service
To install Run powershell as administrator to install toll
1 2 |
Install-Module -Name d365fo.tools Import-Module -Name d365fo.tools |
stop the all services with powershell
1 |
Stop-D365Environment -All |
Create a Snapshoot
1 2 3 4 |
CREATE DATABASE axDB_Snapshot_20250911 ON ( NAME = 'axDB', FILENAME = 'J:\Snapshots\axDB_Snapshot_20250911.ss' ) AS SNAPSHOT OF axDB; |
test snapshoot
1 2 3 4 5 6 7 8 |
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
1 |
Start-D365Environment -All |
Work normally and do samething..
To restore Snapshoot
stop the all services with powershell
1 |
Stop-D365Environment -All |
To restore List the sessions on snapshoot
1 2 3 4 5 6 7 |
<code>USE master; SELECT session_id, login_name, program_name FROM sys.dm_exec_sessions WHERE database_id = DB_ID('axDB_Snapshot_20250911');</code> |
Kill the processes if exixs
1 |
Kill 999; |
Restore The Snapshoot
1 2 3 4 |
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
1 |
Start-D365Environment -All |
To Drop a snapshoot
1 |
DROP DATABASE axDB_Snapshot_20250911; |