24 May 2019

How to import Azure bacpac file to Local SQL DB / On premises SQL DB in D365 environment

cd C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin

SqlPackage.exe /a:import /sf:C:\Users\Adminc4221d5a84\Documents\Backup\AXDBUATCopy07Oct.bacpac /tsn:localhost /tdn:AXDB_UATCOPY07Oct18 /p:CommandTimeout=1200

--or
-- To import to on-premises need to import data using this below link.https://bitwizards.com/thought-leadership/blog/2013/january-2013/restore-sql-azure-database-to-sql-server-2012


CREATE USER axdeployuser FROM LOGIN axdeployuser
EXEC sp_addrolemember 'db_owner', 'axdeployuser'

CREATE USER axdbadmin FROM LOGIN axdbadmin
EXEC sp_addrolemember 'db_owner', 'axdbadmin'

CREATE USER axmrruntimeuser FROM LOGIN axmrruntimeuser
EXEC sp_addrolemember 'db_datareader', 'axmrruntimeuser'
EXEC sp_addrolemember 'db_datawriter', 'axmrruntimeuser'

CREATE USER axretaildatasyncuser FROM LOGIN axretaildatasyncuser
EXEC sp_addrolemember 'DataSyncUsersRole', 'axretaildatasyncuser'

CREATE USER axretailruntimeuser FROM LOGIN axretailruntimeuser
EXEC sp_addrolemember 'UsersRole', 'axretailruntimeuser'
EXEC sp_addrolemember 'ReportUsersRole', 'axretailruntimeuser'

CREATE USER [NT AUTHORITY\NETWORK SERVICE] FROM LOGIN [NT AUTHORITY\NETWORK SERVICE]
EXEC sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK SERVICE'

UPDATE T1
SET T1.storageproviderid = 0
    , T1.accessinformation = ''
    , T1.modifiedby = 'Admin'
    , T1.modifieddatetime = getdate()
FROM docuvalue T1
WHERE T1.storageproviderid = 1

ALTER DATABASE [AXDB_UATCOPY07Oct18] SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 6 DAYS, AUTO_CLEANUP = ON)

-- stop the Microsoft dynamics 2 services, Management reporter service, and World wide web service.


ALTER DATABASE [AxDB] MODIFY NAME = [AxDB_Original07Oct18]

ALTER DATABASE [AXDB_UATCOPY07Oct18] MODIFY NAME = [AxDB]

-- start the Microsoft dynamics 2 services, Management reporter service, and World wide web service.
--Do full DB sync
--If it is on premises add a user on admin provision tool to access AX application

.\DeployAllReportsToSsrs.ps1 -LogFilePath C:\logreport.txt -PackageInstallLocation J:\AosService\PackagesLocalDirectory

No comments:

Post a Comment

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...