Wednesday, April 27, 2016

SQL Database restoration Issue

In the past couple of days, after restoring my database I was been experiencing unexpected shutdown occurrences in SQL and non responsive AOS service

In event log I was getting following error

sqlservr (3160) An attempt to open the file "C:\Windows\system32\LogFiles\Sum\SystemIdentity.mdb" for read / write access failed with system error 5 (0x00000005): "Access is denied. ".  The open file operation will fail with error -1032 (0xfffffbf8).

and

sqlservr (3160) Database recovery/restore failed with unexpected error -1032.

Solution for this was in KB Artical

https://support.microsoft.com/en-gb/kb/2811566

To work around this problem, add read/write permissions manually to the service accounts that are used by SQL Server (sqlservr.exe) and SQL Server Analysis Services (msmdsrv.exe) to access the \Windows\System32\LogFiles\Sum folder.

Thursday, April 14, 2016

After installing client on Windows 8.1 it crashes

During client installation we faced a issue when AX client gets crashed every time we try to start AX and the client terminates on startup after some investigation we found that is was Intel graphics drivers which were causing issue to fix this you need to Update the graphics driver to the most recent version available

Sunday, April 3, 2016

Clear your AUC files for All user.

Clear your AUC files for All user.

# Create array containing all user profile folders 
$colProfiles = Get-ChildItem "C:\Users\" -Name
$colProfiles = $colProfiles -ne "Public"
# Removes AUC files from each user profile folder 
ForEach ( $objProfile in $colProfiles ) 

    Get-ChildItem "C:\Users\$objProfile\AppData\Local\*.AUC" -force | remove-item -force
}


if you just want to clear the one user go to the following

c:\users\username\AppData\Local and clear anything ending with .AUC

AXReportInstanceExtensions COMException error message while trying to install the AX Report instance extensions through PowerShell.

AXReportInstanceExtensions COMException error message while trying to install the AX Report instance extensions through PowerShell.


Install-AXReportInstanceExtensions :
In line:1 char:1
+ Install-AXReportInstanceExtensions -ReportServerInstanceName DAXTest -Credential  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (Microsoft.Dynam...tensionsCommand:InstallReportInstanceExtensionsCommand) [I
   nstall-AXReportInstanceExtensions], COMException
    + FullyQualifiedErrorId : Microsoft.Dynamics.AX.Framework.Management.Reports.InstallReportInstanceExtensionsComman
   d

 To solve this issue you need to start the powershell as administrator and try again.

SQL Script to change logical File name for Dynamics AX Data restore

1.  Detach Database First 

USE [master]
ALTER DATABASE [OLDAXBaseline]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
EXEC master.dbo.sp_detach_db @dbname = N'OLDAXBaseline'


USE [master]
ALTER DATABASE [OLDAX]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
EXEC master.dbo.sp_detach_db @dbname = N'OLDAX'


USE [master]
ALTER DATABASE [OLDAX_model]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
EXEC master.dbo.sp_detach_db @dbname = N'OLDAX_model'

2.  Rename Database MDF and LDF files manually

3.  Create new database and Attached Manually renamed Files 

USE [master]
CREATE DATABASE AXBaseline ON
( FILENAME = N'C:\\DATA\AXBaseline.mdf'),
( FILENAME = N'C:\\DATA\AXBaseline_log.LDF')
 FOR ATTACH

USE [master]
CREATE DATABASE AX ON
( FILENAME = N'C:\\DATA\AX.mdf'),
( FILENAME = N'C:\\DATA\AX_log.LDF')
 FOR ATTACH

USE [master]
CREATE DATABASE AX_model ON
( FILENAME = N'C:\\DATA\AX_model.mdf'),
( FILENAME = N'C:\\DATA\AX_model_log.LDF')
 FOR ATTACH

4.  Change logical file name 

USE [AXBaseline]
ALTER DATABASE [AXBaseline]
      MODIFY FILE (NAME=N'OldAXBaseline', NEWNAME=N'AXBaseline')
ALTER DATABASE [AXBaseline]
      MODIFY FILE (NAME=N'OldAXBaseline_log', NEWNAME=N'AXBaseline_log')

USE [AX]
ALTER DATABASE [AX]
      MODIFY FILE (NAME=N'OldAX', NEWNAME=N'AX')
ALTER DATABASE [AX]
      MODIFY FILE (NAME=N'OldAX_log', NEWNAME=N'AX_log')

USE [AX_model]
ALTER DATABASE [AX_model]
      MODIFY FILE (NAME=N'OldAX_model', NEWNAME=N'AX_model')
ALTER DATABASE [AX_model]

      MODIFY FILE (NAME=N'OldAX_model_log', NEWNAME=N'AX_model_log')