0

I am trying to restore a big database in SQL Server 2008 R2. The database is about 700GB in size. My SQL Server is installed in C drive which has only 100GB of space left in it. I have the .bak file on the D drive from which I need to restore the database. Is there a way I can restore this database without increasing the space on C drive? (The D drive has 5TB of space and I would want SQL Server to access/place the data from/on D drive)

Any input will be highly appreciated.

migrated from stackoverflow.com Apr 25 '14 at 19:56

This question came from our site for professional and enthusiast programmers.

1

You can define the path for all data and log files in the second tabenter image description here

  • Thanks a lot for your reply. It seems to work i.e. the database is getting restored right now. Do you think I will face performance issues if I have different databases lying around on various disks on the computer? – Patthebug Feb 25 '14 at 4:50
  • If the drive you are restoring it onto is slow, then yes. Otherwise no, no problems at all. My SQL Server is installed on my C: drive and I have data drives D:, E: and G:. Some Dbs I have split over 3 drives to help improve performance. – Stuart Feb 25 '14 at 5:37
1

You can redirect the data files using the move command

USE [master]
RESTORE DATABASE [{DBName}] 
FROM  DISK = N'{PathToBakFile}' 
WITH  FILE = 1,  
MOVE N'{DataFileLogicalName}' 
    TO N'{NewPath}',  
MOVE N'{LogFileLogicalName}' 
    TO N'{NewPath}'
GO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy