Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

NAV2016 on Azure SQL Database

$
0
0
Hi,

It would be nice if someone could confirm these findings.
I wanted to deploy a customer's NAV 2016 CU1 database (1.5GB in size, with 10 companies) on the Azure SQL Database. The customer is based in East Asia, so I created an Azure SQL Server in that location. The next bit was to deploy the database on the Azure SQL Server.

1. I tried with the option from SQL Studio Manager, "Deploy Database to Windows Azure".
After some time I got following error message
Unable to reconnect to database: Timeout expired.  The time-out period elapsed prior to completion of the operation or the server is not responding. (Microsoft.Data.Tools.Schema.Sql)

I increased the timeout in SQL Studio Manger and tried again but again the same message.
I created a VM machine in East Asia and I tried from there and the same error message.
So I gave up on this option.

2. Export Data-tier application or BACPAC file, this option seems to be very popular in Microsoft presentations so I thought let's give it a go. I started the process and very quickly I got following error message
Validation of the schema model for data package failed.
Error SQL71561: Error validating element [dbo].[DeleteActiveSession]: Trigger: [dbo].[DeleteActiveSession] has an unresolved reference to object [NAV W1 2016 ].[dbo].[Session Event]. External references are not supported when creating a package from this platform.
Error SQL71561: Error validating element [dbo].[RemoveOnLogoutActiveSession]: Trigger: [dbo].[RemoveOnLogoutActiveSession] has an unresolved reference to object [NAV W1 2016].[dbo].[Session Event]. External references are not supported when creating a package from this platform.
 (Microsoft.SqlServer.Dac)

The database used was upgraded at some time in the past from NAV2009 to NAV2013R2 and then to NAV 2016 CU1.
In NAV 2013 R2 the table Session Event has two triggers defined as
[NAV W1 2016].[dbo].[Session Event] which is not external reference but still BACPAC process did not like it,
so I changed the two triggers by running
ALTER TRIGGER [dbo].[DeleteActiveSession] ON [dbo].[Session Event] ...
ALTER TRIGGER [dbo].[RemoveOnLogoutActiveSession] ON [dbo].[Session Event] ...
This resolved this issue but my luck did not last very long. The next error message was
Error SQL71564: The element User: [NT AUTHORITY\NETWORK SERVICE] has property AuthenticationType set to a value that is not supported in Microsoft Azure SQL Database v12.

After some investigation, I realised that NETWORK SERVICE does not exist on the Azure SQL Server hence the error message. I deleted the entry for NETWORK SERVICE from the database users.

Started BACPAC export again, and I got another error message
Error SQL71564: The element Filegroup: [Data Filegroup 1] is not supported when used as part of a data package (.bacpac file).

It is funny that all databases until NAV 2016 were created with three files
MDF - file that stored structure of the tables,
NDF - file that stores table data. The NDF file is setup by default to go to Filegroup 1.
LDF - the transactional log file.

I think it is a bug that when you create a new NAV 2016 database it will create a NDF file on the Filegroup 1, which means you cannot deploy it with BACPAC export.

To remove a fielgroup is a very painful process, so I created a new database with MDF and LDF files only (no filegroups) and copied the data.

So I tried the BACPAC export again, and I got another error message
Error SQL71564: Element Index: [dbo].[Co_ Cr$Payment Buffer].[$1] has an unsupported property FillFactor set and is not supported when used as part of a data package.

After some investigation I found out that Azure SQL server does not support indexes where Fillfactor, Sort in Temdb or Pad index parameter is set.
The problem is that you cannot remove it either as SQL Server does not allow you to set these parameters to 0, and only 0 is accepted. So if you have an SQL Server where Fillfactor is set you won't be able to deploy this database with BACPAC on Azure.

4. SQL Database Migration Wizard (SQLAzureMW)
After some research I found this program that should help to migrate the database on Azure SQL Server.

http://sqlazuremw.codeplex.com/
https://azure.microsoft.com/en-gb/blog/migration-cookbook-now-available-for-the-latest-azure-sql-database-update-v12/

Indeed the program works very well but it took 16 hours to copy 1.5GB database, which makes it almost useless.

5. So I thought I will do what I saw in Microsoft presentation, as that seems to work
- I restored NAV 2016 Demo database on the SQL Server where Fillfactor is not set
- I used BACPAC to export the Demo database to file.
- Then I imported the BACPAC file on the Azure SQL server (it took 2 hours for demo database to be deployed on Azure SQL Server)
- I started NAV development environment and used the Azure SQL Server name ru01hikdvh.database.windows.net
to connect to it. (use database authentication)
At this stage I got this error message
Microsoft Dynamics NAV
---------------------------
The NAVInvest2016CU1 database on the llxfvdguik.database.windows.net server requires a Per Database license to be opened on SQL Azure.

So I changed (In NAV -> Alter database -> set "Save licence in Database") it in the Demo database and I repeated the whole process. This time I was able to connect to Azure SQL database from NAV development environment.

- I imported a FOB that contained objects from the customers database.
Then I used "Export to Data file" and "Import from Data file" in NAV to import the data and companies in the database.

Again no luck, I was not able to import all 10 companies in one go as the process failed with a time-out error message. After that the database was not usable as I would get following error message
Microsoft Dynamics NAV
---------------------------
The operation could not complete because a record in the Company table was locked by another user. Please retry the activity.


So it looks like a locking was activated and there was nothing one can do to resolve it.
The only way to fix this issue was to use restore database at point in time available on Azure SQL server.
First annoying bit was that you are not allowed to overwrite existing database. You can only create a new database.
The restore process did not work all the time; for some strange reason it depends on the time selected for the database to be restored. Sometimes the database gets restored sometime it just freezes and it never gets restored.

- the only way to resolve the issue was to repeat the same process but this time I imported one company after another.

Bottom line, NAV on Azure SQL Database works theoretically but not in a real life situations.
It is a nice concept/prototype and I guess and at some point in the future it will be good.

Until Microsoft is not able to produce a tool that would allow users to copy a backup of a database on the Azure and to use that backup to create the database on Azure, everything else is just goofing around.
Existing tools like BACPAC, deployment to Azure and so on are just Mickey mouse tools which do not really work in real life NAV environment.

Thanks for your confirmation.

Viewing all articles
Browse latest Browse all 10032

Trending Articles