Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 60373

Preserving the MorphX VCS when a Backup / Restore is needed.

$
0
0

Hello,
A very common situation is when developers need update their database with fresh data from test or production environments, but the problem begins when you use the MorphX VCS and need to keep this data. Below I show the shortest and fastest way that I’ve found to do that:

First, we need make a backup of VCS data, for that, connect at the SQL using the Microsoft SQL Server Management Studio, choose the database that you need to update with the fresh data and then run the commands:

1
2
3
4
5
6
7
--Creating a temp database to use on our processCREATEDATABASE MyTempBackup
 
--Backuping the dataSELECT*INTO MyTempBackup.dbo.SysVersionControlMorphXItemTable FROM SysVersionControlMorphXItemTable
SELECT*INTO MyTempBackup.dbo.SysVersionControlMorphXLockTable FROM SysVersionControlMorphXLockTable
SELECT*INTO MyTempBackup.dbo.SysVersionControlMorphXRevisionTable FROM SysVersionControlMorphXRevisionTable

Now you can restore the fresh data on DEV’s environment and then we can restore our backuped data.

1
2
3
4
5
6
7
8
9
10
11
12
--Just to ensure that there is no trash on tables, you can skip this stepTRUNCATETABLE SysVersionControlMorphXItemTable
TRUNCATETABLE SysVersionControlMorphXLockTable
TRUNCATETABLE SysVersionControlMorphXRevisionTable
 
--Restoring the dataINSERTINTO SysVersionControlMorphXItemTable SELECT*FROM MyTempBackup.dbo.SysVersionControlMorphXItemTable
INSERTINTO SysVersionControlMorphXLockTable SELECT*FROM MyTempBackup.dbo.SysVersionControlMorphXLockTable
INSERTINTO SysVersionControlMorphXRevisionTable SELECT*FROM MyTempBackup.dbo.SysVersionControlMorphXRevisionTable
 
--Removing the temp databaseDROPDATABASE MyTempBackup

See ya,
Pichler


Viewing all articles
Browse latest Browse all 60373


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>