3

Is it possible for SQL Server to access a database from a different location? My Primary Hard Disk (C:) is almost full, however I have a second Hard Disk in my computer.

When I try to restore the database, SQL Server says

There is insufficient free space on Disk C:// to create Database

Is there any way to move from C:\ to D:\?

2

You will want to use the MOVE option in the restore command to tell the restore process where to put each of the files in the backup set. This is done for each logical file name specifying the new physical location.

See the details in this technet article

It also shows how to get the logical file names from the backup set.

2

You don't even need to restore another copy of it, you can just follow the steps here:

  • Alter the file metadata to the new path

    ALTER DATABASE [Sample] 
    MODIFY FILE ( NAME = Sample, FILENAME = 'D:\Whatever\Sample.mdf' );
    
  • Set the database offline

    ALTER DATABASE [Sample] SET OFFLINE;
    
  • Physically move the file (here's an example command with PowerShell (sorry)).

    Move-Item -Path "C:\Data\Sample.mdf" -Destination "D:\Whatever" -Force
    
  • Set the database back online

    ALTER DATABASE [Sample] SET ONLINE;
    
0

I found an easy way to configure the way to restore a DB stored in another disk. Just follow these steps:

  1. Right Click - Select [Device...] Restore Database
  2. In the left navigation bar - [Options]
  3. Choose another location but c://

Done. The process is completed. Thanks a lot for your help.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.