web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Problem when restore sandbox to UAT

(0) ShareShare
ReportReport
Posted on by 75

I had some issues with my stage environment cloud today.. i want to restore UAT(DEVELOPER) database from SANDBOX, i got some error below

Verifying deployment plan
Analyzing deployment plan
Importing package schema and data into database
Updating database
*** Error importing database:Could not import package.
Warning SQL0: The source contains users that rely on an external authentication provider that is not supported by the target. These users will be treated as users without logins.
Error SQL72014: .Net SqlClient Data Provider: Msg 207, Level 16, State 1, Procedure AXPerf_UpdateStats, Line 1 Invalid column name 'has_persisted_sample'.
Error SQL72045: Script execution error. The executed script:
CREATE PROCEDURE AXPerf_UpdateStats
@ExecuteStats BIT=1
AS
BEGIN
DECLARE @spVersion AS NVARCHAR (30) = 'AXPerf_UpdateStats v2';
SET NOCOUNT ON;
IF OBJECT_ID(N'tempdb..#stats_needs_update') IS NOT NULL
DROP TABLE #stats_needs_update;
IF OBJECT_ID(N'tempdb..#StatsData') IS NOT NULL
DROP TABLE #StatsData;
IF OBJECT_ID(N'tempdb..#DisabledStats') IS NOT NULL
DROP TABLE #DisabledStats;
DECLARE @running_count AS BIGINT, @running_count_total AS BIGINT;
SET @running_count = 0;
SET @running_count_total = 200000000;
SELECT s.Name AS StatOrIndexName,
s.stats_id,
s.auto_created,
s.is_temporary,
o.object_id,
o.schema_id,
o.name AS TableName,
o.type,
sp.rows AS RowCnt,
sp.rows_sampled,
sp.modification_counter AS ModCtr,
s.has_persisted_sample,
isnull(sp.persisted_sample_percent, 0) AS persisted_sample_percent


Does anyone know this one? 

I have the same question (0)
  • Suggested answer
    Anup Shah MSFT Profile Picture
    on at
    RE: Problem when restore sandbox to UAT

    For Self-service deployments see the Maintenance document for getting access to the DB

    docs.microsoft.com/.../maintenanceoperationsguide-newinfrastructure

  • Suggested answer
    Khushhal Garg Profile Picture
    1,514 on at
    RE: Problem when restore sandbox to UAT

    I do restore sandbox databases to DEV and don't see this issue. Did you follow docs.microsoft.com/.../dbmovement-scenario-exportuat

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Problem when restore sandbox to UAT

    Tier2, Tier3 and Tier4 have similar architecture. But some time ago there was a change and now you need to specify the database name when you connect.

    If you are able to login to the Tier2 VM via RDP you should definetely be able to login to the database from within the VM. However newer systems are no longer based on VM, instead they run on Service Fabric. For those environments you will need to add the database firewall rule from LCS. Then you can access the database from your own computer 

    You don't see these databases in your Azure portal since they are not in your Azure subscription, but Microsoft's.

  • Community Member Profile Picture
    on at
    RE: Problem when restore sandbox to UAT

    I know how to access a database My friend!!

    What i meant was, Database access is restricted on Tier-2 sandboxes used for UAT. but in Tier-3 and Tier-4 sandbox one will be able to access AxDB.

    Tier-2 seems to have a different (prod like) SQL instance and cannot be accessed. It keeps showing a pop-up to add a firewall rule and prompts to login to Azure portal, but then fails to find the SQL instance in your azure subscription.

    I will update this post if I find any documentation from Microsoft to confirm this.

    Update 06/11/2019 : I was able to access the Tier 2 sandbox following this documentation https://cloudblogs.microsoft.com/dynamics365/it/2019/08/06/lifecycle-services-august-2019-release-1-release-notes/

    Just make sure, you connect using the axdbadmin credentials and mention the database name in the "Connection properties" in SSMS 

  • Suggested answer
    Rahul Mohta Profile Picture
    21,032 on at
    RE: Problem when restore sandbox to UAT

    a fix is seen in Pu30, have you tried it?

  • Budi Ristanto Profile Picture
    75 on at
    RE: Problem when restore sandbox to UAT

    Please follow these step:

    1. Open SQL from Remote Desktop of this UAT

    2. In the Login tab - fill SQL Server name and password

    3. In the Connection properties(1) - enter the axdbname(2)(from lcs), and click on Connect

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Problem when restore sandbox to UAT

    Do you have a new "self service deployment" sandbox? In that case I don't know how to access the database. But if you still can login to the VM, you can access the database via SSMS. But you need to provide the database name in the connection details, otherwise it will try to connect to <master> database and fail.

  • Community Member Profile Picture
    on at
    RE: Problem when restore sandbox to UAT

    but in sandboxes you don't get access to AxDB anymore. how to run these scripts ?

  • Budi Ristanto Profile Picture
    75 on at
    RE: Problem when restore sandbox to UAT

    msft give same answer to me and it works nicely

    1. On the Environment where they are taking the backup UAT , run the script below:

    a.     Find the Stored Procedure in the DB tree -> AX database (name depending per customer) -> Programmability -> Stored Procedures – search for 'AXPerf_UpdateStats'

    b.     Right click on it -> “Script Stored Procedure as” -> CREATE TO -> New Query Editor Window;  Then backup the script to a file (CTRL+S).

    c.     Run the following query after point b. : DROP PROCEDURE AXPerf_UpdateStats;

    2. Take a new backup of the UAT environment

    3. Then restore it in Tier 1.

    4. Then open the file saved at point 1. b. and run it back in UAT environment

    let me know if any updated or question about it..thanks all it solved by now

  • Agustín Quagliotti Profile Picture
    282 on at
    RE: Problem when restore sandbox to UAT

    MSFT Answer (we didn't try it yet):

    I am glad to assist you in this request; I just want to let you know that there is a workaround for this scenario you just need to run a couple of scripts on SQL admin in order to fix it.

    1. On the Environment where they are taking the backup UAT, run the script below:

    select * from dbo.sysobjects where id = object_id(N'dbo.AXPerf_UpdateStats') --

    a. Find the Stored Procedure in the DB tree -> AX database (name depending per customer) -> Programmability -> Stored Procedures – search for 'AXPerf_UpdateStats'

    b. Right click on it -> “Script Stored Procedure as” -> CREATE TO -> New Query Editor Window; Then backup the script to a file (CTRL+S).

    c. Run the following query after point b.: DROP PROCEDURE AXPerf_UpdateStats;

    1. Take a new backup of the UAT environment

    2. Then restore it in Tier 1.

    3. Then open the file saved at point 1. b. and run it back in UAT environment

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,239

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 767 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 672 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans