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

Notifications

Announcements

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)
  • nmaenpaa Profile Picture
    101,166 Moderator on at

    How did you export the database?

    Did you follow the documented process for the import: docs.microsoft.com/.../dbmovement-scenario-exportuat

  • Community Member Profile Picture
    on at

    Me too.  I have this same error.  Any ideas on how to fix it?

  • IFC Profile Picture
    15 on at

    Same problem too. It's strange beause the last one I did it was 6 days ago and worked fine.

  • Budi Ristanto Profile Picture
    75 on at
    [quote]

    How did you export the database?

    Did you follow the documented process for the import: docs.microsoft.com/.../dbmovement-scenario-exportuat

    [/quote]

    yes, i always followed the step for restoring from UAT..it seems that problem triggered after update released...because the last one was worked fine....i already submitted the issue to ms support.hope it will be fixed soon

  • Community Member Profile Picture
    on at

    If you find a workaround with MSFT, could you please share it here?

  • Agustín Quagliotti Profile Picture
    282 on at

    Hi, I have a similar problem restoring the database on the sanbox (Tier 2) environemt. Step 9 is failing.

    I've also opened a support ticket with MSFT. I'll let you know any updates.

    Regards.

  • Agustín Quagliotti Profile Picture
    282 on at

    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

  • Budi Ristanto Profile Picture
    75 on at

    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

  • Community Member Profile Picture
    on at

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

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    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.

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 679 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 264 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans