2016년 8월 3일 수요일

[Dynamics] SQL Script: After Restore from PROD to TEST


Do you want PROD data in your TEST System? 
Easy, just restore a backup of PROD into your TEST-DB. Run the following script to clean up some AOS specific data:
-–01: DEV, 02: PROD, 03: MIG

UPDATE [AX09_TEST].[dbo].[BatchServerGroup] 
SET    SERVERID = '01@SRVAOS1
WHERE  SERVERID = '02@SRVAOS1';
UPDATE [AX09_TEST].[dbo].[BATCHSERVERCONFIG] 
SET    SERVERID = '01@SRVAOS1
WHERE  SERVERID = ’02@SRVAOS1′;
UPDATE [AX09_TEST].[dbo].[SYSSERVERCONFIG] 
SET    SERVERID = '01@SRVAOS1', SERVERGUID = newid() 
WHERE  SERVERID = '02@SRVAOS1';
UPDATE [AX09_TEST].[dbo].[Batch] 
SET    SERVERID = '01@SRVAOS1
WHERE  SERVERID = '02@SRVAOS1';

DELETE [
AX09_TEST].[dbo].[SYSCLIENTSESSIONS];

–-The following has nothing to do with the restore to TEST, remove obsolete [SYSCLIENTSESSIONS] from PROD

SELECT * 
FROM   [AX09_LIVE].[dbo].[SYSCLIENTSESSIONS] 
WHERE  STATUS = 0;

DELETE [
AX09_LIVE].[dbo].[SYSCLIENTSESSIONS] 
WHERE  STATUS = 0;

댓글 없음:

댓글 쓰기