Monday, August 8, 2016

AlWaysOn Availability Group - Create New Availability Group Error - Checking for compatibility of the database file location on the Server Instance that hosts secondary replica (Microsoft.SqlServer.Management.HadrModel)

This is one of common error message While Creating a New Availability Group   Here is full error I received when I attempted to Create a New Availability Group.

































Here is my environment

OS - Windows Server 2012 R2
SQL Server - SQL 2016 Enterprise Edition ( The same solution will solve for SQL 2014/2012 too)
Primary Server - SQLAG01
Secondary Server - SQLAG02


We used ‘Full’ option in Select Initial Data Synchronization Page.  The error says Primary replica is trying to search for data folder location in secondary and as a result they don’t match, and failed.

If you have choosen Full option  You have to create same file location on both the instances
e,g: Create Same Data path on both instances.

Data Path on SQLAG01 -  "C:\Program Files\Microsoft SQL  Server\MSSQL13.SQLAG01\MSSQL\DATA\"
Data Path on SQLAG02- "C:\Program Files\Microsoft SQL  Server\MSSQL13.SQLAG01\MSSQL\DATA\"

other wise choose other options for Initial Data synchronization ' Join Only' and manually restore the database on secondary

Add Databases to AlwaysOn Availability Group Error - The operating system returned the error '5(Access is denied.)

This is one of common error message While Creating a New Availability Group or Adding a Database to an availability group. Here is full error I received when I attempted to Add a database to an Availability Group

--------------------------------------------------------------------------------------------------------------------------------------------------------

Restore Database AdventureWorks fail (Microsoft.SqlServer.Management.HadrModel)


ADDITIONAL INFORMATION:

Restore failed for Server 'CGSQL02\SQLAG02'.  (Microsoft.SqlServer.SmoExtended)

System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' 
while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL13.SQLAG01\MSSQL\DATA\AdventureWorks.mdf'. (Microsoft.SqlServer.Smo)
--------------------------------------------------------------------------------------------------------------------------------------------------------





























Solution

Here is my environment

OS - Windows Server 2012 R2
SQL Server - SQL 2016 Enterprise Edition ( The same solution will solve for SQL 2014/2012 too)
Primary Server - SQLAG01 
Secondary Server - SQLAG02

SQL Installation was done on Default Paths  
Data Path on SQLAG01 -  "C:\Program Files\Microsoft SQL  Server\MSSQL13.SQLAG01\MSSQL\DATA\"
Data Path on SQLAG02- "C:\Program Files\Microsoft SQL  Server\MSSQL13.SQLAG02\MSSQL\DATA\"

SQL Service is running under  domain acccount ( condoso/sql_service )

it is a problem with the Permission of the specified folder to the user account that SQL Server service is running. The Path Which you have created on Secondary instance to perform synchronization of secondary server databases using backup/restore. in my scenario ( "C:\Program Files\Microsoft SQL  Server\MSSQL13.SQLAG01\"  Which is the Path Created for Back/restore on Secondary node ) , This path should have Full Permission on SQL Service Account. condoso\sql_service