LeaderBoard

How to Call Report from Dynamics AX 2009

After you created your report in AX you can call report from  AX form by follow the below steps:

1- Create menu item with type output by drag and drop report to MenuItems nodes under AOT.

2- Open the form that you need to call report from.

                  Note: the form should be have dataSource with the table in report

3-  Drag and Drop menu Item created in step 1 in the form under any button group.

4- Add the following method to Report

void initFromCaller(Args _args)
{
    str                   QrderId; // field used as Rang and used to filter data
    QueryBuildDataSource  qbds; // should be represent report datasource and selected record in the form

    ;

    if (! _args ||
        ! _args.caller() ||
          _args.dataset() != tablenum(TableName) )
        return;

    QrderId = _args.record().(fieldnum(TableName,FieldName));

    qbds    =  element.query().dataSourceTable(tablenum(TableName));

    if(!qbds.findRange(fieldnum(TableName,FieldName)))
    {
        qbds.addRange(fieldnum(TableName,FieldName)) ;
    }
    qbds.findRange(fieldnum(TableName,FieldName)).value(queryvalue(QrderId));

}

Inventory Closing slow

May The below link lead you to solve Dynamics ax closing slowness issue by creating new indexes in the main tables used in the recalculation and closing process in Dynamics ax.

Inventory Closing slow:

JOB OPPORTUNITY

An Egyptian Group is hiring:

1- AX 2012 R3 Functional Specialist (specially Logistics, Banking, and GL)

2- AX 2012 R3 Junior Developer (X++, MS Visual Studio 2010 or newer, SSRS, MorphX)

Requirements:

+1 years experience in AX 2012 Microsoft certified is a plus

** If interested, please send your CV to: m.anwar@raneen.com.eg

Your email subject should include the Job you are seeking.

Object has not been initialized Erro in Ax 2012

When user open journal lines from GL ---> General journal  ---> Line

got below error

objectnotinitialized

 

Solution:

1- Delete *.auc files from user Machine

2- release Usage data under Tools –> option –> Usage Data ---> reset button

Troubleshooting Report Issues -AX 2012

All of us facing many issues while installing, deployment and customize AX 2012 reports. the Table below include most of troubleshooting of AX reports.

Source : https://technet.microsoft.com/en-us/library/gg731894.aspx

Issue

Additional information for troubleshooting

The report is broken for any reason and the data source is a query.

Execute the query outside of the report. Confirm that the query returns expected results. Use a form, job, or Query Services to test the query. For more information, see Query Service.

The report is broken and the data source is a report data provider (RDP) class.

Debug the class. For more information, see How to: Configure the Debugger to Debug a Report Data Provider Class.

When you preview the report you receive the following error:

No report data table with name <dataset table name> exists in report schema for data provider <RDP name>.

Verify that the report is bound to tables that exist and do not bind multiple datasets to a single report data provider class. Instead, define the report to have the multiple tables pointing to the same dataset.

No data was returned in the report.

Verify you have the right company, that there is data entered for that company, and that the user has access to the expected data.

The report has a rendering error. When you try to run the report, you receive an error like the following:

An error has occurred during report processing.

The SSRS Execution Account password could be invalid.

  1. From the Start menu, point to All Programs, click the Microsoft SQL Server folder, click the Configuration Tools folder, and then click Reporting Services Configuration Manager.
  2. In Reporting Services Configuration Manager, click Connect and then click Execution Account.
  3. Set the password and then click Apply. The account and password should be the same as the Microsoft Dynamics AX proxy account. For more information, see Before you install the Reporting Services extensions.
  4. Click the ServerName/MSSQLSERVER and then click Stop. Then click Start to restart the server. Always check with the SQL administrator and make sure no other users are connected to the server before you restart the server.

The report labels do not display, or the report shows label IDs, like Labels!@SYS24426 instead of the label values.

The SSRS Service Account password could be invalid.

  1. From the Start menu, point to All Programs, click the SQL Server folder, click the Configuration Tools folder, and then click Reporting Services Configuration Manager.
  2. In Reporting Services Configuration Manager click Connect and then click Service Account.
  3. Set the password and then click Apply. The account and password should be the same as the Microsoft Dynamics AX proxy account. For more information, see Before you install the Reporting Services extensions.
  4. Click the ServerName/MSSQLSERVER and then click Stop. Then click Start to restart the server. Always check with the SQL administrator and make sure no other users are connected to the server before you restart the server.

When running a report that uses an enumeration value as a multi-value parameter of a report, you get an error like the following:

The ‘ParameterName’ parameter is missing a value.

Set the Data Type property of the enumeration parameter to Integer.

This is because the label value of enumeration items are converted to name values in theSrsReportDataContractUIBuilder.getMultiSelectFromDialogField method.

When building a report project that uses a SQL report data source, you receive the following error:

The report does not have the mandatory framework parameter AX_ReportContext.

Manually create the AX_ReportContext report parameter. For more information, see Walkthrough: Creating a Report with Parameters.

Time values in a report bound to an AOT query are displayed as h:mm:ss tt in Visual Studio preview and the Microsoft Dynamics AX client instead of the actual time.

Select the field in the report design and set the following properties:

  • Expression property to=Microsoft.Dynamics.Framework.Reports.BuiltInMethods.ConvertAXTimeToDateTime(Fields!timefield.Value)
  • Format String property to hh:mm:ss

An AOS connection error message indicates you cannot establish a connection to the AOS.

To delete, rename, save, or restore a report model element, you must have a connection to the Application Object Server (AOS). If the AOS is disconnected or stops running after a reporting project is opened, an AOS connection error message will display. To continue, restart or restore the connection to the AOS, and then repeat the command that failed.

The Undo command is not functioning in the report model.

In Model Editor, only unsaved commands can be undone. Once a command is saved, it cannot be undone by using the Undo command. To revert a saved command, you must manually modify the report element. If you are using source code control, another option is to discard the file that is checked out if no other changes have been made.

The saved report model customization is not visible in Application Explorer.

Application Explorer does not automatically refresh as Model Editor saves changes to the model store database. To view changes in Application Explorer, right-click the model element, and then click Refresh.

The saved report model customization is not visible in the AOT.

The AOT does not automatically refresh as Model Editor saves changes in the model store database. To view changes in the AOT, in the Development Workspace Tools menu, click Development tools, Application objects, and then Refresh runtime model data.

When previewing a report in Visual Studio you receive the following error:

The %0 parameter is missing a value %1

Verify that you did not create a report with a Labels expression in the Values property of the report parameter. This is not supported because Reporting Services resolves parameter labels after the parameter evaluation and execution occur.

--or--

Verify that you did not set the Allow Blank property to True to make the parameter optional. This is not supported for dataset bound parameters by the reporting framework. The following items identify the alternative approaches for OLTP and OLAP reports:

  • OLTP reports – use an extended data type (EDT) to add a null-value string variable to the drop-down list as a default. When running the report, you can set the parameter value to NULL by not selecting anything from the drop-down list.
  • OLAP reports – add a value All to the drop-down list to indicate that no filtering is to be done by the parameter.

The query for the report was changed but the report does not reflect the change.

After you run the report, the query and ranges are cached in the SRSReportQuery table. To refresh the cache, you must manually delete all records in the SRSReportQuery table for any reports or report parameters that use the query that was changed.

   

Locking or hiding a range for a report parameter is not working. At runtime, the parameter is enabled and the user is able to filter on the range. This occurs when a report is bound to a query that has a range value with a Status property value of Locked or Hidden.

SQL Server Reporting Services does not honor the query range Status property.

The Label reference does not display properly. The Value property is set to theParameters!MyParm.Value parameter.

The parameter must be explicitly bound to data using a dataset in the Visual Studio Tools for Microsoft Dynamics AX report model.

The parameter is explicitly bound to datasets with two columns, label and value. The value displays properly. The Label reference displays properly everywhere except in the client.

The report viewer control does not support the ability to specify report parameter labels, only values.

When you build a Visual Basic project for a report, the project does not build.

-or-

You receive the error “The business logic assembly ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null does not contain a class for report Report1.”

You must clear out the namespace setting of the Visual Basic project. In Solution Explorer, right-click the project, and then clickProperties. In the Application area, delete the text in the Root namespace field.

In Visual Studio, you build a project and receive the error, “System.InvalidOperationException: Object is currently in use elsewhere.”

This error indicates a synchronization issue. Close the solution and then rebuild the report.

When you debug a C# data method, the SQL Server Reporting Services server crashes.

This is a known issue if you are debugging a C# data method on a machine that is running a 64 bit operating system. To work around this issue, open Visual Studio 2008, load the C# file, set the break point, and then attach to the Reporting Services process. For more information, see Debugging Managed Code in Microsoft Dynamics AX.

Reports that run for more than ten minutes time out. For example:

  • If you are previewing a report in Visual Studio and a timeout occurs, you will receive the following error:

Timeout error occured when calling AOS service. Use Dynamics AX Client Configuration Utility to change WCF configuration values. Exception details: The request channel timed out while waiting for a reply after 00:00:59.9449945. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

  • If a user is trying to view a report in the Microsoft Dynamics AX client and a timeout occurs, the user will receive the following error in the InfoLog:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

See Tips to help prevent long-running reports from timing out.

Errors are generated when reports are saved to a file, printed to a printer, or emailed.

View the detailed error messages that are recorded for the Reporting module in the Exceptions form. Click System administration > Periodic > Services and Application Integration Framework > Exceptions.

The same report contains different information when saved to different file formats.

For example, a sales invoice report that is saved to an .HTML file may contain header information, line items, and totals. When the same report is saved to an .XML file, it may contain only the line items and totals.

This is by design. For more information about how reports are rendered in the available file formats, see Exporting Reports (Report Builder 3.0 and SSRS) in the SQL Server documentation.

Users receive the following error when clicking on a drill-through link on a report in Enterprise Portal:

[CompanyName] is not a valid company. Check the value and try again.

This situation may occur when Reporting Services 2008 or Reporting Services 2008 R2 is running in SharePoint integrated mode. To resolve this issue, install Reporting Services 2008 R2 with Service Pack 2.

clip_image001Note

SharePoint integrated mode is supported if you are using Microsoft Dynamics AX 2012 R2 or later.

Tables are not aligned correctly when viewing reports in right-to-left (RTL) languages.

This is a known issue with the Reporting Services tablix control. For more information about the issue, see Known Issue: Dynamic Precision designs spacing issues in RTL languages in the Microsoft Dynamics AX Business Intelligence blog.

The Reporting Services extensions become unusable when additional Reporting Services instances are installed on the same computer. As a result:

  • Reports cannot be deployed.
  • Reports cannot be displayed.

To resolve this issue, configure all the Reporting Services instances on the computer. For more information about how to install and configure multiple instances of Reporting Services on the same computer, see Install multiple instances of Reporting Services on the same computer (for use with Microsoft Dynamics AX).

When printing a report that has been saved as a PDF file, the printer page size does not correspond to the PDF page size.

To resolve this issue, select the Choose paper source by PDF page size check box in the Print window that is displayed when printing the report to the printer.

When using an environment that includes a hardware load balancer, such as F5, reports that run for more than five minutes time out.

To resolve this issue, adjust the timeout period specified in the hardware load balancer. For example, if you are using F5, set theIdle Timeout field to 7200 seconds or higher. For more information, see the F5 Knowledge Base.

You need to adjust the alignment of a report.

For tips on adjusting the alignment, see this blog post: SSRS report tips to adjust alignment for pre-formatted print stock (i.e. 1099-MISC form).

Running AX report through batch job in AX2009 (batch printing)

Running batch report in AX2009 (batch printing)

Since the change of AX2009 batch framework, printing of report through batch can be done through two methods:
- Printing from server (to printer or file)
- Printing from client (the legacy batch processing)
Prerequisites: For both of the method, there're some mandatory setup:

  1. Enable any of the AOS that you want to make it as batch AOS
    (Administration -> Setup -> Server configuration)
  2. Create batch group for printing.
    Eg. One for client printing and one for server printing.
    (Administration -> Setup -> Batch groups)
  3. Add the batch group created in #2 into the AOS enabled for batch processing (in #1)

complete article available here

Dynamics AX Workflow types - AX 2012

To create a workflow, you must first select the type of workflow that you want to create. This topic lists the types of workflows that you can create in each module. The topic also describes what each type of workflow is used for, and whether the workflows of each type are associated with a specific company in the organization or with the whole organization.

https://technet.microsoft.com/en-us/library/dd362043.aspx

Data Import/Export Framework error

Troubleshoot issue with a Data Import/Export Framework installation from cumulative update 7 for Microsoft Dynamics AX 2012 R2

After you install cumulative update 7 for Microsoft Dynamics AX 2012 R2, the Data Import/Export Framework appears to be installed, but you receive error messages when many forms are opened like the following:

You receive an “Assembly containing type Microsoft.Dynamics.AX.DMF.ServiceProxy.DmfEntityProxy is not referenced.” error

Reason: When you install cumulative update 7 for Microsoft Dynamics AX 2012 R2, the Data Import/Export Framework appears to be installed for members of the System Administrators role. However, the binary components of the framework are not present.
Solution:

please click here to get solution

Regular maintenance activities in Dynamics AX that affect performance

The following list describes some of the maintenance activities that we recommend that you perform regularly in your production environment:
  • Defragment indexes – You can defragment indexes from either SQL Server Management Studio or the Intelligent Data Management Framework (IDMF).

  • Update SQL Server statistics from SQL Server Management Studio – We recommend that you run both manual and automatic updates of statistics. Manual updates may become more important as the size of your database increases, because automatic updates are less likely to be completed on large data sets.

  • Reduce the size of the database – You can use IDMF to keep the size of the production database small. A small database makes database operations more efficient. For example, you can delete or archive data that is not required in your production system.

Troubleshoot an installation of the Data Import/Export Framework from InformationSource

This post describes how to troubleshoot issues with a Data Import/Export Framework installation from InformationSource.

The Data Import/Export Framework does not compile

After you install the Data Import/Export Framework, if you cannot compile, validate that the Data Import/Export Framework was installed correctly.

  1. Verify that the Microsoft Dynamics AX Data Import/Export Framework service is running.

  2. Verify that the Data Import/Export Framework DLLs are present in C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin folder:

    • Microsoft.Dynamics.AX.DMF.Mapper.dll

    • Microsoft.Dynamics.AX.DMF.PreviewGrid.

    • Microsoft.Dynamics.AX.DMF.ServiceProxy.dll

    • DMFConfig.xml

    • Microsoft.Dynamics.AX.DMF.DriverHelper.dll

Resolution

Copy the DLLs from the installation location (C:\Program Files\Microsoft Dynamics AX 2012 Data Import Export Framework Client Component) to the C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin folder.

Exception message while you use Data Import/Export Framework

While you use the Data Import/Export Framework, you might receive the following error message:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException

Verify that the following files are present in the C:\Program Files (x86)\Microsoft Dynamics AX\60\Server\Bin folder on the server that is running the AOS instance:

  • DMFConfig.xml

  • DMFClientConfig.xml

  • Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config

Resolution

Copy the .xml and the config files from the installation location (C:\Program Files\Microsoft Dynamics AX 2012 Data Import Export Framework Server Component) to the C:\Program Files (x86)\Microsoft Dynamics AX\60\Server\Bin folder on the server that is running the AOS instance.

Changes to the location of the Data Import/Export Framework service

If you have to update the location where you run Integration Services and the Data Import/Export Framework service, you can update the endpoint address in the Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config file to use the new server name.

<endpoint address="http://<<NEW MACHINE NAME>>:7000/DMFService/DMFServiceHelper.svc"

NoteNote

The Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config file is located in the C:\Program Files (x86)\Microsoft Dynamics AX\60\Server\Bin folder on the server that is running the AOS instance.

12 Ways to Improve Your Productivity at Work

image

 

Between constant meetings, phone calls and emails, staying productive at work can be a challenge. However, the odds of staying productive can be greatly improved by taking some simple steps in order to stay efficient.

Here are 12 tips from the Bayt.com team to help you to make the most of your time at work:

1. Don’t let emails take over your day

We are all so accustomed to email that as soon as we see a new email in our inbox we instinctively click it on, focus on the content of the email, and respond. These seemingly tiny activities during the day can quickly add up to large amounts of time that not only cause your day to slip away, but also distract you from completing your current task.

If replying to or disposing of an e-mail takes less than two minutes, do it right away. Send less to receive less: Keep your e-mails short, and write fewer of them. Here are some tips from the career experts at Bayt.com to help you control your work emails.

2. Eliminate unnecessary meetings

Face-to-face communication is essential (email is fraught with misinterpretation), but be ruthless about protecting your time. Avoid every meeting that isn’t truly necessary.

3. Learn how to say ‘no’

While everyone wants to be a good team player at work, saying ‘no’ is sometimes the right thing to do. If you are not the best person for a task, or if you have other pending deadlines, it is OK to turn down a work request.  read more

The administration of number sequences – AX 2012

The administration of number sequences is performed by using actions provided in the Administration group on the action pane on the Number sequences list page.

Organization Administration –> Common –> Number Sequences ---> Number Sequences

image

  • Status list

Provides a list of numbers that have been generated for continuous number sequences, but which have not been committed to the database. The numbers are either currently being used in a user session, are reserved for future use in a user session, or are free for use if a new client user session requests a new number for a particular number sequence in the list. If a new number does not exist for a specific continuous number sequence, it is generated by the sequence number framework from the next value for that number sequence in the Number sequence table (NumberSequenceTable).

image

  • Manual cleanup

Allows the administrator to manually clean up numbers in the status list. Use of this option is only recommended after an unexpected system failure; in such rare circumstances, numbers might not be automatically cleaned up.

image

  • History

Provides the history of changes to the number sequences themselves.

image

 

A number of administrator tasks can be performed from the Details page. An administrator can, for example, schedule an automated periodic cleanup for every number sequence by entering intervals on the Automatic cleanup FastTab as displayed in image below

image

An administrator can also assign number sequences by using a page in the parameters forms in individual application modules. For example, you can view or assign the number sequences to specific references in the General ledger module. You can navigate to the form by using the path General ledger > Setup > Parameters.

clip_image001

How to reset TTSBegin/TTSCommit in AX

We are using TTSBegin and TTSCommit when update and create a record in AX, but some times an error is occurred  and through an exception.

If we did not abort TTS by using TTSAbort  statement between try and catch keyword as below

try

{

ttsBegin;

// your update code

ttsCommit;

}

catch

{

ttsAbort;

}

so we may facing this error below,

To fix this error please run the following job

static void ResetTTS(Args _args)
{
    while (appl.ttsLevel() > 0)
    {
        info(strfmt("Level %1 aborted",appl.ttsLevel()));
        ttsAbort;
    }
}

Make sure that the X++ code has been compiled to Microsoft .NET Framework CIL - AX Batch Error

I developed custom class which extend RunBaseBatch system class to run in server, After created my class and run the class though batch job, there is an error is occurred and got the following error in log.

"Unable to construct an object from the class Sample Class in the batch framework. Make sure that the X++ code has been compiled to Microsoft .NET Framework CIL, and that the constructor does not require any parameters"

After search through internet I got solution by run “Generate incremental CIL” as  displayed below

image

Hint: May it takes time depend on server configuration.

Performance considerations for number sequences in Dynamics AX

Consider the following information about how the configuration of number sequences can affect system performance before you set up number sequences.

Continuous and non-continuous number sequences

Number sequences can be continuous or non-continuous. A continuous number sequence does not skip any numbers, but numbers may not be used sequentially. Numbers from a non-continuous number sequence are used sequentially, but the number sequence may skip numbers. For example, if a user cancels a transaction, a number is generated, but not used. In a continuous number sequence, that number is recycled later. In a non-continuous number sequence, the number is not used.

Continuous number sequences are typically required for external documents, such as purchase orders, sales orders, and invoices. However, continuous number sequences can adversely affect system response times because the system must request a number from the database every time that a new document or record is created.

If you use a non-continuous number sequence, you can enable Preallocation on the Performance FastTab of the Number sequences form. When you specify a quantity of numbers to preallocate, the system selects those numbers and stores them in memory. New numbers are requested from the database only after the preallocated quantity has been used.

Unless there is a regulatory requirement that you use continuous number sequences, we recommend that you use non-continuous number sequences for better performance.

Automatic cleanup of number sequences

In case of a power failure, an application error, or other unexpected failure, the system cannot recycle numbers automatically for continuous number sequences. You can run the cleanup process manually or automatically to recover the lost numbers.

Carefully consider server usage when you plan the cleanup process. We recommend that you perform the cleanup as a batch job during non-peak hours.

How to pass parameter to SSRS report from Dynamics AX

The below code for Passing parameters to SSRS using X++ code.

 

    MenuFunction SSRS_MyReport;

    Args Args;

    str parmId ="";

    ;

   // create reference to menu item “OverTime” which is in AOT
    SSRS_MyReport = new MenuFunction(menuItemOutputStr(OverTime),MenuItemType::Output);

    Args = new Args();

    // Set parameters and parameter value
    // I have 3 Parameters Nationality, EmplGroup, PeriodID

    parmId = "Nationality=KSA&EmplGroup=HERD&PeriodID=2014_05";

    // Assign parameters to report
    Args.parm(parmId);

    // Run the report
    SSRS_MyReport.run(Args);

 

 

Notes:

1- Parameters name is case sensitive, so it should set name as predefined in report.

2- You can pass more than one parameters by add “&”   between each parameter.

3- Not add space between parameters, it cause an error

Recalculation Error Dynamics AX 2009

while running inventory recalculation process, I got this error

“Cannot edit a record in stock transactions (InventTrans) An update
conflict occurred due to another user process deleting the record or changing
one or more fields in the record"

solution to avoid this error, go to AOT –> DataDictionary –> Tables ----> InventTrans

right click on table to display properties window then change OccEnabled property to No.

then resume recalculation again, it will work successfully.

image

Configuring the instance of SQL Server for Dynamics AX

Improve SQL performance lead us to optimize AX performance, this post is one of posts to achieve that

1- Configuring max degree of parallelism

The max degree of parallelism option is a setting that affects the entire instance of SQL Server. Microsoft Dynamics AX workloads generally perform better when intra-query parallelism is disabled. However, the upgrade process benefits from parallelism, as do activities that are used exclusively for batch jobs or maintenance. Use the following settings when the system performs maintenance activities or an upgrade:

· Before an upgrade to a new release of Microsoft Dynamics AX, or before a large number of maintenance or batch activities, set max degree of parallelism to the smallest of the following values:

· 8

· The number of physical processor cores

· The number of physical processor cores per non-uniform memory access (NUMA) node

· When the Microsoft Dynamics AX database is used in a production environment, set max degree of parallelism to 1.

Use the following statements to set the value of max degree of parallelism.

Examine the output from the second sp_configure 'max degree of parallelism' statement, and confirm that the value has been changed. In the following query, the first sp_configure 'max degree of parallelism' statement sets the value of max degree of parallelism to 1. The second sp_configure 'max degree of parallelism' statement returns a value of 1.

EXEC sp_configure 'show advanced options', 1;

RECONFIGURE;

GO

EXEC sp_configure 'max degree of parallelism', 1;

RECONFIGURE;

GO

EXEC sp_configure;

For more information, see max degree of parallelism Option. For general guidelines, see Knowledge base article 329204, General guidelines to use to configure the MAXDOP option. For tips from the SQL Server team, visit the SQL Server Relational Engine team's blog, SQL Server Engine Tips.

2- Configuring max server memory

SQL Server dynamically acquires and frees memory as required. Typically, an administrator does not have to specify how much memory is allocated to SQL Server. However, the max server memory option can be useful in some environments. Make sure that sufficient memory is available for the operation of Windows Server. For more information, see Configure SQL Server and storage settings, later in this topic.

If you find that the dynamic allocation of memory adversely affects the operation of Windows Server, adjust the value of max server memory based on the available random access memory (RAM). For more information, see Effects of min and max server memory.

3- Monitoring available memory

Make sure that sufficient memory is available for the operation of Windows Server. For example, make sure that you run a dedicated instance of SQL Server on a server that has at least 4 gigabytes (GB) of memory. If the available memory for the server drops below 500 megabytes (MB) for extended periods, the performance of the server may degrade.

Use the Memory: Available Mbytes performance counter for the Windows Server operating system to determine whether the available memory drops below 500 MB for extended periods. If the available memory drops below 500 MB frequently or for extended periods, we recommend that you reduce the max server memory setting for SQL Server or increase the physical memory of the server.

Detailed guidance about memory management is beyond the scope of this topic. For more information about how to monitor memory and troubleshoot performance issues, see the Windows Server and SQL Server documentation.

4- Allocating storage for tempdb

We recommend that you determine the total size of the data files and transaction log files that are required for the tempdb database, and that you set a specific value. Do not use automatic growth, or autogrow, setting for space management. Instead, use autogrow as a safety mechanism, so that tempdb can grow if tempdb files use the space that was originally allocated to them. Follow this process to determine the number and placement of data files.

· Determine the number of processors that are available to SQL Server. Unless you are using an affinity mask, this number is same as the total number of processors that you see on the Performance tab of Windows Task Manager. When hyperthreading is not enabled, each processor corresponds to a processor core. Affinity masks and processor cores are beyond the scope of this topic. For more information, see the Windows Server and SQL Server documentation.

· Based on performance testing of the OLTP workload for Microsoft Dynamics AX, we recommend that you maintain one tempdb data file per processor. For more information, see the performance benchmark reports on PartnerSource or CustomerSource.

· Isolate tempdb on dedicated storage, if you can. We recommend that you move the primary data file and log file for tempdb to high-speed storage, if high-speed storage is available. The Microsoft Dynamics AX database runs in read committed snapshot isolation (RCSI) mode. In RCSI mode, row versions are stored in tempdb. By creating multiple files for tempdb data, even if these files reside on the same storage device, you can improve the performance of tempdb operations.

· Determine the size of the tempdb data files and log files. You must create one primary data file and one log file. Determine how many additional, secondary data files you require for the tempdb data. For best results, create data files of equal size. The total number of data files must equal the total number of processor cores. The aggregate size of the primary data file and all other data files must equal the total data size that you determined for the tempdb database.

For more information, see Optimizing tempdb performance.

· Resize the primary data file and log file for tempdb. Move the primary data file and log file to dedicated storage, if dedicated storage is available. The primary tempdb data file cannot be moved while the instance of SQL Server is running. To complete the move, you must use an ALTER DATABASE statement and restart the instance of SQL Server. For more information, see ALTER DATABASE.

Note: The data files and transaction log files for tempdb can reside on the same storage device.

· If space is available on the drive where tempdb files are allocated, do not configure the autogrow property for data files and log files as a percentage. Instead, configure the autogrow property as a specific number of megabytes. If you can, configure the data files and log files to grow by 100 to 500 MB, depending on the available space. Monitor the data files, and when they grow, adjust the original allocation to prevent automatic growth later. If the autogrow property is configured in megabytes instead of as a percentage, the allocation of space is more predictable, and the chance of extremely small or large growth increments is reduced.

· Monitor the tempdb data files and log files to make sure that they are all sized correctly, and that all data files are of equal size. Use SQL Server Management Studio or a transact-SQL query to view the database properties. Verify that all the data files are of equal size, and that they have the same size as the value that you originally provided. If one or more files have grown, adjust the initial size of all files.

Configuring physical storage for SQL server of Dynamics AX

This post provides general recommendations for physical storage. Determine the applicability of these recommendations to your environment. Some storage area network (SAN) vendors may have alternative recommendations that take precedence. Recommendations are listed in order of priority.

  • Many factors contribute to optimal I/O performance for a disk. By default, Windows Server 2008 aligns partitions. When you upgrade to Windows Server 2008, preexisting partitions are not automatically aligned and must be manually rebuilt to guarantee optimal performance. Therefore, until you rebuild the migrated partitions, alignment of disk partitions remains a relevant technology.

Check existing disks on the server, and be aware of the differences in the analysis of basic partitions and dynamic volumes. Rebuild the partitions, if you can, and appropriate and create all new partitions based on guidance from the SAN vendor. If the vendor does not provide recommendations, follow the best practices for SQL Server. See Disk Partition Alignment Best Practices for SQL Server.

The partition offset value must be a multiple of the stripe size. In other words, the expression, partition offset / stripe size, must resolve to an integer value.

  • Create the tempdb database files, data files for the Microsoft Dynamics AX database, and Microsoft Dynamics AX log files on disk arrays of type RAID 1, RAID 0 + 1, or RAID 10. We recommend RAID 10 for these files. Do not use RAID 5.
  • Store the data files for the Microsoft Dynamics AX database on separate physical stores from the transaction log files.
  • Store the tempdb data files on a separate physical store from the data files and log files for the Microsoft Dynamics AX database.
  • Store other database files on separate physical stores from the data files and log files for tempdb and the Microsoft Dynamics AX database.

Tune data access settings [AX 2012]

You might want to tune the database settings for Microsoft Dynamics AX to improve performance. Settings that you can tune include connections, query settings for the use of literals, string functions, or hints, concurrency mode used for database changes, and the table and index options, such as table and index data compression, and index fill factor and sort in tempdb settings.

Before changing settings, you should trace the usage of your Microsoft Dynamics AX database to ensure that you have clear understanding of performance under the current settings.

Test all tuning changes before implementing them in a production environment. In a test or development environment, make a single change and then test your system's performance before making another change.

Tune connections

The following table lists common connection issues, and also some adjustments to try in the Server Configuration Utility.

Symptom

Adjustments to try

Queries that return a large number of rows execute slowly.

Increase the Maximum buffer size value in small increments.

If this adjustment has worked, the number of round trips to the database, as measured in Performance Monitor by a decrease in the value of SQL Server statistics: batchrequestsPerSecond value. Stop increasing the value when the rate of improvement diminishes.

You may also want to change the Maximum buffer size value if you receive an error similar to the following:

The total, internal size of the records in your joined Select statement is 29374 bytes, but Microsoft Dynamics is by default performance-tuned not to exceed 27646 bytes. It is strongly recommended that you split your tables(s) into smaller units.

Maximum buffer size refers to the size of buffer the kernel allocates for holding input/output data to and from SQL Server. The buffer can be used to hold more than one row of the entire result set for output binding, and it should be allocated large enough to hold at least one row. The buffer size needed for one row depends on the number of tables joined (exist join excluded) and the size of the aggregated table columns. When large numbers of joins are used, or wide tables, a customer may encounter the issue that the maximum buffer size is less than the space needed to hold one row of the result set.

Due to the way the kernel handles data binding, the aggregated table column size is always the width of the entire table. Therefore, attempting to resolve the issue by limiting the field projection list does not help. You can fix the issue by rewriting the join, or by increasing the Maximum buffer size value.

Because large joins and wide rows may lead to performance issues, we use this limit to catch performance issues and ask customers to rethink their joins.

Results for ad hoc queries are returned slowly

Verify that the appropriate indexes are in place.

Tune queries

If queries in the system are running slowly, you may want to change settings for literals, string functions, or hints.


Adjust the use of hints

In Microsoft Dynamics AX, you can allow developers to override the index selected by the query optimizer. In most situations, allowing the query optimizer to select an index for a query results in improved performance.

Changes in the use of hints

The following changes to hints have been made:

· The OPTION (FIRSTFAST) hint is applied by default for form data sources. It can be suppressed, or set to a specific value. Use of this option appends an OPTION (FAST) to the SQL Server query.

· OPTION( FAST) is now set to what we expect the number of rows to be returned to the database in a single roundtrip. This is based on maximum buffer size.

· FASTFORWARD cursors are used for all user queries unless the query is a full text search.

Change table and index options

Table and index options that can be changed from within Microsoft Dynamics AX include table compression settings, and index compression, fill factor, and sort in tempdb settings.

Data compression options

If you have appropriate hardware, we recommend that you set all tables and indexes to use page-level compression. Compression saves disk space and memory consumption, but increases CPU consumption.

When page-level compression has been set, expect between 10-15 percent additional CPU consumption.

If you are concerned about CPU consumption, we recommend that you start by setting the ten largest tables in your system to use table compression.

Use the guidance in the following resources to help you determine how or whether to compress your tables and indexes:

· SQL Server Books online: Creating Compressed Tables and Indexes

· SQLCat article: Data Compression: Strategy, Capacity Planning and Best Practices

· Database Engine team blog post: Compression Strategies.  

Fill factor options

We recommend that you not set the fill factor options (fill factor and pad index) for all indexes. Only set fill factor values on indexes that show rapid fragmentation, where fragmentation has a performance penalty. Adjusting fill factor can be important for tables that you want to retrieve sequential rows from, for example, sales line.

We recommend that you work with your database administrators to identify the tables to set this value for.

Sort in tempdb

We recommend that you not set the sort in tembdp options for all indexes. Only enable sort in tempdb for indexes that show rapid fragmentation, where fragmentation has a performance penalty.

We recommend that you work with your database administrators to identify the tables to set this value for.

To change table and index options

1. Click System administration > Periodic > Database > SQL administration. Select all tables, all indexes, or a specific table or index, and then click Table and index options.

2. Select the options to set, and then click Save.

The SQL statement that will be executed is displayed at the bottom of the form.

clip_image001Important

The changes that you have made will not be applied unless you specify that they should be applied by using the SQL administration form.

To turn off data compression, click Enable compression, click None for the type of compression, and then close the Select table and index options form, and then click Apply compression in the SQL administration form.

3. To apply changes in the SQL administration form:

o For tables, click Table actions, and then click Apply compression.

o For indexes, click Index actions, and then click Reindex.

Change the concurrency mode

Concurrency mode settings enable you to reduce locking conflicts in your system. Set concurrency mode settings only at the table or statement level, not throughout your Microsoft Dynamics AX program.

Optimistic concurrency

An optimistic concurrency strategy does not lock data when the data is retrieved from the database for future modification. Therefore, no locks are held while filters and other business logic are being applied. Data is locked only when an update is performed. If any data has been changed by another transaction between the time of the retrieval and the time of the update, the change is detected and an Infolog exception is displayed.

Pessimistic concurrency

A pessimistic concurrency strategy uses an update lock to lock data when the data is retrieved from the database for future modification. Locks are held while filters and other business logic are being applied, in addition to being held during an update. Data cannot be changed by other transactions.

Acquiring an update lock for a large volume of rows increases the lock escalation from row level to table level in SQL Server. This can block other users and reduce transaction throughput.

Table-level concurrency settings

If the global concurrency mode is set to Optimistic concurrency mode enabled per table, table-level control of concurrency settings is available using the OccEnabled property.

Runtime update options

If you are encountering many update errors, you may want to use the runtime update options to help troubleshoot. These options are intended for temporary use only, as they might significantly slow performance.

Use Writes all UPDATE conflict exceptions to the log to write all update conflict exceptions to the log.

Use Update record version automatically to have Microsoft Dynamics AX search in memory for the recordID every time that that a record is updated, and then change the update values in all instances of the record.

If you have a table set to optimistic concurrency, and you are experiencing optimistic concurrency violations that affect the performance of the transactions that use the table, then first set the Writes all UPDATE conflict exceptions to the log option. If, from your analysis, it appears that the use of optimistic concurrency is causing a problem, then set the table to pessimistic concurrency.

To change concurrency settings

1. Click System administration > Setup > Database > Select concurrency mode.

2. Select the appropriate concurrency mode and runtime options for your environment.

3. Click Close.

Statement-level concurrency settings

You can use the optimisticlock or pessimisticlock keywords in a SELECT statement to override the global or table concurrency mode settings.

For more information, see the following topics:

· Best Practice Performance Optimizations: Database Design and Operations

· Transaction Integrity

· Exception Handling with try and catch Keywords

· Select Statement Syntax

· Table Properties