• DBA,  Junior DBA

    Move database between drives

    SQL server Move user database steps and scripts: Check you have a free space on the moving drive and make sure the SQL service account has read and write permission. (You can check the account name in configuration manager) Move TempDB database --========================= for tempdb -- note the existing details with logical name --Step 1 USE TempDB GO EXEC sp_helpfile tempdev 1 C:\Program Files\Microsoft SQL Server\MSSQL11.PROD\MSSQL\DATA\tempdb.mdf templog 2 C:\Program Files\Microsoft SQL Server\MSSQL11.PROD\MSSQL\DATA\templog.ldf --Step 2 -- alter to new location USE master GO ALTER DATABASE TempDB MODIFY FILE (NAME = tempdev, FILENAME = 'T:\SQL_TEMPDB\tempdb.mdf') GO ALTER DATABASE TempDB MODIFY FILE (NAME = templog, FILENAME = 'T:\SQL_TEMPDB\templog.ldf') GO --Step 3 -- restart…