Sql 2012 database restore insufficient space

I have a very big database that I need to restore in our dev environment, but I do not have enough space to overwrite the existing database.  I wanted to know if I could detach the current dev database, delete it, and then create a new db with the same name.  This way there would be enough space to overwrite the new db.  Do you think this will work?  As anyone run into this issue before?

Thanks,

Bill
bjenningsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve WalesSenior Database AdministratorCommented:
Are you not overwriting to the same location ?

I know I've done a restore before (although not in 2012) where I didn't have enough space for the restore of a whole new copy, but I just overwrote the existing datafiles of DEV.

Failing that, why not just drop DEV and restore - why detach ?

(Doing it this way could break links between login id's in master and the users in the DB though, I suppose).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
I wanted to know if I could detach the current dev database, delete it, and then create a new db with the same name.
This is only mathematic. How much is all current database file plus free space?
IF (SUM(db_files_size) + Drive_Free_Space) > Space_need_for_restore THEN
    Restore = OK
ELSE
    Restore = Error
ENDIF
bjenningsAuthor Commented:
Thank you guys!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.