SQL Server Query Store Stuck in ERROR State: How to Fix it

A customer emailed me a couple of weeks ago with something that sounded, on the face of it, like a haunting. He’d been running ALTER DATABASE … SET QUERY_STORE = ON. The command succeeded. About ten seconds later, Query Store was off again. He’d tried this several times over several days and got the same … Read more

Out of memory exception in SQL Server Management Studio (SSMS) while opening ‘restore database’ page

Recently, my colleague came across a problem while trying to open the ‘Restore Database’ page in a SQL server database management tool , SSMS. Whether he right-clicked on the ‘Databases’ folder or on a specific database, the page wouldn’t open and eventually, he received an “out of memory” error message. Exception of type ‘System.OutOfMemoryException’ was … Read more

Using Snapshot Replication for Schema Transfer/Refresh Only

Snapshot replication distributes data exactly as it appears at a specific moment in time and does not monitor for updates to the data. When synchronization occurs, the entire snapshot is generated and sent to Subscribers. The snapshot process (which creates a copy of all of the objects and data specified by a publication) is also … Read more

Cleanup Log-shipping configuration through TSQL

For database migrations, DBAs many times configure log shipping from old server to new server to reduce the downtime required during the cutover. Below approach is followed to perform such migrations As in above approach, we offline our databases on primary instance , we can no longer remove the log shipping configuration using GUI through … Read more

Código de error: 22903, texto: “Ya hay otra conexión ejecutando ‘sp_replcmds’ para la captura de datos modificados en la base de datos actual.”

Recientemente me enfrenté a un escenario muy interesante en el que para una base de datos se habilitaban tanto la captura de datos modificados como la replicación transaccional. Según la documentación de MS, ambas funciones pueden funcionar juntas, pero debemos tener algunas cosas en cuenta al implementar ambas funciones juntas en una base de datos. En … Read more

PowerShell to export data from a SQL Server table to csv in chunk of 15 days

A client had a table which was storing data since 11 years, and he wanted to export all that data into csv files in a chunk of 15 days data per csv file. So I developed a PowerShell script to do the same. Hope it helps in different scenarios.

Compresión de datos en SQL Server

A medida que las bases de datos crecen cada vez más, un desafío al que se enfrentan los administradores de bases de datos es administrar el tamaño de sus bases de datos. Las bases de datos más grandes pueden consumir más espacio en disco, memoria y potencia de procesamiento, lo que puede resultar en tiempos de … Read more

TSQL to get comprehensive SQL server backup report

Many times while trouble shooting backup issues on SQL server we have to check manually that when was the latest backup taken , where it was taken and for which all databases it happened . This requires a lot of manual clicks and script typing. To ease this , I have developed a script that … Read more

Data Compression in SQL Server

As databases grow larger and larger, one challenge that database administrators face is managing the size of their databases. Larger databases can consume more disk space, memory and processing power, which can result in longer backup and restore times, slower query performance, and increased storage costs. One way to address this issue is through data … Read more

Accelerated Database Recovery in SQL Server

What is Accelerated Database Recovery SQL Server 2019 introduced Accelerated Database Recovery (ADR) as a new feature. ADR reduces the time it takes to recover a database from a crash or other failure. It accomplishes this by introducing a new recovery mechanism that greatly reduces the amount of time it takes to roll back transactions … Read more