Supportværktøj

Hvis du har brug for fjernsupport brug denne og ring til os

Værktøj til Dynamics Ax

How to prevent lock escalation

Udgivet den  af seo

There are several ways to reduce the lock footprint og expensive queries so that the lock escalation thresholds are not exceeded.

Beneath I have described how I do it most of the times. Other ways can be read in this article: How to resolve blocking problems that are caused by lock escalation in SQL Server


SET ROWCOUNT 500
delete_more:
DELETE FROM BATCHHISTORY WHERE CREATEDDATETIME < '2015-11-02' OPTION(MAXDOP 1)

IF @@ROWCOUNT > 0 GOTO delete_more
SET ROWCOUNT 0
GO

Dynamics Ax 2012 AdminMode

When you are working with Ax security is Ax ../4.0/2009 you have tried a bunch of times to login as a test user to see if the security is how it should be.

In Dynamics Ax 2012 we have got a way to disable the adminmode for the user you are using, then you can test the security without logout and login as.


static void SEOSOFT_SysAdminModeDisable(Args _args)
{
SecurityUtil::sysAdminMode(false);
}

static void SEOSOFT_SysAdminModeEnable(Args _args)
{
SecurityUtil::sysAdminMode(true);
}

When you have toggled the ad

Værktøj til SQL Server

Drop Column statistics

 

Udgivet den 6. august 2013 af seo

Are you facing suddenly poor performance, try to recreate Columns statistics. SQL Server are using these statistics to decide which execution-plan would be the best.

You always have to run this script when you are upgrading your SQL server from one version to another.

DECLARE ALLNAME CURSOR FOR
Select
t.name FROM sys.stats
INNER JOIN sys.tables t
ON
sys.stats.object_id= t.object_id
WHERE
sys.stats.auto_created <> 0

DECLARE AllStats CURSOR FOR
Select
sys.stats.name FROM sys.stats
INNER JOIN sys.tables t
ON
sys.stats.object_id= t.object_id
WHERE
sys.stats.auto_created <> 0

DECLARE @StatName NVARCHAR(512)
DECLARE @Name NVARCHAR(512)

OPEN AllStats
OPEN ALLNAME

FETCH next FROM AllStats INTO @StatName
FETCH next FROM AllNAME INTO @Name

WHILE @@FETCH_STATUS= 0
BEGIN
EXEC (‘drop statistics ‘+ @Name+’.’+ @StatName)
Print (‘drop statistics ‘+ @Name+’.’+ @StatName)
FETCH NEXT FROM AllStats INTO @StatName
FETCH NEXT FROM AllNAME INTO @Name
END
CLOSE AllStats
CLOSE ALLNAME
DEALLOCATE ALLNAME
DEALLOCATE AllStats
GO