Marc Lognoul's IT Infrastructure Blog

Cloudy with a Chance of On-Prem

SharePoint: Useful SQL Queries

SharePoint 2007 SharePoint 2010 SharePoint 2013

Introduction

This article contains SQL queries you may find useful when implementing and operating SharePoint technologies.

As usual “use at your own risk” and make sure you’re aware of the supportability limit you may hit: MS KB Article: Support for changes to the databases that are used by Office server products and by Windows SharePoint Services.

Just click on the query name to download the script.

SQL Queries

Query Run Against Additional Information
Retrieving SharePoint Build Number(s) Most of SharePoint Databases Some SharePoint database type may not include the version information.
More information: SharePoint: Retrieving the Current Build Version Number
Show Active SQL Connections SQL Server Instance(s) Hosting SharePoint Databases Useful when maintenances must be performed against databases while they must absolutely be offline
Show Active SQL Connections (with Extended Info) SQL Server Instance(s) Hosting SharePoint Databases Useful when maintenances must be performed against databases while they must absolutely be offline
Show Documents tagged as Infected by SharePoint Anti-Virus  SharePoint Content Databases Additional Information:

Show SQL Database Backup Status SQL Server Instance(s) Hosting SharePoint Databases Useful if you exclusively rely on SQL backups for data recovery
Show SQL Database Info SQL Server Instance(s) Hosting SharePoint Databases
Show SQL Database Size SQL Server Instance(s) Hosting SharePoint Databases
Show Document Size Summary in SharePoint Content Database SharePoint Content Databases

External Resources

Advertisements