“Always Learning, Always Improving”
Cross
“Always Learning, Always Improving” | “கற்றது கைமண் அளவு, கல்லாதது உலகளவு” | “What you have learned is a mere handful of sand, but what you haven’t learned is the size of the world.”
MADURAIKARAN
“Love the Lord your God with all your heart and with all your soul and with all your strength.”
DB
VEERAKUMAR
Technology • Trading • Spirituality • History
Welcome to my journey

My Journey of Learning & Discovery

Technology | NSE Options Trading | Spirituality | World & Evolution | History

Sharing my personal journey, research, experiences and continuous learning across technology, NSE options trading, spirituality, world evolution and history.

Explore Blog → About Me
Veerakumar profile photo
DATA ENGINEERING
Microsoft SQL Server logo SQL SERVER
Oracle logo ORACLE
MySQL logo MySQL
Databases • ETL • Data Warehousing • Performance
DB

Technology

SQL Server, databases, AI, programming and the evolution of technology.

EXPLORE →

NSE Index Options Trading

NIFTY, BANK NIFTY, option strategies, trading psychology and my journal.

EXPLORE →

Spirituality

Personal reflections, philosophy, spirituality and questions about life.

EXPLORE →

World & Evolution

Human history, civilization, science and how the world and technology evolve.

EXPLORE →

Latest Articles

"Always On Availability Groups: Essential DBA Scripts for Monitoring and Checking SQL Server High Availability"


Check Availability Group Health:
SELECT
    ag.name AS [Availability Group],
    ar.replica_server_name AS [Replica Server],
    adc.database_name AS [Database],
    ags.is_local AS [Is Local],
    ags.is_primary_replica AS [Is Primary]
FROM
    sys.availability_groups AS ag
    INNER JOIN sys.dm_hadr_availability_replica_states AS ars
        ON ag.group_id = ars.group_id
    INNER JOIN sys.dm_hadr_availability_replica_cluster_states AS arcs
        ON ars.group_id = arcs.group_id
           AND ars.replica_id = arcs.replica_id
    INNER JOIN sys.dm_hadr_database_replica_cluster_states AS adc
        ON arcs.group_id = adc.group_id
           AND arcs.replica_id = adc.replica_id
    INNER JOIN sys.availability_group_listeners AS agl
        ON ag.group_id = agl.group_id
    INNER JOIN sys.dm_hadr_availability_replica_states AS ags
        ON ags.replica_id = ars.replica_id
WHERE
    ars.is_local = 1;
This script provides an overview of the availability group health, including the availability group name, replica server name, database name, and whether the replica is the primary replica or not.
 
Check Data Synchronization:
SELECT
    ag.name AS [Availability Group],
    d.name AS [Database],
    drs.synchronization_state_desc AS [Synchronization State],
    drs.synchronization_health_desc AS [Synchronization Health]
FROM
    sys.availability_groups AS ag
    INNER JOIN sys.dm_hadr_database_replica_states AS drs
        ON ag.group_id = drs.group_id
    INNER JOIN sys.databases AS d
        ON drs.database_id = d.database_id;
This script shows the synchronization state and health of the databases within the availability group. It provides information on whether the data is synchronized or if there are any synchronization issues.
Check Availability Group Listener:
SELECT
    ag.name AS [Availability Group],
    agl.dns_name AS [Listener DNS Name],
    agl.port AS [Listener Port],
    agl.state_desc AS [Listener State]
FROM
    sys.availability_groups AS ag
    INNER JOIN sys.availability_group_listeners AS agl
        ON ag.group_id = agl.group_id;
This script displays the availability group name, listener DNS name, port, and the state of the availability group listener.
Check Failover Readiness:
SELECT
    ag.name AS [Availability Group],
    drs.database_id AS [Database ID],
    d.name AS [Database],
    drs.is_failover_ready AS [Is Failover Ready]
FROM
    sys.availability_groups AS ag
    INNER JOIN sys.dm_hadr_database_replica_states AS drs
        ON ag.group_id = drs.group_id
    INNER JOIN sys.databases AS d
        ON drs.database_id = d.database_id;




I would like to share with you what I have learned and I hope it will be useful for you. _V€€RAKUMAR

Mastering SQL Server

Search This Blog

Powered by Blogger.

Mastering SQL Server

Labels


Translate

Restarting my career from where I left off. With hands-on experience as a Microsoft SQL Server DBA, I have developed skills in database mana...