Database Blog

Troubleshooting SQL Server Deadlocks using Foglight and T-SQL Queries

Troubleshooting SQL Server Deadlocks using Foglight and T-SQL Queries Introduction:- This document explains how to find and fix SQL Server deadlocks using Foglight and T-SQL queries. Deadlocks can slow down…

Read More

Troubleshooting High Disk Queue Depth in SQL Server

Troubleshooting High Disk Queue Depth in SQL Server Introduction This document helps to find and fix high disk queue depth problems in SQL Server. These issues can slow down the…

Read More

Foglight Monitoring Tool

1. Introduction Foglight, developed by Quest Software, is a powerful and comprehensive monitoring and performance management tool. It provides real-time visibility into the health, performance, and availability of databases, servers,…

Read More

Page Life Expectancy (PLE) in SQL Server

1. Introduction Page Life Expectancy (PLE) is a key performance metric in Microsoft SQL Server that measures the duration (in seconds) a data page stays in memory (the buffer pool) before…

Read More

Oracle PLSQL to Generate XML Tag Using Standard Functionality

declare l_ctx dbms_xmlquery.ctxHandle; l_clob clob; begin l_ctx := dbms_xmlquery.newContext(‘select * from <TABLE_NAME>’); dbms_lob.createtemporary(:g_clob,true,dbms_lob.session); :g_clob := dbms_xmlquery.getXml(l_ctx); end;

Read More

Exploring the New Security Features in Oracle Database 23ai

Oracle Database 23ai introduces advanced security features designed to enhance data protection, simplify configurations, and align with modern security standards. These updates strengthen the database’s security posture and improve usability…

Read More

Dynamic Query Script to create public synonym and private synonym in database

Please use the below query to generate the script and run accordingly.   Public Synonym: ——————– select ‘create or replace public synonym ‘||table_name||’ for ‘||owner||’.’||table_name||’;’ from dba_tables where owner=’QA’;  …

Read More

Script to fix export issue while it hangs during Statistics, Marker, Type

Please run the below and do the export again. create index SYS.IMPDP_STATS_1 ON SYS.IMPDP_STATS (c5,type,c1,c2,c3,c4,statid,version);    

Read More

Step-by-Step Guide for SQL Server Always on Failover

Step-by-Step Guide for SQL Server Always on Failover Introduction SQL Server Always On Availability Groups provide high availability and disaster recovery capabilities for SQL Server databases. Synchronous commit mode ensures that data is committed to both the primary and secondary replicas, guaranteeing data integrity during failover. This guide provides detailed steps for performing both manual and automatic failovers in an Always On Availability Group. Part 1: Preliminary Checks and Preparations Before initiating any failover, whether manual or automatic, ensure the environment is healthy and ready for the transition. Step 1: Prerequisites Check – Synchronization State: Confirm that all secondary replicas are in the SYNCHRONIZED state. – Query to Check Synchronization State: SELECT ag.name AS [AvailabilityGroupName], ar.replica_server_name AS [ReplicaServerName], drs.synchronization_state_desc AS [SynchronizationState] FROM sys.dm_hadr_availability_replica_states AS drs JOIN sys.availability_replicas AS ar ON drs.replica_id = ar.replica_id JOIN sys.availability_groups AS ag ON ar.group_id = ag.group_id WHERE drs.synchronization_state_desc = ‘SYNCHRONIZED’;   – Action: Ensure that all replicas are in the SYNCHRONIZED state to avoid any data loss during failover. – Verify Health of Availability Group: – Query to Check Availability Group Health: SELECT ag.name AS [AvailabilityGroupName], ags.primary_replica AS [PrimaryReplica], ags.operational_state_desc AS [OperationalState] FROM sys.dm_hadr_availability_group_states AS ags JOIN sys.availability_groups AS ag ON ags.group_id = ag.group_id;   – Action: Ensure that the OperationalState indicates a healthy state for a successful failover. Step 2: Validate Readiness for Failover…

Read More

Essential Guide for Regular MS SQL Server Patching

Essential Guide for Regular MS SQL Server Patching Introduction: In SQL Server management, keeping up with service packs and cumulative updates is not just a recommendation, it’s a necessity. Understanding these updates and their importance can make a significant difference in the performance, security, and reliability of your SQL Server environment. Table of Contents Pre-Check and Prerequisites before Patching. SQL Server 2022 Most recentPatch. Steps to Install the patch update. Post-Installation verification. Successfully upgraded Patching. Server restart Hack. Conclusion. Pre-Check and Prerequisites Before Patching: Before diving into the patching process, it’s essential to prepare thoroughly to avoid any disruption. ü Take necessary backups of application databases. ü Check Disk Space and System Requirements. ü Inform Stakeholders About Downtime ü Disable Scheduled Jobs: Temporarily disable any scheduled jobs that could interfere with the patching process. ü Apply the Patch in a Test Environment, before updating your live server, SQL Server 2022 Most recent Patch : The latest cumulative update for SQL Server 2022 is CU14 (KB5038325), released in July 2024. This update includes all fixes and improvements from previous updates and is essential for maintaining the security and performance of your SQL Server installations. Some notable features and improvements in CU14 include: ü General bug fixes and performance enhancements. ü Security updates ensure the system remains secure and reliable. ü Improvements in manageability and reliability to enhance overall system performance. Steps to Install the patch update: ü Run the Installer: Double-click the setup file to start the installer then patch installer will pop up. ü Accept License Terms: Review and accept the license terms to proceed with the installation. ü Select Features to Update:…

Read More