This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
A doorstop holding an unattended heavy door and preventing a rug from passing

Finding Long Open Transactions With sys.dm_tran_database_transactions

April 26, 2019
Pinal Dave
SQL Tips and Tricks
Shrinking Database, Spatial Database, SQL Transactions, System Database

A forgotten BEGIN TRAN can pin your log for hours. Here is how to find the owner, read its age, and confirm the transaction is the reason.

Read More
Gouache painting of a wooden chest of drawers with one drawer jammed half open and a cream cloth caught in it, the drawer's knob painted vermilion

Msg 2555: Cannot Empty a TempDB File With EMPTYFILE

February 2, 2019
Pinal Dave
SQL Tips and Tricks
Shrinking Database, SQL Error Messages, SQL Server, SQL TempDB

Msg 2555 stopped a client from emptying and removing extra TempDB files with DBCC SHRINKFILE and EMPTYFILE. The messages window showed a work table page that could not be moved. Cache-clearing commands and a restart did not help, but the -f startup parameter did.

Read More
Gouache painting of a database log resisting a clamp while active pages hold its end open

SQL SERVER – Cannot Shrink Log File 2 (SQLAuthorityDB_log) Because the Logical Log File Located at the End of the File is in Use

January 2, 2019
Pinal Dave
SQL Tips and Tricks
Shrinking Database, SQL Scripts, SQL Server, Transaction Log

Diagnose a cannot shrink log file message with read-only SQL, active VLF checks and log reuse waits. Keep backup protection and size for the workload.

Read More
Gouache painting of two oversized pumpkins sitting on a small wooden cart, one cart wheel painted vermilion

Only Two VLFs: Cannot Shrink the Log File Any Further

December 19, 2018
Pinal Dave
SQL Tips and Tricks
Shrinking Database, SQL Error Messages, SQL Scripts, Transaction Log, VLF

A log file with only two VLFs cannot shrink any further, and DBCC SHRINKFILE tells you so. The message says the number of logical log files cannot be fewer than 2. Here is the script that reproduces it and the DBCC LOGINFO output that explains it.

Read More
SQL SERVER - Information Message: Cannot shrink file in database to xxxx pages as it only contains yyyy pages.

SQL SERVER – Information Message: Cannot shrink file in database to xxxx pages as it only contains yyyy pages.

December 18, 2018
Pinal Dave
SQL Tips and Tricks
Shrinking Database, SQL Error Messages, SQL Scripts, SQL Server

A reader hardcoded 1 GB in my log shrink script and got: Cannot shrink file in database to xxxx pages as it only contains yyyy pages. I explain why it appears.

Read More
An intact swimring is partly deflated beside its disconnected pump

How to Shrink All the Log Files for SQL Server? – Interview Question of the Week #203

December 9, 2018
Pinal Dave
SQL Interview Questions and Answers
Shrinking Database, SQL Backup and Restore, SQL DMV, SQL Scripts, SQL Server

Question: How to Shrink All the Log Files for SQL Server? Here is the script, plus why you should shrink only log files and never data files.

Read More
An ink brayer leaving a new continuous track while earlier linen stays clean

Recording Who Granted What With a Database Audit Specification

August 11, 2018
Pinal Dave
SQL Tips and Tricks
Shrinking Database, Spatial Database, SQL Sample Database, System Database

Current permissions never say who changed them. Set up a small audit, run a grant, a revoke and a failed attempt, and read the events back.

Read More
Previous 1 2 3 4 5 6 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com