Recovery of Microsoft Dynamics NAV 2002 R2 and SQL Server
Ivaj O'Franc

Ivaj O'Franc @ivajofranc

About: IT Engnr. 30y exp solving messy real-world IT problems with a mix of logic, luck and AI. No buzzwords, no fluff—just honest fixes, clear insights, and the occasional "I have no idea how this worked."

Joined:
Aug 2, 2025

Recovery of Microsoft Dynamics NAV 2002 R2 and SQL Server

Publish Date: Aug 18
0 0

Recovery of Microsoft Dynamics NAV 2009 R2 and SQL Server

🇪🇸 Leer este post en español

🧩 Original Environment

  • ERP: Microsoft Dynamics NAV 2009 R2 (version 6.00.32012)
  • Database: SQL Server 2008 R2 Express (32-bit)
  • Server: Windows Server 2022 Datacenter (virtual machine)
  • NAV Client: Classic and RTC
  • Database restored: Existing .mdf and .ldf files from the previous instance

⚠️ Issues Found

  1. SQL Server 2008 R2 x86 did not start

Key ERRORLOG messages:

  • TDSSNIClient initialization failed with error 0x139f
  • Unable to initialize SSL support
  • security.dll missing or corrupt

Dependency Walker showed multiple missing dependencies (API-MS-WIN-CORE-*).

  1. Repair and installation of SQL Server 2014 failed

The installation returned errors in critical services (Database Engine, Reporting Services, etc.).

After repair and reboot, the service could not start due to encryption errors (schannel.dll, bcrypt.dll, etc.).

  1. SQL Server 2014 started but with severe errors

It searched for .mdf and .ldf files in internal build paths like:

   E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\
Enter fullscreen mode Exit fullscreen mode

This caused the service to shut down automatically.


🔄 Change of Strategy

The following steps were decided:

  1. Completely uninstall SQL Server 2014.
  2. Install SQL Server 2008 R2 (x64).
  3. Manually restore the databases from the .mdf and .ldf files.

🔧 Actions Taken

SQL Server

Executed:

CREATE DATABASE [DBName]
ON (FILENAME='...mdf'), (FILENAME='...ldf')
FOR ATTACH;
Enter fullscreen mode Exit fullscreen mode

Confirmed data paths in:

C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA


NAV and Extended DLL

  • Copied xp_ndo_x64.dll into C:\Windows\System32.
  • Executed:
EXEC sp_addextendedproc 'xp_ndo_enumusergroups', 'xp_ndo_x64.dll';
Enter fullscreen mode Exit fullscreen mode

NAV License

  • Loaded manually from the Classic client: Tools > License Information > Import
  • The old license only allowed 2 companies. After importing the correct license, this was fixed.

🔐 Permissions and Errors Fixed

Initial errors:

xp_ndo_enumusergroups – access denied

VIEW SERVER STATE – required by the NAV client

Solution:

-- For a specific user
GRANT EXECUTE ON xp_ndo_enumusergroups TO [DOMAIN\user];
GRANT VIEW SERVER STATE TO [DOMAIN\user];

-- Or for all users:
GRANT EXECUTE ON xp_ndo_enumusergroups TO [public];
GRANT VIEW SERVER STATE TO [public];
Enter fullscreen mode Exit fullscreen mode

🧪 Connectivity from NAV Client

  • Classic client connected successfully from the server.
  • From other machines, it failed due to:

    • Closed port
    • SQL Browser service stopped
    • User without permissions

Checked configuration and confirmed client used:

SERVER:7046/DynamicsNAV
Enter fullscreen mode Exit fullscreen mode

Instance was accessible after fixes.


✅ Final Result

  • Complete recovery of SQL Server 2008 R2 x64 instance.
  • NAV runs correctly from Classic and RTC clients.
  • All databases restored with their original license and fully functional users.

📁 Files Used

  • NAV2009R2_Data.mdf / NAV2009R2_log.ldf (NAV database)
  • xp_ndo_x64.dll (required extended procedure)
  • .flf NAV license file

🛠️ Recommendations

  • Always back up .mdf, .ldf, and .flf license files.
  • Document the exact recovery process for future failures.
  • Avoid newer SQL Server versions with NAV 2009 unless compatibility is guaranteed.
  • Ensure ports and services (SQL Browser, SQL Server) are always active.

Comments 0 total

    Add comment