How to get File Space used information


There are multiple ways to get this done. Starting from SQL Server 2005, you can get this information using the system logs to get the similar kind of information using system catalogs.

This can be achieved using sys.master_files and FileProperty function. The query below will give you the same information as you see in the Object Explorer window when you do the following: Right Click database name –> Tasks –> Shrink –> Files.

EXEC sp_MSforeachdb 'SELECT DB_NAME() as database_name,
name as [File Name],
physical_name as [Physical Name],
size/128.0 as [Total Size in MB],
size/128.0 - CAST (FILEPROPERTY(name,''SpaceUsed'') as int)/128.0 AS [Available Space in MB]. [file_id]
FROM sys.database_files;'

[Blog Update] SQLServerFAQ posts for October


Here are my posts on the MSDN blog SQLServerFAQ for the month of October.

A guide to troubleshooting tempdb growth due to Version Store usage:

Troubleshooting tempdb growth due to Version Store usage

An email chain with Jonathan (Blog | Twitter) resulted in this blog post:

Troubleshooting specific Login Failed error messages

A much needed VDI troubleshooting tool called SQL Server Backup Simulator:

SQL Server Backup Simulator

The GenNext for SQL Server


The SQLPASS Keynote on Day 1 of the Summit kicked off a slew of announcements which would ensure that Twitter received it’s fair share of activity for SQL Server. Look up the #sqlpass hashtag on Twitter to understand what I am saying. There are over 4,500 registrations from 49 countries for the streaming keynotes.

Among all the announcements, the one that created the maximum amount of buzz was the next major version of SQL Server, code-named Denali CTP1. As soon as Ted Kummert, Senior VP at Microsoft, made the announcement, a flurry of Tweets went out from the Tweeps attending the Keynote announcing to the world about Denali. SQL MVP Aaron Bertrand (Twitter | Blog) posted walkthrough for installing Denali on his blog. Read his narration of the Keynote session here.

The key features of Denali are:

  • SQL Server AlwaysOn – A Mission Critical Platform that helps in increasing up-time, reduce unplanned downtime due to OS patching, simplify High Availability management, support for multiple secondaries and multi-site clustering.
  • Column-based query accelerator – This will help improve query performance manifold and reduce the time taken for performance tuning.
  • SQL Server Tools code-named “Juneau – A unified environment which is a one-stop-shop for your developers and helps accelerate your time-to-market.
  • IT administration enhancements – Improved security facilitated through various improvements built into the product. You can now take advantage of the powerful XEvents to monitor SQL activity.
  • Beyond relational enhancements – Performance improvements for FileStream, Full-text search, 2D-Spatial Support and FileTable.
  • Pervasive Insight – Expand the use of Business Intelligence to business users by providing new and engaging ways to discover insights through a drag-and-drop interface, smart and powerful data querying and interactive storyboarding to allow users to quickly create and share visual presentations of large datasets.
  • Read more about it here.

    Other announcements include:

    Microsoft Code-name “Atlanta”

    Microsoft codename Atlanta is a secure cloud service that proactively monitors your Microsoft SQL Server deployments. It helps you avoid configuration problems, reduce downtime, improve performance, and resolve issues faster. Atlanta agent can analyze both versions x86 and x64 versions of SQL Server 2008 and above. Now you get a vital insight into multiple known issues that you could plague your SQL Server installation without having to manually check for known issues. Atlanta will re-define pro-active monitoring for SQL Server instances.

    SQL Server 2008 R2 Parallel Data Warehouse (PDW)

    Microsoft SQL Server 2008 R2 Parallel Data Warehouse (previously code named project “Madison”) is a highly scalable appliance that delivers performance at low cost through a massively parallel processing (MPP).

    New Path to Microsoft Certified Master: Microsoft SQL Server 2008

    If you have an aspiration to earn the coveted title of a Microsoft Certified Master for SQL Server, then there is a new path to do so. Click on the above sub-title to learn more.

    If you feel that you need more food for thought, then read the Press Pass: Microsoft Introduces New Offerings for Business Intelligence and Mission-Critical Workloads

     Watch Rushab Mehta, SQL Pass President, and Ted Kummert, Senior VP at Microsoft, discuss SQL Server: