Uncategorized

Move TempDb Files to a New Location

SELECT ‘ALTER DATABASE [tempdb] MODIFY FILE ‘ + CHAR(13) + ‘ (NAME = [‘ + [name] + ‘], FILENAME = ”D:\NewPath\’ + [name] + CASE [type] WHEN 1 THEN ‘.ldf’ ELSE ‘.mdf’ END + ”’);’ FROM [sys].[master_files] WHERE [database_id] = DB_ID(N’tempdb’)

Read more
Uncategorized

Get disk free space on physical host

Get a list of all volumes on the physical host running SQL Server instance, their allocated/free space in GB, and few more properties. This is an alternative to run EXEC xp_fixedDrives because that won’t work on a Linux-hosted instance. Note: This script can’t be executed on the Azure SQL database…