{"id":355,"date":"2023-11-20T13:29:33","date_gmt":"2023-11-20T05:29:33","guid":{"rendered":"https:\/\/live-d365fo.pantheonsite.io\/?p=355"},"modified":"2023-11-30T10:25:16","modified_gmt":"2023-11-30T02:25:16","slug":"how-to-restore-d365fo-sandbox-db-to-dev","status":"publish","type":"post","link":"https:\/\/dev-d365fo.pantheonsite.io\/how-to-restore-d365fo-sandbox-db-to-dev\/","title":{"rendered":"\u5982\u4f55\u628aDynamics 365 FO UAT\u7684\u6570\u636e\u5e93\u8fd8\u539f\u5230\u5f00\u53d1\u73af\u5883\uff08how-to-restore-d365fo-sandbox-db-to-dev\uff09"},"content":{"rendered":"\n
\u4ee5\u4e0b\u662f\u5c06 Sandbox DB \u6062\u590d\u5230 DEV \u7684\u8fc7\u7a0b\u3002<\/span><\/p>\n\n\n\n \u8fd8\u539f\u6570\u636e\u5e93 \u4ee5\u4e0b\u662f\u5c06 Sandbox DB \u6062\u590d\u5230 DEV \u7684\u8fc7\u7a0b\u3002 SqlPackage.exe \/a:import \/sf:D:\\Exportedbacpac\\my.bacpac \/tsn:localhost \/tdn: \/p:CommandTimeout=1200 Example Demo 1. SqlPackage.exe \/a:import \/sf:J:\\MSSQL_BACKUP\\Demo_PreProdbackup.bacpac \/tsn:localhost \/tdn:PreProd_20220712 \/p:CommandTimeout=1200 Demo 2. SqlPackage.exe \/a:import \/sf:J:\\MSSQL_BACKUP\\Demo_uatbackup.bacpac \/tsn:localhost \/tdn:uat_20221028 \/p:CommandTimeout=1200 ALTER DATABASE [uatbackup_20190401.bacpac] SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 6 DAYS, AUTO_CLEANUP = ON) — CREATE USER axdeployuser FROM LOGIN axdeployuser EXEC sp_addrolemember ‘db_owner’, ‘axdeployuser’ …<\/p>\n\n
\nSqlPackage.exe \/a:import \/sf:D:\\Exportedbacpac\\my.bacpac \/tsn:localhost \/tdn:
\n
\nALTER DATABASE [uatbackup_20190401.bacpac] SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 6 DAYS, AUTO_CLEANUP = ON)\n\n--\nCREATE USER axdeployuser FROM LOGIN axdeployuser\nEXEC sp_addrolemember 'db_owner', 'axdeployuser'\n \nCREATE USER axdbadmin FROM LOGIN axdbadmin\nEXEC sp_addrolemember 'db_owner', 'axdbadmin'\n \nCREATE USER axmrruntimeuser FROM LOGIN axmrruntimeuser\nEXEC sp_addrolemember 'db_datareader', 'axmrruntimeuser'\nEXEC sp_addrolemember 'db_datawriter', 'axmrruntimeuser'\n \nCREATE USER axretaildatasyncuser FROM LOGIN axretaildatasyncuser\nEXEC sp_addrolemember 'DataSyncUsersRole', 'axretaildatasyncuser'\n \nCREATE USER axretailruntimeuser FROM LOGIN axretailruntimeuser\nEXEC sp_addrolemember 'UsersRole', 'axretailruntimeuser'\nEXEC sp_addrolemember 'ReportUsersRole', 'axretailruntimeuser'\n \nCREATE USER axdeployextuser FROM LOGIN axdeployextuser\nEXEC sp_addrolemember 'DeployExtensibilityRole', 'axdeployextuser'\n \nCREATE USER [NT AUTHORITY\\NETWORK SERVICE] FROM LOGIN [NT AUTHORITY\\NETWORK SERVICE]\nEXEC sp_addrolemember 'db_owner', 'NT AUTHORITY\\NETWORK SERVICE'\n \n \nUPDATE T1\nSET T1.storageproviderid = 0\n, T1.accessinformation =''\n, T1.modifiedby = 'Admin'\n, T1.modifieddatetime = getdate()\nFROM docuvalue T1\nWHERE T1.storageproviderid = 1 --Azure storage\n \nALTER DATABASE [uatbackup_20190401.bacpac] SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 6 DAYS, AUTO_CLEANUP = ON)\nGO\nDROP PROCEDURE IF EXISTS SP_ConfigureTablesForChangeTracking\nDROP PROCEDURE IF EXISTS SP_ConfigureTablesForChangeTracking_V2\nGO\n \n-- Begin Refresh Retail FullText Catalogs\nDECLARE @RFTXNAME NVARCHAR(MAX);\nDECLARE @RFTXSQL NVARCHAR(MAX);\nDECLARE retail_ftx CURSOR FOR\nSELECT OBJECT_SCHEMA_NAME(object_id) + '.' + OBJECT_NAME(object_id) fullname FROM SYS.FULLTEXT_INDEXES\nWHERE FULLTEXT_CATALOG_ID = (SELECT TOP 1 FULLTEXT_CATALOG_ID FROM SYS.FULLTEXT_CATALOGS WHERE NAME = 'COMMERCEFULLTEXTCATALOG');\nOPEN retail_ftx;\nFETCH NEXT FROM retail_ftx INTO @RFTXNAME;\n \nBEGIN TRY\nWHILE @@FETCH_STATUS = 0\nBEGIN\nPRINT 'Refreshing Full Text Index ' + @RFTXNAME;\nEXEC SP_FULLTEXT_TABLE @RFTXNAME, 'activate';\nSET @RFTXSQL = 'ALTER FULLTEXT INDEX ON ' + @RFTXNAME + ' START FULL POPULATION';\nEXEC SP_EXECUTESQL @RFTXSQL;\nFETCH NEXT FROM retail_ftx INTO @RFTXNAME;\nEND\nEND TRY\nBEGIN CATCH\nPRINT error_message()\nEND CATCH\n \nCLOSE retail_ftx;\nDEALLOCATE retail_ftx;\n-- End Refresh Retail FullText Catalogs\n==\n<\/pre>\n\n\n\n
\n