SQL_Server_Health_Check

Snippet Name: SQL_Server_Health_Check

Tags:

Created Date: 2025-06-16 13:12:46
Last Modified Date: 2025-05-31 10:32:20

Dependencies:

DBA Notes:

Sample Output:

Title: SQL Server Health Check
Author: user
i have uploaded a powerpoint that is related to sql server best practices and performance. using that file, please generate a word document that summarizes the contents

Author: ChatGPT
All the files uploaded by the user have been fully loaded. Searching won't provide additional information.

Author: ChatGPT
Here's a summary of the SQL Server health check review based on the provided PowerPoint file:

---

**SQL Server Health Check Summary**

**1. Major Performance Recommendations:**

- **Index Optimization:**
  - Consolidation of near-duplicate or redundant indexes across multiple databases.
  - Plan to drop 35 indexes, alter 12, and retain 49 based on query patterns.

- **Compression:**
  - Implement page-level compression on all tables for an estimated 40% space savings.
  
- **SQL Agent Job Failures:**
  - Frequent job failures due to data type conversion errors and deadlocks.
  - Recommendations include refactoring problematic jobs.

- **Deadlocks:**
  - Significant deadlocks in `ReportServer_IGPRDOLTDB01` and `Mobilei` databases.
  - Suggested solutions include dropping triggers and creating appropriate indexes.

- **Log File Shrinking:**
  - Advising against frequent shrinking operations due to fragmentation impact.

- **Unused and Missing Indexes:**
  - Plan to remove unused indexes and implement missing indexes to improve query performance.

- **Procedure Refactors:**
  - Addressing implicit conversions, SARGability issues, and other inefficiencies in stored procedures.

- **Backup Optimization:**
  - Implementing backup striping and tuning parameters for faster recovery.

- **Buffer Pool Extensions:**
  - Consider enabling BPE for improved caching using SSDs.

- **vCPU Configuration:**
  - Recommendation to reconfigure virtual cores to align with SQL Server???s NUMA behavior for improved performance.

**2. Minor Performance Recommendations:**

- **Index and Statistics Maintenance:**
  - Review and refine index/statistics update schedules.

- **Backup Strategy:**
  - Introduce differential backups to reduce I/O load.

- **Table Partitioning:**
  - Consider for large tables to optimize query performance.

- **Security Improvements:**
  - Strengthen SQL logins, remove untrusted constraints, and review access permissions.

- **Disk Performance:**
  - Address high disk read/write latencies through configuration and hardware improvements.

**3. Notable Items Identified:**

- High CPU usage (60%) with suboptimal parallelism settings.
- Over 140 daily deadlocks, primarily in SSRS-related databases.
- Significant I/O latency on key drives hosting database files.
- Frequent plan cache bloating due to parameterization issues.

**4. Immediate Recommendations:**

- Adjust `MAXDOP` and cost threshold for parallelism.
- Migrate data and log files to 64K block-size formatted drives.
- Review large tables for compression and archiving.

**5. Additional Recommendations:**

- Index consolidation to optimize database structure.
- Procedure refactoring to eliminate inefficiencies.
- Optimizing backup strategies for performance.

---

Would you like this summary formatted into a Word document?


Leave a Reply

SQL_Server_Health_Check

Snippet Name: SQL_Server_Health_Check

Tags:

Created Date: 2025-06-16 13:12:44
Last Modified Date: 2025-05-31 10:32:01

Dependencies:

DBA Notes:

Sample Output:

Title: SQL Server Health Check
Author: user
I am doing a SQL Server health check help me with teh categories of things to review. for example, I have Performance, Server Configuration, SSRS, SSIS among others.

Author: ChatGPT
For a **comprehensive SQL Server health check**, here are the key categories along with specific items to review within each:

---

### 1. **Performance**
   - **Server Performance**  
     - CPU usage and bottlenecks.  
     - Memory allocation (Page Life Expectancy, Buffer Cache Hit Ratio).  
     - Disk I/O metrics (Disk Queue Length, Read/Write Latency).  
     - Query Execution Plans (Identify slow queries, missing indexes).  
   - **Database Performance**  
     - Index fragmentation and maintenance.  
     - Statistics up-to-date status.  
     - Wait stats analysis (e.g., `sys.dm_os_wait_stats`).  
     - TempDB contention and configuration (files, growth settings).  
   - **Workload Monitoring**  
     - Query execution time and duration.  
     - Long-running transactions.  
     - Blocking and deadlocks.  

---

### 2. **Server Configuration**
   - **Instance Settings**  
     - Max Server Memory (`sp_configure`).  
     - Max Degree of Parallelism (MAXDOP) and Cost Threshold for Parallelism.  
     - Default fill factor and autogrowth settings.  
     - Priority Boost (should be disabled).  
     - CLR Integration and XP_CMDSHELL settings.  
   - **Service Accounts**  
     - Verify SQL Server and Agent service accounts (principle of least privilege).  
   - **Security**  
     - Authentication Mode (Windows vs. Mixed).  
     - Unused logins and orphaned users.  
     - SA account status (disable if not used).  

---

### 3. **Database Integrity and Availability**
   - **DBCC CHECKDB**  
     - Verify database integrity regularly.  
   - **Backups**  
     - Review recovery model (Full, Simple, or Bulk-Logged).  
     - Verify full, differential, and transaction log backups are running.  
     - Check backup history and last backup times.  
   - **High Availability/Disaster Recovery (HA/DR)**  
     - Status of AlwaysOn Availability Groups or Log Shipping.  
     - Failover Cluster or Database Mirroring configurations.  
     - Verify database replicas are in sync.  
     - RPO (Recovery Point Objective) and RTO (Recovery Time Objective) alignment.  

---

### 4. **SQL Server Agent**
   - **Job Management**  
     - Review enabled/disabled jobs and schedules.  
     - Check for job failures (last run status).  
   - **Alerts and Operators**  
     - Review configured alerts (e.g., severity level errors).  
     - Ensure notifications for failures are active.  

---

### 5. **SSRS (SQL Server Reporting Services)**
   - **SSRS Configuration**  
     - Verify `RSReportServer.config` settings.  
     - URL reservations for Report Manager and Web Service.  
   - **Performance and Logs**  
     - Analyze SSRS Execution Log for slow reports.  
     - Monitor report subscriptions and data refresh schedules.  
   - **Security**  
     - Review permissions (folder, data source access).  
     - Ensure service accounts are configured securely.  

---

### 6. **SSIS (SQL Server Integration Services)**
   - **Package Validation**  
     - Check for package failures and error logs.  
     - Ensure SSISDB is healthy (if using the SSIS Catalog).  
   - **Configuration**  
     - Package execution schedules and resource usage.  
     - Review deployment methods and version control.  
   - **Performance**  
     - Monitor SSIS packages for bottlenecks (source/destination delays, memory issues).  

---

### 7. **Security**
   - **Logins and Users**  
     - Review logins, roles, and users with elevated privileges.  
     - Remove unused or orphaned logins.  
   - **Encryption**  
     - Transparent Data Encryption (TDE) enabled where required.  
     - Column-level encryption if sensitive data exists.  
   - **Auditing**  
     - Review SQL Server Audit logs for critical events.  
     - Check for unauthorized login attempts.  

---

### 8. **Index and Storage Management**
   - **Index Health**  
     - Analyze index fragmentation (use `sys.dm_db_index_physical_stats`).  
     - Identify unused indexes and missing indexes.  
   - **Storage and File Sizes**  
     - Check database file sizes and autogrowth settings.  
     - Monitor space usage in database and log files.  
   - **TempDB**  
     - Multiple data files with uniform growth.  
     - Review TempDB usage and contention.

---

### 9. **Monitoring and Logs**
   - **SQL Server Logs**  
     - Check for errors, warnings, and startup issues.  
   - **Extended Events**  
     - Set up event sessions to capture slow queries, deadlocks, etc.  
   - **System Health Session**  
     - Analyze built-in `system_health` Extended Events for anomalies.  

---

### 10. **Patching and Version Management**
   - **SQL Server Version**  
     - Check for latest Cumulative Updates (CUs) and Service Packs.  
     - Validate SQL Server version compatibility with applications.  
   - **Windows Updates**  
     - Ensure the OS hosting SQL Server is up-to-date.  

---

### 11. **Licensing and Compliance**
   - **License Usage**  
     - Check licensing mode (e.g., Core-based, CAL-based).  
   - **Compliance**  
     - Ensure GDPR, HIPAA, or other regulatory compliance is met.

---

### 12. **Extended Services**
   - **Linked Servers**  
     - Validate linked server connections and credentials.  
   - **Replication**  
     - Check status and health of replication (Transactional, Snapshot, or Merge).  
   - **Full-Text Search**  
     - Ensure catalogs are up-to-date and queries are efficient.

---

If you want **queries, scripts, or checklists** for any of these categories, let me know!

Author: user
can you give me a query related to Page Life Expectancy

Author: ChatGPT
Here is a **query** to check the **Page Life Expectancy (PLE)** for each buffer node in SQL Server. Page Life Expectancy is a critical performance metric indicating how long pages stay in memory before being flushed to disk. A low PLE can signal memory pressure.

### Query for Page Life Expectancy
```sql
SELECT 
    RTRIM(instance_name) AS [NUMA Node],
    cntr_value AS [Page Life Expectancy (Seconds)]
FROM sys.dm_os_performance_counters
WHERE counter_name = 'Page life expectancy'
    AND OBJECT_NAME LIKE '%Buffer Manager%';
```

---

### **How to Interpret Results**
- **Threshold**: The general rule of thumb is **PLE > 300 seconds** (5 minutes) per NUMA node.
- **Low PLE**: If PLE drops significantly below 300, it often indicates memory pressure due to heavy read operations or insufficient memory.

---

### **Additional Notes**
- If your server has multiple **NUMA nodes**, this query will return a PLE value for each node.
- Modern systems may require a higher threshold depending on memory size. For example:
  - Servers with **64 GB RAM or more** might aim for **PLE > 1,200 seconds** (20 minutes).


Author: user
how about a query for Buffer Cache Hit Ratio

Author: ChatGPT
Here???s a **query to check the Buffer Cache Hit Ratio** in SQL Server. This metric represents the percentage of pages read from the buffer cache instead of disk. A high ratio (close to 100%) indicates good memory performance.

### **Query for Buffer Cache Hit Ratio**
```sql
SELECT 
    (1.0 - (a.cntr_value * 1.0 / b.cntr_value)) * 100 AS [Buffer Cache Hit Ratio (%)]
FROM 
    sys.dm_os_performance_counters a
JOIN 
    sys.dm_os_performance_counters b 
    ON a.object_name = b.object_name
WHERE 
    a.counter_name = 'Cache Pages' 
    AND b.counter_name = 'Page Reads/sec'
    AND a.object_name LIKE '%Buffer Manager%';
```

---

### **How to Interpret Results**
- **Ideal Value**: Close to **100%**. A value above **95%** is considered healthy.
- **Low Ratio**: If below **90%**, it may indicate:
   - Insufficient memory for the workload.
   - High I/O due to inefficient queries or index fragmentation.
   - A need to review indexing and query performance.

---

### **Notes**
- If your system has **NUMA nodes**, this ratio should ideally hold true for each node.
- You can cross-reference this with **Page Life Expectancy** to confirm memory pressure.

Let me know if you need scripts for monitoring other SQL Server performance metrics! ????


Leave a Reply