Pages

Thursday, November 14, 2013

Restore AX database in different domain


For the company which doesn't have AX development server, most of functional consultant colleagues have to prepare data migration in their VM Server.  And then, we will restore DB in our customer's server.  Of course, it's different domain.   These are SQL scripts that I always use after restore DB.  


Get Windows SID

First of all, check SID of Windows user who has System Administrator role (means current user who first open AX client after restoring).   
  • Check all users
    • wmic useraccount get name,sid
  • Check current user
    • whoami /user


Run SQL script to change Windows user info's 

There are 5 things to be changed: -

  • Network alias (user name) for Administrator 
  • Network alias (user name) for Business Connector Proxy 
  • Network domain 
  • SID for Administrator 
  • SID for Business Connector Proxy user


DECLARE @NETWORKALIAS nvarchar(80) 
DECLARE @NETWORKALIAS_BC nvarchar(80)
DECLARE @NETWORKDOMAIN nvarchar(255)
DECLARE @SID nvarchar(124) 
DECLARE @SID_BC nvarchar(124) 

---------- *** Change varibles here *** ----------------------
SET @NETWORKALIAS = 'Administrator'
SET @NETWORKALIAS_BC = 'Administrator'
SET @NETWORKDOMAIN = 'axtest'
SET @SID = 'S-1-5-21-3067842618-1207889276-857484016-500' 
SET @SID_BC = 'S-1-5-21-3067842618-1207889276-857484016-500' 
-------------------------------------------------------------- 

update USERINFO set
NETWORKALIAS = @NETWORKALIAS,
NETWORKDOMAIN = @NETWORKDOMAIN, 
SID = @SID
where ID = 'Admin'

select * from USERINFO
where ID = 'Admin'

update SysBCProxyUserAccount set
NETWORKALIAS = @NETWORKALIAS_BC,
NETWORKDOMAIN = @NETWORKDOMAIN, 
SID = @SID_BC


select * from SysBCProxyUserAccount



Run SQL script to update batch and server sessions 


  • Batch server - If there are configurations about batch server, we better change them in one step. 
  • Server Sessions - this is needed especially when deploy SSRS reports.  If don't update server sessions, it will try to reach old sessions and not able to deploy them 


SET NOCOUNT ON 
DECLARE @AOSID NVARCHAR(20), @FROMAOSID NVARCHAR(20), @AOSACCOUNT NVARCHAR(50), 
@SERVERID NVARCHAR(50), @FROMSERVERID NVARCHAR(50) 
---------- *** Change varibles here *** ----------------------
SET @SERVERID = '01@AX2012R2TEST' 
SET @FROMSERVERID = '01@VMSERVER'
SET @AOSACCOUNT = 'axtest\administrator'
--------------------------------------------------------------

Update BatchServerGroup set SERVERID = @SERVERID where SERVERID = @FROMSERVERID

Update BATCHSERVERCONFIG set SERVERID = @SERVERID where SERVERID = @FROMSERVERID

Update BATCH set SERVERID = @SERVERID where SERVERID = @FROMSERVERID

delete from SYSSERVERCONFIG 
delete from SYSSERVERSESSIONS 
delete from SYSCLIENTSESSIONS



1 comment:

  1. EPOS system and software foe takeaway is best solution for all type of business especially takeaway,Restaurants, Bakeries,Shops etc.
    Intelepos is offering POS point of sale software and system that fits to small businesses.
    takeaway epos software
    epos software for takeaway
    INTELEPOS.COM
    POS point of sale syatem for takeaway and other business is more efficient for customers management and order management.
    https://intelepos.com/takeaways

    ReplyDelete