SQLTeam.com | Weblogs | Forums

SQl DB Restore with REPLACE

Hello,
I am thinking to restore the database into Sql Server using same backup for existing Database with REPLACE option, Do I need enough space or it will overwrite so I don't have to worry for disk space?

USE master;
GO


ALTER DATABASE SqlTEST SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
 
RESTORE DATABASE SqlTEST
FROM 
disk = 'd:\mssql\backup\SqlTest.bak',
WITH REPLACE
  ,RECOVERY
    ,NOUNLOAD
    ,REPLACE
    ,STATS = 10;
GO

My current DB backup size close to 1 TB and I have currently disk space shows free is around 250 GB but when I restore it with REPLACE, it will throw an error for not enough disk space or overwrite (REPLACE) option will take care off it?

Thanks for your assistance!

I believe REPLACE will go into the same data space.

If the log file is much larger in the backup than on the existing db, then that will take additional space, obviously.

Thanks Scott.
I have currently Data file drive (D:) has 250 GB space free (total Capacity is 1.2 TB) and log file drive (E:) has 340 GB free space so Log file has enough space but backup file size is almost 950 GB.
Total Disk Space on D:\ drive is 1.2 TB capacity so REPALCE option delete the space and restore?
I am just worried as restore stop in between for BIG database and sometimes it stuck into Recover stage.

If you specify REPLACE, it should overlay the existing files, so it will only need more space if somehow the old data files are larger than the current ones (that would be extraordinarily rare)

If you have enough log space, you should be ok.

Thanks Scott.
Just worried as after long time doing REPALCE.