{"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

\u8fd8\u539f\u6570\u636e\u5e93<\/h1>\n\n\n\n

\u4ee5\u4e0b\u662f\u5c06 Sandbox DB \u6062\u590d\u5230 DEV \u7684\u8fc7\u7a0b\u3002<\/span><\/p>\n\n\n\n

    \n
  1. LCS -> UAT -> Maintain -> Move Database -> Export database<\/li>\n\n\n\n
  2. bacpac\u6587\u4ef6\u4f1a\u88ab\u5bfc\u51fa\u5230\u8d44\u4ea7\u5e93<\/li>\n\n\n\n
  3. \u4ece\u8d44\u4ea7\u5e93\u4e0b\u8f7dbacpac\u6587\u4ef6<\/li>\n\n\n\n
  4. \u4e0b\u8f7dSqlPackage\uff1asqlpackage-win7-x64-en-16.0.6161.0.zip<\/li>\n\n\n\n
  5. \u5728cmd\u4e2d\u8fd0\u884c\u4e0b\u5217\u547d\u4ee4<\/li>\n<\/ol>\n\n\n\n
    \nSqlPackage.exe \/a:import \/sf:D:\\Exportedbacpac\\my.bacpac \/tsn:localhost \/tdn: \/p:CommandTimeout=1200\nExample\nDemo\n1.\tSqlPackage.exe \/a:import \/sf:J:\\MSSQL_BACKUP\\Demo_PreProdbackup.bacpac \/tsn:localhost \/tdn:PreProd_20220712 \/p:CommandTimeout=1200\nDemo\n2.\tSqlPackage.exe \/a:import \/sf:J:\\MSSQL_BACKUP\\Demo_uatbackup.bacpac \/tsn:localhost \/tdn:uat_20221028 \/p:CommandTimeout=1200\n<\/pre>\n\n\n\n
      \n
    1. \u7b49\u5f85<\/li>\n\n\n\n
    2. \u6570\u636e\u5e93\u8fd8\u539f\u6210\u529f\u540e\u8fd0\u884c\u4ee5\u4e0b\u811a\u672c\u5e76\u4e14\u66f4\u65b0\u6570\u636e\u5e93\u7684\u540d\u5b57<\/li>\n<\/ol>\n\n\n\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
      1. \u505c\u6b62\u6240\u6709D365FO\u7684\u670d\u52a1<\/li>\n\n\n\n
      2. \u91cd\u547d\u540dAXDB -> AXDB_OldYYYYMMDD<\/li>\n\n\n\n
      3. \u91cd\u547d\u540d\u8fd8\u539f\u597d\u7684\u6570\u636e\u5e93 -> AXDB<\/li>\n\n\n\n
      4. \u6253\u5f00VS\u505a\u6570\u636e\u5e93\u540c\u6b65<\/li>\n\n\n\n
      5. \u542f\u52a8\u6240\u6709D365FO\u7684\u670d\u52a1<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"

        \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

        Continue reading ‘\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’ »<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[38],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/posts\/355"}],"collection":[{"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/comments?post=355"}],"version-history":[{"count":23,"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/posts\/355\/revisions"}],"predecessor-version":[{"id":598,"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/posts\/355\/revisions\/598"}],"wp:attachment":[{"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/media?parent=355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/categories?post=355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev-d365fo.pantheonsite.io\/wp-json\/wp\/v2\/tags?post=355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}