Saturday, September 29, 2018

Introductions of DBA


Hey, 

Welcome to the DBA world. 
It is one of the enjoyable moments for the software engineers to start the career as DBA.
Database Administrator generally shortened as DBA. 

Necessity of DBA:
Across all industry should store the customers or their client data for retrieve or show back to the customers in a distant or some period of time.

Consider,  as I am a State Bank of India, Madurai branch customer. My wife transerferred 25000 to my account. but i am not able to withdraw from My ATM. I need to make sure, whether did she transferred to me or not. I will check the mini statement from ATM. those last 10 or 20 transaction details on account will be get retrieved from stored Database tables:)

here Database comes and somebody from SBI side needs to take care of the databases.
Some of the Database experts called DBAs will be get hired by bank to Administer the available or new databases.


Lets see some of the basics........




Necessary queries to troubleshoot ALWAYS ON issues


#To check the harden rate:


SELECT
ar.replica_server_name,
adc.database_name,
ag.name AS ag_name,
drs.is_local,
drs.is_primary_replica,
drs.synchronization_state_desc,
drs.is_commit_participant,
drs.synchronization_health_desc,
drs.recovery_lsn,
drs.truncation_lsn,
drs.last_sent_lsn,
drs.last_sent_time,
drs.last_received_lsn,
drs.last_received_time,
drs.last_hardened_lsn,
drs.last_hardened_time,
drs.last_redone_lsn,
drs.last_redone_time,
drs.log_send_queue_size,
drs.log_send_rate,
drs.redo_queue_size,
drs.redo_rate,
drs.filestream_send_rate,
drs.end_of_log_lsn,
drs.last_commit_lsn,
drs.last_commit_time
FROM sys.dm_hadr_database_replica_states AS drs
INNER JOIN sys.availability_databases_cluster AS adc
ON drs.group_id = adc.group_id AND
drs.group_database_id = adc.group_database_id
INNER JOIN sys.availability_groups AS ag
ON ag.group_id = drs.group_id
INNER JOIN sys.availability_replicas AS ar
ON drs.group_id = ar.group_id AND
drs.replica_id = ar.replica_id
ORDER BY
ag.name,
ar.replica_server_name,
adc.database_name