Q&A archive

Stack Exchange Answers

Questions and answers Andy Mallon contributed across the Stack Exchange network.

DBA Stack Exchange

Fastest way to shrink LOB data in SQL Server

Question We have a database of total size of 3886 GB. Out of which 778 GB is free. So total 3108 GB worth of data is present. Out of which 2458 GB is "LOB Data" and 400 GB is worth "Regular".

Read answer

DBA Stack Exchange

Job waiting on CXCONSUMER

Question We have got a procedure on SQL Server agent jobs and this job started to hang on transaction for many hours with wait stats CXCONSUMER and never complete. The problem is after we noticed that it was hanging we kill the job and started manually during …

Read answer

DBA Stack Exchange

INSERT EXEC statement cannot be nested

Question I have a stored proc spGetSites that returns three columns for SiteName, SiteId and UnitCount. The stored proc runs perfectly fine. I'm trying to store the results of the stored proc to a temp table @Site to use for my report with below syntax. This …

Read answer

DBA Stack Exchange

How to see restore history of a deleted database?

Question For example, I had a database and I want to see which physical backup file was used to restore into it. The problem is that the database was deleted. How can I see the record? Asked2019-11-23bysql-noob Answer Depending on how the database was …

Read answer

DBA Stack Exchange

SQL log file 2TB is not enough, now what?

Question This is a hypothetical question, that flows from the answer by sepupic where they explain that 2TB is the physical limit for SQL log file. if you need it more than 2Tb you add the second log file. I have long held the belief that multiple log files …

Read answer

Server Fault

Copying SQL Server settings to new server

UserSteve is upgrading to a new server and needs to move all his server settings to the new instance. I introduce him to DBA Tools as a quick way to copy configurations and other stuff to the new instance.

Read answer

DBA Stack Exchange

SQL database stuck in recovery

Question I have SQL server 2017. I have one 3 TB size database there. Somehow due to long running transaction the database got stuck 'IN Recovery' mode after SQL server Restarted. When I checked the sql error logs it says 2 189 255 seconds remaining (Phase 2 …

Read answer

DBA Stack Exchange

How To Fix High DTU Usage on Specific Query

Question I have a query that runs every few seconds on a Microsoft SQL Azure Database. It is from a web job that checks if there are actions that need to be done based on rows in a specific table (its a queueing table). Based on the image attached, does …

Read answer

DBA Stack Exchange

Monetary value in integer over decimal datatype

Question I have came across several articles that mentioned that advise on not to store monetary value as decimal, but use integer instead. The reasoning that it does not store actual value and will cause some rounding difference/errors. But i have yet ever …

Read answer

DBA Stack Exchange

How to pause the subscriber end of transactional replication

Question How do I go about pausing transactional replication on the subscriber end. We have a publisher on Server A, a distributor on Server B and a subscriber on Server C. All are in the same network. Some background, we have quite a busy BizTalk server …

Read answer

DBA Stack Exchange

Managed Instance Restart

Question Does anyone know how to restart a SQL Server Managed Instance? The stop / start / reset are all grayed out, so that’s really. It an option. Any thoughts? Thanks... Asked2019-01-05byKevin Wilkie Answer You don't restart Managed Instance. The beauty of …

Read answer

DBA Stack Exchange

How to analyze compression options for Azure SQL Database?

Question What is the most efficient way to determine whether row or page or columnstore compression (or none) would be most effective for each index in an Azure SQL Database (standard or premium tier) used for OLTP, where sp_estimate_data_compression_savings …

Read answer

DBA Stack Exchange

Installation of SQL Server Express LocalDB 2017

Question I want to install Microsoft SQL Server LocalDB 2017 on my system. I downloaded SQL Server Express Setup (about 5.1 MB). Then I opened it and chose 'Download Media' option and then chose LocalDB. Then it downloaded SqlLocalDB.msi setup (about 45.9 …

Read answer