SQLSaturday 764 – Slovakia – Bratislava

Hello folks / Dobrý deň, priatelia

Next Saturday (06/23th ) is time for Slovakia host the SQLSaturday, and I’m happy to say that I’ll be speking :).

It will be my first time visiting Slovakia, so I’m looking forward for it :), I have 2 sessions :), the first one will be “How to build solution for High Availability/Disaster Recovery” and the second one “High availability for SQL Server using Azure as DR site“.

So, in case you are arund Bratislava by Saturday 23th, show up at the event, it will be a pleasure to meet you there.

As you know, SQLSaturday is totally free 🙂 so hurry up and register your self

The schedule:

Room Borneo Madagascar
08:00 AM – 09:00 AM Registration
09:00 AM – 09:15 AM Welcome
09:15 AM – 10:15 AM
10:15 AM – 10:30 AM Coffee Break
10:30 AM – 11:30 AM
11:30 AM – 11:45 AM Coffee Break
11:45 AM – 12:45 PM
12:45 PM – 01:45 PM Lunch Break
01:45 PM – 02:45 PM
02:45 PM – 03:00 PM Coffee Break
03:00 PM – 04:00 PM
04:00 PM – 04:15 PM Coffee Break
04:15 PM – 05:15 PM
05:15 PM – 05:45 PM Raffle

See you there!


SQLSaturday Italy – Catania


Hello folks / Ciao amici

I’ll be speaking at SQLSaturday Catania, Italy on May 19th.

It will be my second time speaking in Italy, I really love that country, This time I’ll talk about SMB 3 and SQL Server.

So if your are from Cantania or will be in town in May 19th, show up at the Event it will be a pleasure to meet you there.

As you know, SQLSaturday is totally free 🙂 so hurry up and register your self

The schedule:

9:00 AM – 09:30 AM Registrazioni
09:30 AM – 10:00 AM Keynote
10:05 AM – 11:05 AM

SQL Server on Linux

Danilo Dominici

Level: Intermediate

11:05 AM – 11:25 AM Coffee break
11:25 AM – 12:25 PM
12:30 PM – 01:30 PM
01:30 PM – 02:30 PM Lunch break
02:30 PM – 03:30 PM
03:35 PM – 04:35 PM
04:35 PM – 04:55 PM Coffee break
04:55 PM – 05:55 PM
05:55 PM – 06:05 PM Conclusioni

See you there!

AlwaysOn – Distributed AG

Hello Friends!

Distributed availability groups was introduced in SQL Server 2016.

DAG” is not the official abbreviation for distributed availability group, because the abbreviation is already used for the Exchange Database Availability Group feature. This Exchange feature has no relation to SQL Server availability groups or distributed availability groups.

The DAG came to allow us to spans two separates AG (configured on two different Windows Failover Clustering). Also, the Availability group that participates at DAG do not need to be hosted at the same location, they can be a  physical, virtual, on-premises, in the public cloud, or anywhere that supports an availability-group deployment. As long as two availability groups can communicate, you can configure a distributed availability group with them.

Opposite of traditional AG that has resources configured at Windows Server Failover Clustering (WSFC), the DAG do not store resources at WSFC, all information about DAG it is stored at SQL Server

We can use the DAG for this three main usage scenarios

  • Disaster recovery and easier multi-site configurations
  • Migration to new hardware or configurations, which might include using new hardware or changing the underlying operating systems
  • Increasing the number of readable replicas beyond eight in a single availability group by spanning multiple availability groups

How it works?

DAG will provide to the application the possibility to connect to a read-only replica with different listener.
As mentioned before, each server will have their own WSFC (also can be at different domains)


As we can see at above image, we can create a DAG between 2 AG (or more), the the AG will consider the listener as nodes, so it is not possible to create DAG between the server name, we must use the virtual name (as CAP on FCI)

In this scenario, the Global Primary will send the logs to Primary node at second AG (called as forwarder) and this forwarder will send the logs to

You can configure the data movement in distributed availability groups as synchronous or asynchronous. However, data movement is slightly different within distributed availability groups compared to a traditional availability group. Although each availability group has a primary replica, there is only one copy of the databases participating in a distributed availability group that can accept inserts, updates, and deletions. As shown in the above image, AG1 is the primary availability group. Its primary replica sends transactions to both the secondary replicas of AG1 and the primary replica of AG2. The primary replica of AG2 is also known as a forwarder. A forwarder is a primary replica in a secondary availability group in a distributed availability group. The forwarder receives transactions from the primary replica in the primary availability group and forwards them to the secondary replicas in its own availability group.


It is important to know that DAG will keep just one replica writable, the remains replica it is Read-only!

We also we can create DAG from DAG, this off course will create some complexity for DBA’s administrations.


Implementation instructions

Implementation prerequisites

  • We can only create DAG between AG and should use the listener as Nodes.
  • Distributed availability groups can not be configured with Standard edition or mix of Standard and Enterprise edition.

Technical instructions

To create a DAG you can follow this example:
OBS: Note that the code are using automatic seeding

--At primary
CREATE AVAILABILITY GROUP [<name of distributed AG>]
( LISTENER_URL = ‘tcp://<name of first AG Listener>:5022’,
‘<name of second AG>’ WITH
( LISTENER_URL = ‘tcp:// <name of second AG Listener>:5022’,

At secondary AG, now let’s join it to DAG

ALTER AVAILABILITY GROUP [<name of the distributed AG>]
‘<name of the first AG>’ WITH
( LISTENER_URL = ‘tcp://<name of first AG Listener>:5022’,
‘<name of the second AG>’ WITH
( LISTENER_URL = ‘tcp:// <name of second AG Listener>:5022’,


  • Only manual failover is supported for a distributed availability group. In a disaster recovery situation where you are switching data centers, you should not configure automatic failover (with rare exceptions).
  • You need monitor network latency at a different layer for the data transport. The difference is that each WSFC cluster maintains its own availability.
  • We recommend asynchronous data movement, because this approach would be for disaster-recovery purposes.
  • If you configure synchronous data movement between the primary replica and at least one secondary replica of the second availability group, and you configure synchronous movement on the distributed availability group, a distributed availability group will wait until all synchronous copies acknowledge that they have the data.

Monitoring DAG

We can use the Dashboard at SSMS to monitor DAG as we do for traditional AG, and also we can query the DMV’s

SELECT ag.[nameas 'AG Name', ag.is_distributed, ar.replica_server_name as 'Underlying AG', ars.role_desc as 'Role', ars.synchronization_health_desc as 'Sync Status'
FROM    sys.availability_groups ag,
sys.availability_replicas ar,      
sys.dm_hadr_availability_replica_states ars      
WHERE   ar.replica_id = ars.replica_id
and     ag.group_id = ar.group_id
and ag.is_distributed = 1



SQLSaturday #707 Italy – I’m going


Ciao amici!

Next Friday February, 17th,2018 Pordenone, Italy will host next SQL Saturday #707 edition.

It will be perfect geek Saturday,  learning and making network from the Data Platform Experts.

My session will start at 03:40PM, So, if you are like me and want to explore Italy 🙂 , join us on 17th Feb.

It is a free event, all the details can be found here: http://www.sqlsaturday.com/707/eventhome.aspx

See you there!

Marcelo Fernandes

24 Hours of PASS: Portuguese


Olá Amigos,

Nesta semana teremos mais uma edição do 24 horas PASS Português, com profissionais de SQL dos países que falam português. Teremos 24 sessões sobre os mais variados temas relacionados a plataforma de dados da Microsoft.

A minha sessão será no dia 29/11 as 20:00 horário de Brasilia (22:00 horário de Portugal)  o tema será”Alta disponibilidade para o SQL Server usando Azure como DR

Este evento é online e gratuito, unindo as comunidades de SQL Server quem tem como comum o Português como idioma. O número de pessoas por sessão é limitado, por isso corra para garantir o seu lugar!


Você também pode ver a grade de palestras aqui: http://www.pass.org/24hours/2017/portuguese/Schedule.aspx



I’m a speaker at PASS SUMMIT 2017


Hello Friends,

I’m glad to announce that I’m a speaker at PASS Summit 2017, the largest SQL Server event on the planet (maybe in the universe 🙂 ).
In my session I will talk about high availability, using Azure as DR site.
I have been participating in the PASS Summit since 2012, and this will be the first time that I will participate as a speaker :).
It will be a short session “Lightning Talks” but I’ll try hard to deliver a good content.
For those who don’t know, the summit PASS is an annually event in the USA (usually in Seattle). You can register your self at PASS werbsite.
For those who going to Seattle, I’ll see you there. for those who will not be able to go this year, you can have part of the event at PASS website, they will transmit some information and interviews at PASStv during the event.

Marecelo Fernandes


Olá Amigos,
Estou feliz em anunciar que serei um palestrante no PASS Summit 2017, o maior evento de SQL Server do planeta (talvez do universo :))
Em minha sessão vou falar sobre alta disponibilidade, usando Azure como site de DR.
Tenho participado do PASS Summit desde 2012, e pela primeira vez participarei como palestrante :).
Será uma paletra curta “lightning talk” mas estou me esforçando para entregar um bom conteúdo.
Para quem não conhece, o PASS summit é realizado anualmente nos EUA (geralmente em Seattle).
Para quem vai para o Seattle, te vejo por lá. para quem não conseguirá ir este ano, no site do pass (PASStv) será transmitido algumas informações e entrevistas ao vivo durante o evento.
Marcelo Fernandes