I have restarted DC1-DB1 SQL services, after restart DC1-DB2 should be primary. But still DC1-DB2 showing as secondary. Is this is the expected behaviour?
If you have gracefully restarted the SQL Server service from SSCM or services.msc SQL Server will not treat this as event to do failover. This is not "unexpected" for WSFC. The reason is because the parameter Failure-Condition Level
is default 3. And as per Microsoft official document Configure a flexible automatic failover policy for an Always On availability group for a SQL Server restart to trigger a failover you need Failure-Condition Level=1
You can change the value either by using Powershell or Cluster GUI or TSQL. See Configure FailureConditionLevel property settings
Ex:
The following example changes the FailureConditionLevel setting on the SQL Server resource "SQL Server (INST1)" to fail over or restart on critical server errors.
Import-Module FailoverClusters
$fci = "SQL Server (INST1)"
Get-ClusterResource $fci | Set-ClusterParameter FailureConditionLevel 3
PS: With default value of 3, I believe if you go and kill SQL Server service from task manager then I believe a failover should happen, not sure though, test it.
I have restarted DC1-DB2 SQL services, nothing happen - still DC1-DB1 is primary. Is this is the expected behaviour?
Restart of secondary replica does not affects primary.