Category Uncategorized

Useful Powershell commands

1. Check if Machine Is Domain Joined (Get-WmiObject Win32_ComputerSystem).PartOfDomain 2. View SPNs for a SQL Server Service Account setspn -L domain\sqlsvcaccount 3. Register an SPN for SQL Server setspn -S MSSQLSvc domain\sqlsvcaccount 4. Create a gMSA Account (Domain Admin) New-ADServiceAccount…

Monitor Availability Group (including DAG)

SELECT name, db_name(database_id),replica_server_name,endpoint_url,availability_mode_desc,failover_mode_desc,seeding_mode_desc,backup_priority,cluster_type_desc,required_synchronized_secondaries_to_commit,is_local,is_distributed,is_primary_replica,synchronization_health_desc,synchronization_state_desc,recovery_lsn,last_hardened_lsn,last_hardened_time,secondary_lag_secondsFROM sys.availability_replicas AS arINNER JOINsys.availability_groups AS agON ar.group_id = ag.group_idINNER JOINsys.dm_hadr_database_replica_states AS rsON ar.group_id = rs.group_idAND ar.replica_id = rs.replica_idORDER BY name;

Check errors in Azure PostgreSQL

// Author: Microsoft Azure// Display name: Find Errors// Description: Search for errors in the last 6 hours.// Categories: Workloads// Resource types: Azure Database for PostgreSQL servers// Topic: Errors AzureDiagnostics| where TimeGenerated > ago(6h)| where Category == “PostgreSQLLogs”| where errorLevel_s contains…

Check Archive Logs production

A database in ARCHIVELOG mode copies redo log entries in the achive log files. Archive log number and size is a metric of a database transactions load in time. Use the following query to monitor the Archive log production per…