Moving MSSQL Databases to Different Partition
I just moved from one Rackspace cloud server to another. The main purpose was to get IIS 8 so I could do TLS/SNI. I got a skimpy partition for the system and the preinstalled SQL Server Web Edition databases were taking up precious space so I moved them with help from this article:
http://technet.microsoft.com/en-us/library/ms345408.aspx
SELECT name, physical_name AS CurrentLocation FROM sys.master_files WHERE database_id = DB_ID(N'tempdb'); GO USE master; GO ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'K:\Data\tempdb\tempdb.mdf'); GO ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = 'K:\Data\tempdb\templog.ldf'); GO SELECT name, physical_name AS CurrentLocation FROM sys.master_files WHERE database_id = DB_ID(N'reportserver'); GO USE master; GO ALTER DATABASE ReportServer MODIFY FILE (NAME = ReportServer, FILENAME = 'K:\Data\reporting\ReportServer.mdf'); GO ALTER DATABASE ReportServer MODIFY FILE (NAME = ReportServer_log, FILENAME = 'K:\Data\reporting\ReportServer_log.ldf'); GO SELECT name, physical_name AS CurrentLocation FROM sys.master_files WHERE database_id = DB_ID(N'reportserverTempDB'); GO USE master; GO ALTER DATABASE ReportServerTempDB MODIFY FILE (NAME = ReportServerTempDB, FILENAME = 'K:\Data\reporting\ReportServerTempDB.mdf'); GO ALTER DATABASE ReportServerTempDB MODIFY FILE (NAME = ReportServerTempDB_log, FILENAME = 'K:\Data\reporting\ReportServerTempDB_log.ldf'); GO
Don't forget to delete the old tempdb after restart SQL Server and move the reportserver databases when the service is stopped after the commands and before turning SQL Server back on.